Commit 6b039417 by Will Daly

Changed test_acceptance to test_acceptance_lms and test_acceptance_cms

Updated testing docs to reflect changes to the rake file

Added option to pass arguments (including --pdb) to rake test_acceptance
Updated readme
parent 43244538
...@@ -171,20 +171,26 @@ Before running the tests, you need to set up the test database: ...@@ -171,20 +171,26 @@ Before running the tests, you need to set up the test database:
rm ../db/test_mitx.db rm ../db/test_mitx.db
rake django-admin[syncdb,lms,acceptance,--noinput] rake django-admin[syncdb,lms,acceptance,--noinput]
rake django-admin[migrate,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: To test only a specific feature:
django-admin.py harvest --no-server --settings=lms.envs.acceptance --pythonpath=. lms/djangoapps/portal/features/ rake test_acceptance_lms[lms/djangoapps/courseware/features/problems.feature]
To test only a specific 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`.
django-admin.py harvest --no-server --settings=lms.envs.acceptance --pythonpath=. lms/djangoapps/courseware/features/high-level-tabs.feature
**Troubleshooting**: If you get an error message that says something about harvest not being a command, you probably are missing a requirement. **Troubleshooting**: If you get an error message that says something about harvest not being a command, you probably are missing a requirement.
Try running: Try running:
......
...@@ -243,9 +243,9 @@ def run_tests(system, report_dir, stop_on_failure=true) ...@@ -243,9 +243,9 @@ def run_tests(system, report_dir, stop_on_failure=true)
end end
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') 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 end
...@@ -275,12 +275,12 @@ end ...@@ -275,12 +275,12 @@ end
# Run acceptance tests # Run acceptance tests
desc "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" desc "Run acceptance tests without collectstatic"
task "fasttest_acceptance", [:feature_path] => ["clean_test_files", :predjango, report_dir] do |t, args| task "fasttest_acceptance_#{system}", [:harvest_args] => ["clean_test_files", :predjango, report_dir] do |t, args|
args.with_defaults(:feature_path => '') args.with_defaults(:harvest_args => '')
run_acceptance_tests(system, report_dir, args.feature_path) run_acceptance_tests(system, report_dir, args.harvest_args)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment