Knowledge Base > Diffblue Cover Reports > 3. Uploading Cover Reports bundles

Uploading Cover Reports Bundles

(You may prefer to look at the Cover Reports sample project before uploading your own files).

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 by dcover.
  • diffblue-tests-jacoco-report.xml: a JaCoCo coverage report created as part of the project build
  • manual-tests-jacoco-report.xml: a JaCoCo coverage report created as part of the project build

Generate files and upload to Cover Reports

  • Configure project build to generate JaCoCo files
  • Build 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.

For further information on these commands, please see the user manual.

Generate reports only

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.

Upload existing files to Cover Reports

Sometimes it is 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"

Project and Name arguments

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.

Suggested next page

Authenticating Cover Reports Uploads