I have a problem running nose tests and get results inside Jenkins.
The job has a shell script like this:
. /var/lib/jenkins/envs/itravel/bin/activate
python api/manage.py syncdb --noinput
DJANGO_SETTINGS_MODULE=ci_settings nosetests --verbosity=0 --processes=1 --with-xunit --xunit-file=nosetests.xml
deactivate
Part of the test suite is run using the django_nose.NoseTestSuiteRunner.
All the tests are run and the resulting nosetests.xml file is created but does not seem to be filled with the tests results:
<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="0" errors="0" failures="0" skip="0"></testsuite>
I noticed that on an import Error
fail the file is filled with one error, but otherwise, nothing...
Any idea? Is there something special to do from the tests side? Any property to set or so?
Thanks.
Xunit: output test results in xunit format¶. This plugin provides test results in the standard XUnit XML format. It’s designed for the Jenkins (previously Hudson) continuous build system, but will probably work for anything else that understands an XUnit-formatted XML representation of test results.
Default test suite name is nosetests. Whether to prefix the class name under test with testsuite name. Defaults to false. This plugin provides test results in the standard XUnit XML format.
Python’s standard unittest module loses ground to other Python test automation frameworks, as it requires a lot of boilerplate code and tests have to be included into large test classes. Nose is a popular alternative if you still want to use the default Python unit testing framework.
This plugin provides test results in the standard XUnit XML format. It’s designed for the Jenkins (previously Hudson) continuous build system, but will probably work for anything else that understands an XUnit-formatted XML representation of test results.
As far as I know, the --processes
option is not compatible with --with-xunit
. When you ask nosetests to run with the processes plugin, the tests are run in specified number of subprocesses. The xunit plugin does not know how to gather results into the xml file.
Just remove the --processes
option and you should be fine.
Nose has had an open and unresolved GitHub issue for this since 2011. As @sti said, everything works fine if you don't use --processes
. For everyone else, consider using Ignas/nose_xunitmp instead:
pip install nose_xunitmp
nosetests --with-xunitmp
nosetests --xunitmp-file results.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With