Skip to content

Added GitLab CI/CD template for running Diffblue Cover

What does this MR do and why?

Diffblue Cover automatically writes unit tests for Java project. This pipeline template configures a runner to have Diffblue Cover write unit tests and add them to merge requests. Please watch this short video to understand what the Diffblue Cover integration is, how it is installed and how to use it.

An example of the template being used can be seen in this Merge Request: diffblue/examples/spring-petclinic-demo!1

How to set up and validate locally

  1. Clone https://gitlab.com/diffblue/examples/spring-petclinic-demo
  2. Obtain a trial license from https://www.diffblue.com/try-cover/gitlab/
  3. Create an access token with write_repository permission
  4. Create a "Diffblue Cover: baseline" project label (optional)
  5. Populate CI or environment variables:
    • DIFFBLUE_LICENSE_KEY - with your trial license key
    • DIFFBLUE_ACCESS_TOKEN - with your access token secret
    • DIFFBLUE_ACCESS_TOKEN_NAME - with your access token name
    • Note that these will be better managed via !134437 (merged)
  6. Open a new merge request creating new .gitlab-ci.yml file based on Diffblue-Cover template
    • Label it "Diffblue Cover: baseline" if you want a full baseline test suite
    • Leave it unlabelled if you want tests just for the changed files (consider modifying some Java in src/main/java so that there are changes to test!)
  7. Wait for pipeline(s) to complete (if tests were written then a 2nd pipeline will be triggered)
  8. Review pipeline results to see tests committed to the repository.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rob Oxspring

Merge request reports