Reputation: 16077
I am using Hudson for continuous integration in our project. We are using python, git and nose tests for unit testing. What I need is that Hudson should execute nose tests after every build. For that I have added following shell scripts in under execute shell section.
$ nosetests /sub/test_sample1.py
$ nosetests /sub/test_sample2.py
$ nosetests /sub/test_sample3.py
...
Hudson is executing these scripts correctly. But the problem is that if any of the test scripts fails here that it won't run other scripts next to it. It stops after first error. I want it should keep on executing all test cases. How can I do this?
Upvotes: 1
Views: 2505
Reputation: 3382
I'd take advantage of nose's ability to find the tests and run them instead.
Rename your test files to something like sub/sample1_test.py, sub/sample2_test.py, etc., and then just run
nosetests sub/
Nose will look for files ending in _test and run them. Very handy. See the nose documentation on "finding tests".
In case it wasn't clear, nose will, once it finds all the tests, run all of them. This keeps you from failing before all the tests are run, but you will fail if any of them do not pass.
Upvotes: 1
Reputation: 407
For my own project, I wrote a fabric python files that manage all the unit testing. Since I am using django, I have django incorporate with nose and coverage.
Here are my part of my scripts:
local('%(local_virtual_env)s/Scripts/activate.bat'
' & cd %(local_project_path)s/configs/common'
' & python manage.py test test1 '
'--settings=myprofile.configs.local.settings_local '
'--with-coverage --with-xunit --with-xcoverage '
'--cover-tests --cover-erase --cover-inclusive '
'--cover-package=myprofile.apps' % env,
capture=False)
Upvotes: 0