Adding DCover to a CI Pipeline
Adding Diffblue Cover to your CI pipeline means that you can have unit tests automatically generated to check your code quality, saving the time and resources required to write them. This aids developers in their work and has a positive impact on the development schedule. It also forces the developer to make sure they are updating the tests and not passing on any failing tests to other Pull Requests. Using DCover in your CI environment also protects the codebase. The CI pipeline is shown below:
Please watch our demo for more details of using DCover in your CI pipeline.
The instructions below are for a single module project, but can be easily adapted for a multi-module project.
Ensure your project compiles successfully within a fully-functioning CI pipeline.
Adding DCover to a CI pipeline
Create a new workflow and select the relevant script below, taking care in each case to set:
- The workflow name
- Suitable environment variables. These are:
- The access token for the account that is your CI user (note that this must NOT be a Bot account)
- The DCover release URL.
The scripts below are self-documented and contain all the details you need for each implementation.
- The script checks if the Bot made the last commit. This is to avoid a possible infinite CI loop.
- The output values are:
- 0 = the last commit was NOT made by the Bot
- 1 = the last commit was made by the Bot.
GitHub and Azure
Please note the following prerequisites for Jenkins only:
- Use global credentials (i.e. your GitHub username and token) that have access to the relevant repository.
- Ensure the Github pull request builder plugin is selected.
- Use HTTPS rather than SSH.