Getting Started with Cover CLI for Linux / macOS

TeamsEnterprise

See here for the full prerequisites for Cover CLI.

1. Download and install Cover CLI

Download the Diffblue Cover CLI zip file to your installation directory. The download link can be obtained from:

  • Your Diffblue Cover welcome email received following trial signup or following license purchase
  • Your organization’s internal file/app store
  • Or contact Diffblue Support for help finding your download link

Unzip the Diffblue Cover CLI zip file to an appropriate installation location, e.g. ~/bin and add this location to the PATH environment variable using the following example commands:

mkdir ~/bin
cd ~/bin
unzip ~/diffblue-cover*.zip
cd
export PATH=$PATH:~/bin

Reminder: Ensure that the environment variable PATH is set permanently according to your operating system instructions.

2a. Activate license online using license key only

TeamsEnterprise (Online)

Using the license key provided in your welcome email or provided by your organization, activate your license using the command dcover activate XXXX-XXXX-XXXX-XXXX.

For help troubleshooting network connection and proxy server settings check out our online licensing guide.

Diffblue Cover requires a remote license check with the Diffblue licensing server each time it is used. Offline license activation is available with the Enterprise Edition offline option only.

Entering multiple different license keys will overwrite the existing key.

You can check your license status by running the command dcover license

2b. Activate license offline using license key and offline license file

Enterprise (Offline)

If your organization has provided you with a license key and an offline license activation file, please follow the Enterprise Edition Offline Licensing instructions to activate.

3. Writing and running your first tests

We’re going to write some tests for Spring Petclinic, the legendary Spring demonstration application! Firstly, get Spring PetClinic by cloning the repository using git:

git clone https://github.com/diffblue/demo-spring-petclinic.git

Cover works by analyzing compiled Java code, so you must compile the project first:

cd demo-spring-petclinic
./mvnw package

To create your first tests for the owner package:

dcover create org.springframework.samples.petclinic.owner

Now you can run the tests written by Diffblue Cover CLI :

./mvnw test -Dtest=*DiffblueTest.java

Take a look at the tests for the Owner Controller, either in the console or in the IDE of your choice:

less src/test/java/org/springframework/samples/petclinic/owner
/OwnerControllerDiffblueTest.java

4. Next steps

Please check out our documentation for more guides, videos and information, in particular our User Manual.