Cover CLI Usage
To execute the Cover CLI, the following scripts are available:
These should be run in the root of a single-module project or within a module in a multi-module project.
./dcover.bat create com.acme.MyClass --test-output-dir=project/src/test/java -cp project/target/classes
./dcover create com.acme.MyClass --test-output-dir=project/src/test/java -cp project/target/classes
All invocations of
dcover take a single subcommand called
create to generate the tests.
dcover create com.a
Will produce tests for all accessible functions within package
com.a (but none for any classes in
These additional optional arguments can also be provided:
--classpath or -cp
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:
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
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
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.