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 by dcover (Cover CLI).
  • 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 your project build to generate JaCoCo files.
  • 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
--report <URL of Reports service>
--project <name of project>
--name <name of report>
For example:
dcover create
--report http://cover-reports-service
--project ""
--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 * pattern. To measure the coverage achieved by Diffblue, Cover will run all tests which match the pattern * To measure the coverage for the "manual" tests, Cover will run all tests which run normally, but exclude the pattern * 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, see Commands & Arguments.

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'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 ""
--name "Branch: 1234/feature-TG12345"

Upload without creating tests

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 and manual-tests-jacoco-report.xml files but will not create the report.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 run dcover create on the project.

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