To create JUnit reports, you just need the python library xmlrunner. This is needed for the integration with build server like Jenkins.
Installation
# example installation with pip $ sudo pip install xmlrunner
Usage
Just replace for example:
unittest.TextTestRunner(verbosity=2).run(test_suite)
with
from xmlrunner import xmlrunner """ code for test suite ... """ xmlrunner.XMLTestRunner(verbosity=2, output='reports').run(test_suite)
Jenkins
On Jenkins add a new “post-build” action and select the Publish JUnit test result report. Add now the string “reports/*.xml” into the “Test report XMLs” field.