Uploading Cover Reports Bundles
How to upload the coverage and Cover Reports generated during test creation or afterwards.
Each time Diffblue Cover writes tests you can upload a report to analyse what Diffblue Cover has done. Diffblue Cover uploads three files to Diffblue Cover Reports:
report.json
- Diffblue's coverage report created automatically bydcover
(Cover CLI).
- Build your project.
- Run the following
dcover
command to create tests, generate the coverage reports, and upload them to the specified location of the Cover Reports service:
dcover create
--coverage-reports
--report <URL of Reports service>
--project <name of project>
--name <name of report>
For example:
dcover create
--coverage-reports
--report http://cover-reports-service
--project "customer-markets.trading.name.name"
--name "Branch: 1234/feature-TG12345"
The
--coverage-reports
command generates JaCoCo reports in /.diffblue/reports/
. It can be configured using the additional options:--jacoco-command-manual
- run the non-Diffblue tests.--jacoco-command-diffblue
- run the Diffblue tests.
Please note that the
--coverage-reports
command assumes that the Diffblue tests are named following the *DiffblueTests.java
pattern. To measure the coverage achieved by Diffblue, Cover will run all tests which match the pattern *DiffblueTest.java
. To measure the coverage for the "manual" tests, Cover will run all tests which run normally, but exclude the pattern *DiffblueTest.java
. If the filenames for the created tests were changed or if --class-name-template
was used, the generated JaCoCo reports will not be accurate. In that case, please generate the coverage reports manually.Sometimes, tests are written using the
dcover create
command without the --coverage-reports
option. In this case, the JaCoCo files can be produced without having to create the tests again, using:dcover coverage-reports
The
dcover coverage-reports
command generates JaCoCo reports in the same way as the dcover create --coverage-reports
command, so it can be configured using the same additional options. Run dcover coverage-reports --preflight
to check if all preconditions necessary for creating the reports are met, without creating the reports themselves.Sometimes it's useful to upload files that have already been generated. This can be done using:
dcover upload <URL of Reports service>
--project <name of project>
--name <name of report>
For example:
dcover upload http://cover-reports-service
--project "customer-markets.trading.name.name"
--name "Branch: 1234/feature-TG12345"
You can use Cover Reports to monitor your test coverage without making use of Cover to create tests for your project. This can be useful to establish a baseline of test coverage for your project before using DiffBlue Cover to create tests, or simply to monitor test coverage for projects you don’t plan to use with Diffblue Cover. To achieve this:
- Generate and upload reports for your project before you run dcover create on the project for the first time - see Generate reports only and Upload existing files to Cover Reports.
- This will create and upload the
diffblue-tests-jacoco-report.xml
andmanual-tests-jacoco-report.xml
files but will not create thereport.json
file. - When viewing the upload in Cover Reports you will be notified that the selected upload has not had
dcover create
run on it. The functionality in Cover Reports such as coverage breakdown, testability analysis, and output codes, which can help you to identify how to improve your coverage, will be reduced until you rundcover create
on the project.
Please choose suitable values for the
--project
and --name
arguments as these are used to structure the uploaded information. It is a good idea to name them with something that best reflects this snapshot of coverage in the project.Last modified 23d ago