JCover options



General options

If you use the command jcover without any options, tests will be generated for all classes in the current project/module. To refine your test creation, use the commands as below:

To change the names of created test classes:

--class-suffix suffix

This will rename the default ClassnameTest to ClassnameSuffix.


To switch off the creation of tests for trivial constructors, getters and setters:

--no-factory-tests


To compile and run the tests after creation (only those which pass will be kept).

--test-verification

This needs to be combined with --gradle or --maven options.


To increase the level of diagnostic output to the screen:

--verbose


To show the JCover version:

--version


Java Bytecode frontend options:

To disable the security manager:

--no-security-manager


To test private methods using reflection:

--private-methods


Code generation options:

To choose the directory to which generated tests will be saved:

-d directory


To test exceptions:

--exceptions


To set the indent width:

--indent x


To set the Java version between 6 and 14 (the default is 8):

--java version


To disable the comments which are normally inserted into the created tests:

--no-arrange-act-assert


To use the keyword final:

--use-final

This applies the keyword final to all objects and variables created in the tests, so that they cannot be modified (i.e. these objects and variables effectively become constants).


To use Lombok's 'val' type:

--use-lombok-val


To use the keyword var:

--use-var

This means that all objects created in the tests will be designated as a variable, instead of their original type.


Code formatting options:

To apply the aosp format:

--aosp-format


To apply clang-format:

--clang-format


To apply google-java-format:

--google-format


To apply the Spring Java format:

--spring-format

results matching ""

    No results matching ""