The Diffblue SonarQube Plugin visualizes the test coverage provided by Diffblue Cover’s AI‑generated unit tests directly inside SonarQube. This allows development teams to view and track Diffblue‑specific testing metrics alongside their standard code quality measures — bringing AI‑powered testing insights into the familiar SonarQube dashboard.
The plugin adds a set of coverage metrics that highlights the contribution of Diffblue Cover’s automatically generated tests. These measures help teams understand how much of their codebase is covered by AI‑written tests and where gaps remain.
Key measures include:
- Diffblue Total Coverage (lines and %) – Lines covered by Diffblue‑generated tests, reported as both a line count and a percentage of executable lines.
- Diffblue‑only Coverage (lines and %) – Lines that are covered exclusively by Diffblue‑generated tests (i.e., not covered by any other tests), also shown as a count and a percentage.
By integrating these metrics with SonarQube’s existing dashboards and quality gates, the plugin helps teams understand the specific contribution of Diffblue’s AI‑generated tests to their overall code coverage and code quality.
- SonarQube Community Edition (or compatible higher edition)
- Java projects using Diffblue Cover. (Example repo with the necessary Diffblue data generated https://github.com/diffblue/SonarQube-Example-Repo)
- Diffblue Cover CLI installed (Optional. Only needed for generating Diffblue tests and data on projects)
- Obtain the Diffblue Cover SonarQube plugin JAR from the SonarQube marketplace, or build the SonarQube plugin jar file:
mvn clean package - Copy the produced
sonar-plugin/target/diffblue-sonar-plugin-X.X.X.jarto the extensions/plugins/ directory of your SonarQube installation, replacing any previous versions. For example:cp sonar-plugin/target/diffblue-sonar-plugin-0.1.0-SNAPSHOT.jar ~/sonarqube-25.11.0.114957/extensions/plugins/ - Restart the SonarQube Server so that the new plugin is loaded and available to all projects.
Once the plugin is installed, project owners can enable and configure it per application.
The Diffblue Plugin is configurable at the Project-level. For each project that should use Diffblue metrics:
- Open the project in the SonarQube UI.
- Navigate to Project Settings → General Settings.
- Locate the Diffblue tab; configuration options will appear there.
- Within this tab you can:
- Turn the plugin on for that project. (Off by default)
The plugin supports both local development and automated CI/CD workflows.
Analysis are typically triggered on your build server or during local builds — the approach depends on how you manage source code and testing. A common pattern looks like this:
- Checkout source code.
- Build and test the project using Maven or Gradle.
- Run Diffblue Cover to generate tests and coverage reports.
- Run your SonarQube analysis (for example with mvn sonar:sonar or sonar-scanner).
Additionally, to enable coverage highlighting in SonarQube, you need to configure your build so that the JaCoCo XML generated by Diffblue cover (diffblue-tests-jacoco-report.xml and manual-tests-jacoco-report.xml) are passed to SonarQube as coverage inputs. You can do this by adding the appropriate sonar.coverage.jacoco.xmlReportPaths property in your Maven or Gradle configuration (or by supplying it as a system property on the command line).
For Maven
<properties>
<sonar.coverage.jacoco.xmlReportPaths>
.diffblue/reports/diffblue-tests-jacoco-report.xml,
.diffblue/reports/manual-tests-jacoco-report.xml
</sonar.coverage.jacoco.xmlReportPaths>
</properties>
For Gradle
sonarqube {
properties {
property "sonar.coverage.jacoco.xmlReportPaths",
".diffblue/reports/diffblue-tests-jacoco-report.xml," +
".diffblue/reports/manual-tests-jacoco-report.xml"
}
}
Developers generate Diffblue tests locally (for example during development or refactoring).
CI pipelines then run dcover coverage-reports to generate existing coverage data — no Diffblue report files need to be committed.
Teams locally generate Diffblue tests and commit the tests the accompanying coverage report files (such as diffblue-tests-jacoco-report.xml & manual-tests-jacoco-report.xml) into the repository.
This ensures consistent metrics across local and CI/CD builds.
The build pipeline runs both dcover create and dcover coverage-reports, generating and analyzing Diffblue tests automatically to ensure coverage metrics always match the current code.