diff --git a/doc/testing.md b/doc/testing.md index 84175fee3d..d41a2cb3eb 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -171,20 +171,26 @@ Before running the tests, you need to set up the test database: rm ../db/test_mitx.db rake django-admin[syncdb,lms,acceptance,--noinput] rake django-admin[migrate,lms,acceptance,--noinput] + rake django-admin[syncdb,cms,acceptance,--noinput] + rake django-admin[migrate,cms,acceptance,--noinput] -To run the acceptance tests: +To run all the acceptance tests: -1. Start the Django server locally using the settings in **acceptance.py**: + rake test_acceptance_lms + rake test_acceptance_cms - rake lms[acceptance] - -2. In another shell, run the tests: - - django-admin.py harvest --no-server --settings=lms.envs.acceptance --pythonpath=. lms/djangoapps/portal/features/ To test only a specific feature: - django-admin.py harvest --no-server --settings=lms.envs.acceptance --pythonpath=. lms/djangoapps/courseware/features/high-level-tabs.feature + rake test_acceptance_lms[lms/djangoapps/courseware/features/problems.feature] + +To start the debugger on failure, add the `--pdb` option: + + rake test_acceptance_lms["lms/djangoapps/courseware/features/problems.feature --pdb"] + +To run tests faster by not collecting static files, you can use +`rake fasttest_acceptance_lms` and `rake fasttest_acceptance_cms`. + **Troubleshooting**: If you get an error message that says something about harvest not being a command, you probably are missing a requirement. Try running: diff --git a/rakefile b/rakefile index 8da061a4db..a805fad3e5 100644 --- a/rakefile +++ b/rakefile @@ -243,9 +243,9 @@ def run_tests(system, report_dir, stop_on_failure=true) end end -def run_acceptance_tests(system, report_dir, feature_path) +def run_acceptance_tests(system, report_dir, harvest_args) ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, 'acceptance_tests.xml') - sh(django_admin(system, 'acceptance', 'harvest', '--debug-mode', feature_path)) + sh(django_admin(system, 'acceptance', 'harvest', '--debug-mode', harvest_args)) end @@ -275,12 +275,12 @@ end # Run acceptance tests desc "Run acceptance tests" - task "test_acceptance", [:feature_path] => ["#{system}:gather_assets:acceptance", "fasttest_acceptance"] + task "test_acceptance_#{system}", [:harvest_args] => ["#{system}:gather_assets:acceptance", "fasttest_acceptance_#{system}"] desc "Run acceptance tests without collectstatic" - task "fasttest_acceptance", [:feature_path] => ["clean_test_files", :predjango, report_dir] do |t, args| - args.with_defaults(:feature_path => '') - run_acceptance_tests(system, report_dir, args.feature_path) + task "fasttest_acceptance_#{system}", [:harvest_args] => ["clean_test_files", :predjango, report_dir] do |t, args| + args.with_defaults(:harvest_args => '') + run_acceptance_tests(system, report_dir, args.harvest_args) end