Cover CLI Usage

Scripts

To execute the Cover CLI, the following scripts are available:

  • dcover.bat (Windows)
  • dcover (Linux/OS)

These should be run in the root of a single-module project or within a module in a multi-module project.

Windows

Example:

./dcover.bat create com.acme.MyClass --test-output-dir=project/src/test/java -cp project/target/classes

Linux/OSX

Example:

./dcover create com.acme.MyClass --test-output-dir=project/src/test/java -cp project/target/classes

Commands

All invocations of dcover take a single subcommand called create to generate the tests.

create

Example:

dcover create com.a

Will produce tests for all accessible functions within package com.a (but none for any classes in com.b)

These additional optional arguments can also be provided:

--classpath or -cp

Example:

-cp target/classes/

Provide the classpath(s) of the project you want to generate tests for. Multiple paths can be specified using : as separators for Linux/OSX and ; for Windows. jar files can also be added to the classpath as below:

-cp target/classes:target/java-demo-1.0.0-jar-with-dependencies.jar

Please note that on Windows the classpath argument -cp must be wrapped in double quotes

If no classpath is provided, one will be inferred. For Maven projects, this will be the project build directory plus dependencies. For other projects, including Gradle, this will be the classpath environment variable ($CLASSPATH), if it is set, or '.' (current directory) if the environment variable is not set.

--test-output-dir or -d

Example:

--test-output-dir=src/test/java

Location for the generated tests relative to the current directory. Provide the relative path for the directory where generated tests should be placed.

--existing-coverage or -e

Example:

--existing-coverage=target/jacoco.exec

Takes a path to a JaCoCo coverage report ("target/jacoco.exec" here) as an argument, so that dcover will write tests only for those lines of code which are not already covered by existing tests.

results matching ""

    No results matching ""