Python unittest build extension
Execute your Python 3 unit tests in Visual Studio Team Services and get your test results and coverage information as part of your build.
The task uses the Python unittest-xml-reporting and coverage.py modules to execute the unit tests using test discovery. If you want to try and run this locally first to see if it works then, after installing the modules in your virtual environment, try executing the following.
Tests can also be discovered by changing the pattern of the test files as described in the Python documentation.
Configuring the task
The task takes 3 parameters, these being:
The results from the unit tests are published in the JUnit XML format and so can be used with the Publish Test Results task.
The coverage results are compatible with Cobertura and an HTML report is generated as part of the task.
Python 3 must be installed and be available in the PATH.
Whilst not tested specifically against Linux build agents, if you would like to try then you might also need to install the package appropriate for your distribution to make the venv module available.
If using the hosted build agents then you will need to check that you are using one which has Python 3 available (Hosted VS2017 for instance).
Loading More data ...