Generate and upload reports bundles
Cover Reports data, referred to as "reports bundles", are generated as part of your code development process and uploaded to Cover Reports. This can be done from Cover CLI and/or Cover Pipeline, using the appropriate dcover
commands detailed in this topic. Reports bundles are comprised of the following files:
report.json
- Diffblue's coverage report.diffblue-tests-jacoco-report.xml
- a JaCoCo coverage report providing data for Diffblue tests (created by Diffblue Cover).manual-tests-jacoco-report.xml
– a JaCoCo coverage report providing data for manual tests (created by a developer).
Reports bundles can be generated and uploaded as follows:
Cover Pipeline Integration - integration with Cover Pipeline reporting on the baseline tests.
Create, Generate, Upload - create tests, generate the reports bundle, and upload the bundle to the Cover Reports server.
Generate Only - generate the reports bundle only, no tests created, no upload.
Upload Only - upload an existing reports bundle only.
The associated dcover
commands can be run from Cover CLI or integrated into your CI/CD workflow/pipeline as needed.
Before generating any reports bundles, run dcover coverage-reports --preflight
to check if all preconditions necessary for generating the reports are met, without creating the reports themselves.
Command summary (core options only):
Cover Pipeline Integration
This topic details integrating Cover Reports contribution into Cover Pipeline. Cover Pipeline is primarily used to create tests focused on recently changed source files, but can also be used with a Diffblue Cover: Baseline label in order to create / refresh the full baseline tests suite. Cover Reports is primarily used to report on the full baseline test suite and so this recommended integration automatically skips generating and uploading reports unless running with the Diffblue Cover: Baseline label.
Prerequisites:
Configure your project to generate JaCoCo files (see Java project config (JaCoCo)).
Command details:
Configure your CI pipeline to add coverage-reports
and upload
to the existing CI command, e.g:
Note that the coverage-reports
and upload
commands here may need additional arguments to configure the commands to your project and environment. These additional arguments are described below in Generate Only and Upload Only.
Create, Generate, Upload
This topic details the dcover
command to create tests, generate the reports bundle, and upload the bundle to the Cover Reports server. Note that Cover Reports is primarily focused on reporting the full test suite and so this approach is not recommend in combination with the create --patch-only
option.
Prerequisites:
Configure your project to generate JaCoCo files (see Java project config (JaCoCo)).
Build your project.
Command details:
Run the following dcover
command:
For example:
Argument | Description |
---|---|
| Generates the reports bundle. |
| Uploads the reports bundle to the specified Cover Reports server. See your Cover Reports Administrator for details, if needed. |
| Sets the name of the reports bundle. Replace |
| Sets the specific name of the project to which this reports bundle relates. Replace |
| Sets the path to the project in Cover Reports. Replace |
| Cover Reports username and password. Used for authenticated uploads only - see Authenticated uploads. The username and password must match those configured by your Cover Reports Administrator. |
| Used to define a custom test class naming convention to identify tests written by Diffblue Cover. If this argument omitted, the default value of |
Semicolon (;), forward slash (/), backslash (\), and percent sign (%) are not allowed in the --project-name
and --location
arguments due to security reasons. These characters will be automatically removed to prevent potential security risks, and the upload process will continue.
The previous --report
argument has been replaced with --upload
(Diffblue Cover release 2023.11.01 and later). Use of --report
should be avoided as this option will be fully removed in future releases.
Optional JaCoCo arguments:
Argument | Description |
---|---|
| Custom command to generate the JaCoCo report for tests written by Diffblue Cover. |
| Custom command to generate the JaCoCo report for manually written tests. |
| Filename and path (including the |
Examples (using default values):
Please see --class-name-template in Commands & Arguments as a standardised way to define a template for what is and is not counted as a diffblue test that works with Gradle and Maven
Generate Only
Generate the reports bundle only - no tests created, no upload to the server. This can be useful if tests have already been created for the project using dcover create
, but the --coverage-reports
option wasn't included.
Prerequisites:
Configure your project to generate JaCoCo files (see Java project config (JaCoCo)).
Command details:
Run the following dcover
command:
Once the reports bundle has been generated, you can upload the bundle to your Cover Reports server using dcover upload
- see Upload Only below.
Optional arguments (as detailed in Commands & Arguments):
Additional JaCoCo arguments:
Argument | Description |
---|---|
| Custom command to generate the JaCoCo report for tests written by Diffblue Cover. |
| Custom command to generate the JaCoCo report for manually written tests. |
| Filename and path (including the |
Examples (using default values):
Upload Only
Upload an existing reports bundle only. This can be useful when the reports bundle has been generated separately, but not uploaded.
Command details:
Run the following dcover
command:
For example:
Component | Description |
---|---|
| Uploads the reports bundle to the Cover Reports server. Replace |
| Sets the name of the reports bundle. Replace |
| Sets the specific name of the project to which this reports bundle relates. Replace |
| Sets the path to the project in Cover Reports. Replace |
| Cover Reports username and password, used for authenticated uploads only. The username and password must match those configured by your Cover Reports Administrator. |
Semicolon (;), forward slash (/), backslash (\), and percent sign (%) are not allowed in the --project-name
and --location
arguments due to security reasons. These characters will be automatically removed to prevent potential security risks, and the upload process will continue.
Additional optional arguments (as detailed in Commands & Arguments):
Additional JaCoCo arguments:
Argument | Description |
---|---|
| Filename and path (including the |
| Filename and path (including the |
Considerations
When generating, naming, and uploading reports bundles, consider the following. You may also wish to discuss these with your Cover Reports Users and Cover Reports Administrators as appropriate.
Generate & Upload - Timing: You can generate and upload reports bundles before, during, and after code development. For consistency, you may wish to define specific schedules and you may also find it useful to generate and upload reports for your project before you run
dcover create
on the project for the first time (useful for setting a coverage baseline) - see Generate Only and Upload Only.Naming Conventions: The
--name
,--project-name
and--location
arguments are used to structure the uploaded data within Cover Reports. Diffblue recommends that you select an appropriate and consistent naming convention to help with data visualization in the Cover Reports UI. Alternatively, don't use these options and allow the data to be auto-generated.Authentication: If upload authentication has been enabled by your Cover Reports Administrator, you'll need to use the defined username and password when uploading your reports bundles. See Authenticated uploads for details.
Last updated