Working with Cover Reports 1.0
Please see our introductory page, Getting Started with Cover Reports, for full details on installing and uploading your first reports.
- Creating Tests and Reports
- Creating Reports Only
- Viewing your reports
- Database Location
- Working with projects and reports
- Advanced features
Creating Tests and Reports
To start using Diffblue Cover Reports, you can either:
- Use the
dcover upload <url>command to upload existing reports, as described in Getting Started with Cover Reports
- Use the
dcover createcommand to write tests and create/upload reports as follows, for both Maven and Gradle:
dcover create --coverage-reports --report <URL of Reports server>:<port> --project <projectname path> --name <name of report>
dcover create --coverage-reports --report http://reports.internal.customer.com:8080/ --project customer-markets.trading.name.name --name "Branch: 1234/feature-TG12345"
For both commands, you will receive a progress update.
--coverage-reports command generates JaCoCo reports in
/.diffblue/reports/. It can be configured using the additional options:
--jacoco-command-diffblue options, which run the non-Diffblue tests and the Diffblue tests, respectively. For further information on these commands, please see the user manual.
Please note that the
--coverage-reports command assumes that the Diffblue tests are named following the
*DiffblueTests.java 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.
jacoco.xml, please follow these instructions.
dcover.json, please follow these instructions.
Using a config file
For both commands, you can use a config file to specify arguments which are often the same. For example a
config.txt file like the one below:
--coverage-reports --report http://reports.internal.customer.com:8080/ --project customer-markets.trading.name.name --name "Branch: 1234/feature-TG12345"
can be used with the command:
dcover create @config.txt. See CLI commands for more.
As well as this, parameters can be specified in the files:
.diffblue/create.args. These parameters will always be picked up and used when running the
dcover upload and
dcover create commands respectively.
Creating 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 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.
Viewing your reports
Once you have uploaded your first report, you can see all reports listed by clicking on this icon on the left menu:
By default, the Cover Reports database is stored in the following locations:
To change the location of the database, use the following command:
Please ensure you regularly back up the relevant folder(s)
Working with projects and reports
Your reports are contained within projects, and projects themselves can contain other projects.
If you want to move your report between projects, rename your report, or rename your project, click on the three dots to the right of the project or report name, and select Move. You will then be prompted to enter the new name or location. The example below shows moving a report between projects:
You can also use the Delete option on the same menu to delete the project or report.
Some organisations prefer to use Cover Reports within a wrapper which duplicates the navigation functionality. For this scenario, we suggest:
- Turning off the side navigation panel, using the command
- Turning off the manual
Uploadbutton, using the command