Getting Started with DCover CLI

1. Download DCover CLI

Please contact Diffblue to obtain a trial copy of DCover CLI.

2. Prerequisites

Cover runs on Windows (64-bit Java only), Linux (RedHat and Debian) and macOS. We recommend Oracle or OpenJVM installations.

You will also need to have installed the common Java build systems, Maven and/or Gradle.

See here for the full prerequisites for DCover CLI.

3. Installing DCover CLI

  1. Download the Zip file of DCover to your home directory
  2. Enter the following commands:
mkdir ~/bin
cd ~/bin
unzip ~/diffblue-cover*.zip
cd
export PATH=$PATH:~/bin

Finally, run the command dcover –help to verify the installed version.

4. Writing your first tests

We’re going to use Spring Java’s example application, PetClinic, and write some tests! Firstly, install PetClinic:

git clone https://github.com/spring-projects/spring-petclinic.git

DCover only works on compiled Java code, so you must compile any project where you want to use it:

cd spring-petclinic
./mvnw package

To create your first tests for the Owner class:

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
/OwnerControllerDiffblueTests.java

5. Next steps

Please check out the Knowledge Base for more guides, videos and information.