Integrating with continuous integration tools

Continuous integration tools allow us to validate the integrity of our application by running the test suite on every commit. We can configure them to raise an alert if any of the tests are failing, or even if the test coverage level drops too low.

Jenkins

Jenkins is a popular Java-based continuous integration system. Integrating with Jenkins requires the nose2 runner because we will need to get output in an XML format.

The first thing we need to do is to configure Jenkins to run the unit tests as a part of the build. To do this, we add a shell step to the build and enter the command to run the tests. We need to enable the JUnit XML plugin and get coverage in XML format, as shown in the following screenshot: ...

Get Test-Driven Python Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.