Merge pull request #997 from MITx/feature/cale/js-tests

Feature/cale/js tests
This commit is contained in:
chrisndodge
2012-11-08 06:44:49 -08:00
27 changed files with 282 additions and 633 deletions

View File

@@ -1,35 +1,55 @@
# Running the CMS
# Development Tasks
One can start the CMS by running `rake cms`. This will run the server on localhost
port 8001.
## Prerequisites
However, the server also needs data to work from.
### Ruby
## Installing Mongodb
To install all of the libraries needed for our rake commands, run `bundle install`.
This will read the `Gemfile` and install all of the gems specified there.
Please see http://www.mongodb.org/downloads for more detailed instructions.
### Python
### Ubuntu
In order, run the following:
sudo apt-get install mongodb
pip install -r pre-requirements.txt
pip install -r requirements.txt
pip install -r test-requirements.txt
### OSX
### Binaries
Use the MacPorts package `mongodb` or the Homebrew formula `mongodb`
Install the following:
## Initializing Mongodb
* Mongodb (http://www.mongodb.org/)
Check out the course data directories that you want to work with into the
`GITHUB_REPO_ROOT` (by default, `../data`). Then run the following command:
### Databases
Run the following to setup the relational database before starting servers:
rake django-admin[import,cms,dev,../data]
rake resetdb
Replace `../data` with your `GITHUB_REPO_ROOT` if it's not the default value.
## Starting development servers
This will import all courses in your data directory into mongodb
Both the LMS and Studio can be started using the following shortcut tasks
## Unit tests
rake lms # Start the LMS
rake cms # Start studio
rake lms[cms.dev] # Start LMS to run alongside Studio
rake lms[cms.dev_preview] # Start LMS to run alongside Studio in preview mode
Under the hood, this executes `django-admin.py runserver --pythonpath=$WORKING_DIRECTORY --settings=lms.envs.dev`,
which starts a local development server.
Both of these commands take arguments to start the servers in different environments
or with additional options:
# Start the LMS using the test configuration, on port 5000
rake lms[test,5000] # Executes django-admin.py runserver --pythonpath=$WORKING_DIRECTORY --setings=lms.envs.test 5000
*N.B.* You may have to escape the `[` characters, depending on your shell: `rake "lms[test,5000]"`
## Running tests
### Python Tests
This runs all the tests (long, uses collectstatic):
@@ -43,10 +63,6 @@ xmodule can be tested independently, with this:
rake test_common/lib/xmodule
To see all available rake commands, do this:
rake -T
To run a single django test class:
django-admin.py test --settings=lms.envs.test --pythonpath=. lms/djangoapps/courseware/tests/tests.py:TestViewAuth
@@ -67,6 +83,28 @@ To run a single nose test:
Very handy: if you uncomment the `--pdb` argument in `NOSE_ARGS` in `lms/envs/test.py`, it will drop you into pdb on error. This lets you go up and down the stack and see what the values of the variables are. Check out http://docs.python.org/library/pdb.html
### Javascript Tests
These commands start a development server with jasmine testing enabled, and launch your default browser
pointing to those tests
rake browse_jasmine_{lms,cms}
To run the tests headless, you must install phantomjs (http://phantomjs.org/download.html).
rake phantomjs_jasmine_{lms,cms}
If the `phantomjs` binary is not on the path, set the `PHANTOMJS_PATH` environment variable to point to it
PHANTOMJS_PATH=/path/to/phantomjs rake phantomjs_jasmine_{lms,cms}
## Getting More Information
Run the following to see a list of all rake tasks available and their arguments
rake -T
## Content development
If you change course content, while running the LMS in dev mode, it is unnecessary to restart to refresh the modulestore.