Getting Started with DCover CLI for Linux / macOS
- 1. Download DCover CLI
- 2. Prerequisites
- 3. Installing DCover CLI
- 4. Writing your first tests
- 5. Next steps
1. Download DCover CLI
Please contact Diffblue to obtain a trial copy of DCover CLI.
2. Prerequisites
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 DCover CLI.
3. Installing DCover CLI
Please note that these are the instructions for installing DCover CLI on Linux or macOS. Instructions for installation on Windows are here.
- Download the Zip file of DCover 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
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
DCover 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 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
/OwnerControllerDiffblueTest.java
5. Next steps
Please check out the Knowledge Base for more guides, videos and information.