Getting Started with Cover CLI for Linux / macOS
- 1. Download Cover CLI
- 2. Prerequisites
- 3. Installing Cover CLI
- 4. Writing your first tests
- 5. Next steps
1. Download Cover CLI
If you do not already have a copy of Cover CLI, please download a trial copy.
Cover runs on Linux (RedHat and Debian) and macOS. We recommend Oracle or OpenJDK installations.
You will also need to have installed the common Java build systems, Maven and/or Gradle.
See here for the full prerequisites for Cover CLI.
3. Installing Cover CLI
Please note that these are the instructions for installing Cover CLI on Linux or macOS. Instructions for installation on Windows are here.
- Download the Zip file of Cover to your home directory (or your chosen location)
- Enter the following commands:
mkdir ~/bin cd ~/bin unzip ~/diffblue-cover*.zip cd export PATH=$PATH:~/bin
Activate your license using the command
dcover activate XXXX-XXXX-XXXX-XXXX
Finally, run the command
dcover help to verify the installed version.
4. Writing your first tests
We’re going to use Spring Project’s example application, PetClinic, and write some tests! Firstly, install PetClinic:
git clone https://github.com/diffblue/demo-spring-petclinic.git
Cover only works on compiled Java code, so you must compile any project where you want to use it:
cd demo-spring-petclinic ./mvnw package
To create your first tests for the Owner package:
dcover create org.springframework.samples.petclinic.owner
Let’s look at the tests for the Owner Controller:
less src/test/java/org/springframework/samples/petclinic/owner /OwnerControllerDiffblueTest.java
5. Next steps
Please check out our documentation for more guides, videos and information, in particular our User Manual.