Getting Started with Cover CLI for Windows

1. Download Cover CLI

If you do not already have a copy of Cover CLI, please download a trial copy.

2. Prerequisites

Cover runs on Windows (64-bit Java only). 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 Windows. Instructions for installation on Linux / macOS are here.

Please follow either section 3a or 3b, depending on your installation preference.

3a. Installing from .exe installer

Cover CLI can be installed manually using a setup wizard, or from the command line intended for unattended automated installations.

Setup wizard

1. Double-click the executable installer file.

2. Confirm any User Account Control prompt asking permission for the installer to make changes on your device.

3. Click I accept the terms of this license agreement and Next.

4. Select the directory where you would like to install Cover and click Next.

5. Confirm the creation of a new directory or overwriting an existing installation, if applicable.

6. After the installation progress is marked as completed, click Next.

7. Click Generate an automatic installation script if you would like to save your settings for future installations.

7. Click Done.

Unattended installation

1. Create an installation configuration containing the path to your desired installation location as illustrated below:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<AutomatedInstallation langpack="eng">
    <com.izforge.izpack.panels.licence.LicencePanel id="panel.licence"/>
    <com.izforge.izpack.panels.target.TargetPanel id="TargetPanel_1">
        <installpath>C:\Program Files\Diffblue</installpath>
    </com.izforge.izpack.panels.target.TargetPanel>
    <com.izforge.izpack.panels.install.InstallPanel id="InstallPanel_2"/>
    <com.izforge.izpack.panels.finish.FinishPanel id="FinishPanel_3"/>
</AutomatedInstallation>

This file can also be generated by clicking Generate an automatic installation script after manually installing Cover.

2. Install Cover using the following command:

dcover-installer-<version>.exe path/to/your/file.xml

3b. Installing from .zip file

Download the Zip file of Cover to your home directory (or your chosen location):

4. Activate your license

To activate your license, use the command dcover activate XXXX-XXXX-XXXX-XXXX

5. Writing your first tests

We’re going to use Spring Project’s example application, PetClinic, and write some tests!

1. Firstly, clone PetClinic:

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

(If you are unable to clone using git you are able to download a zip for this repo as shown below:

You can then extract this zip to where you store projects on your computer.)

2. Navigate to the location of the project you just cloned.

3. The project now needs to be compiled which can be done using the command mvnw package. (This can take a couple of minutes on a new machine). When this has finished, you will see the message BUILD SUCCESS.

4. Next, you can either:

  • Write tests for the owner class (org.springframework.samples.petclinic.owner):
C:\Diffblue\dcover.bat create org.springframework.samples.petclinic.owner
  • Or, write tests for the whole project:
C:\Diffblue\dcover.bat create

5. Run the tests (and the users tests):

 mvnw test

6. Finally, run just the newly created Diffblue tests using the command:

mvnw test -Dtest=*DiffblueTest.java

The tests can also be inspected in an IDE of your choice.

6. Next steps

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