ORA Developer Guide

Table of Contents

What is ORA?

Open Response Assessments (ORA), are a problem type / XBlock used in the edX Platform. They allow an instructor to create a prompt that students respond to with text, files, or both, and are used for more open-ended assignments like essays or project submissions.

Existing Documentation

There are a lot of great ORA resources:

Where's the code?

ORA is broken into two separate repositories:

There is a useful test course which contains a variety of configurations of ORA problems:

Developing with Devstack

Note - anytime I say "from inside the lms", that means you've run make lms-shell from the devstack directory and are on a command prompt inside the lms container.

Editing ORA

When editing ORA directly, the easiest way to test changes is to install an “editable” copy of ORA into your devstack. To do this:

  1. Clone the edx-ora2 repo into ../src/ directory (relative to your devstack repo location). This will mount the directory in a way that is accessible to the lms container.

  2. Install an editable copy of your local ORA by either:

    1. Running make install-local-ora from the edx-ora2 repo. OR

    2. From inside the lms, uninstall ora2 and reinstall your local copy by running pip uninstall ora2 -y; pip install -e /edx/src/edx-ora2/

  3. Set up a development virtual environment, note that this MUST be named edx-ora2 for related scripting to work.

    1. cd /edx/src/edx-ora2

    2. virtualenv edx-ora2

    3. source edx-ora2/bin/activate

    4. make install

    5. Ensure that your virtual environment is named edx-ora2. Using a different name will cause errors when trying to generate translations.

  4. Now, in the devstack directory on your host, run:

    1. make lms-restart lms-logs

  5. That's it, you're good to go! See Makefile for all the available commands, most are fairly self-explanatory

    1. In order to simulate a given tox environment (django18, django111, quality, js), run tox -e <env> for the env in question (after re-activating your edx-ora2 virtual environment).

    2. Usually, you can just run the underlying make commands for quicker tests, as requirements aren't re-installed.

If you keep your containers running, you can return to your configured env very quickly - just cd /edx/src/edx-ora2; source edx-ora2/bin/activate from inside the lms and you're good to go. As of right this second, you need to repeat all these steps after restarting your container (because solving that problem is still in progress).

Editing Submissions

ORA code also depends on edx-submissions. As a result, anytime a new version of edx-submissions is released, ORA code must be updated as follows.

For devstack:

make lms-shell # get into docker container cd /edx/src/edx-ora2 # goto into ora2 folder source edx-ora2/bin/activate # activate ora2 virtual environment pip install -U edx-submissions # installs latest version of submissions from pypi # OR pip install -e /edx/src/edx-submissions # istalls local version of submissions

Available make commands

  • make javascript - makes the bundled JavaScript files for LMS and Studio

  • make quality - run the JSHint quality tests

  • make sass - recompiles sass, can be done while edx-platform is running, then refresh the browser to see the changes

  • make test - run all the tests

  • make test-acceptance - run the acceptance tests

  • make test-a11y - run the accessibility tests

  • make test-js - run the JavaScript tests

  • make test-js-debug - run the JavaScript tests in debug mode in Chrome

  • make test-python - run the Python tests

  • make test-sandbox - run all the sandbox tests (currently acceptance and a11y)

Release Process

Before committing any changes, remember to regenerate the CSS and the bundled JavaScript files. Your changes may work locally because Studio, LMS and the tests access the raw files directly, but on a sandbox or production-like environment only the bundled files are used. You should do the following:

make javascript sass

Release process documentation has moved to ORA2 Release Process

Running acceptance tests

The ORA acceptance and accessibility tests are written as Bok Choy tests that run against a sandbox. 

First create a sandbox following the steps at Creating an ORA2 Sandbox

Now you can run the acceptance tests:

  1. Read the documentation: https://github.com/edx/edx-ora2/blob/master/test/acceptance/README.rst/

  2. On your devstack, do the following:

    (as edxapp user) cd /edx/src/edx-ora2 source edx-ora2/bin/activate export ORA_SANDBOX_URL=https://staff:edx@andy-armstrong.sandbox.edx.org (replace with name of your sandbox)

Debugging Python with PyCharm

The first step is to be able to debug into ORA2 source code when running Studio or LMS:

  1. Click on Run > "Edit Configurations..." (or choose it from the toolbar)

  2. For each configuration that might need ORA 2

    1. Select the configuration in question

    2. Click the "..." icon for the "Path Mappings" property

    3. In the modal that appears, click "+" to add a new mapping

    4. In the new row that appears, specify the local path to your ORA2 source code

    5. Then specify the remote path as: /edx/src/edx-ora2

    6. Hit OK

  3. Hit OK to save all the changes

The next step is to add a new remote interpreter which uses the ORA2 virtual env:

  1. Follow the steps to create a remote interpreter here:

    1. https://github.com/edx/edx-platform/wiki/Setting-up-PyCharm-for-edX-development

  2. Before saving the new interpreter, change the "Python interpreter path" to point to the ORA2 virtual env: /edx/src/edx-ora2/edx-ora2/bin/python

  3. Note that this will have changed the default project interpreter to be your new one, so switch it back to your original

The final step is to add a debug configuration for running ORA2 tests:

  1. The simplest option is to clone an existing configuration, e.g. the one you use for running LMS

  2. Rename the configuration as "ORA Tests"

  3. Make sure that the script path is relative (./manage.py)

  4. Change the "Script Parameters" to "test" (this will run all the tests)

  5. Click on "Environment Variables":

    1. Click on "+" to add a new environment variable

    2. Specify the name as "DJANGO_SETTINGS_MODULE"

    3. Specify the value as "settings.test"

  6. Change the "Python interpreter" to select your new ORA2 remote interpreter

  7. Change the working directory to /edx/src/edx-ora2

  8. Click on "Path Mappings":

    1. Verify that you have a mapping for edx-ora2 (you should have created one in the previous section above)

    2. If not, follow the steps above to add one