Configuring Diffblue Cover

Diffblue Cover can be configured via a settings file, in json or yaml format, which can be provided when starting an analysis. For more details of some of the options that can be set see Analysis parameters

Example configuration file (yaml)

timeout: 500
skipVerification: true
useFuzzer: true
entryPointsInclude: [
  "com.diffblue.javademo.Search",
  "com.diffblue.javademo.TicTacToe",
  "com.diffblue.javademo.UserAccess"
]
entryPointsExclude: []

Configuration options

The following is a list of options that you can use to get specific behavior from Diffblue Cover.

timeout

This option controls how long Diffblue Cover will wait for results in an analysis phase.

Usage

Decrease the timeout value to get results more quickly, but this might reduce the number of tests Diffblue Cover is able to create, and therefore how much coverage you get.

skipVerification

This option (when set to true) prevents the tests written by Diffblue Cover from being automatically verified. Test verification is a process which checks that tests compile and run successfully.

Usage

Saves time if you are in a hurry.

It's possible that not all created tests will be correct. Normally, Diffblue Cover will attempt to compile and run the tests it has written in order to verify that they work as expected. Only the verified tests will then be displayed.

useFuzzer

This option instructs Diffblue Cover to use fuzz testing as an additional analysis method for test generation.

Usage

Diffblue Cover can use a fuzzer to generate tests. Tests produced by the fuzzer tend to have a shorter Arrange section (using the simplest constructors available), they rarely mock anything, and they occasionally use reflection (only in the Assert section of the test). Also, the fuzzer is more likely to produce tests than the default (CBMC) engine if the unit under test is large (large methods, many dependencies, deep nested calls, etc.). Currently (October 2019), tests produced by the fuzzer may yield coverage which overlaps with that provided by tests produced by the default engine.

Fuzzer-generated tests are labelled with the tag Fuzzer.

entryPointsInclude

This option will instruct Diffblue Cover to only analyze the specified functions

Usage

The option is set using an array of strings that are prefixes of full function names, including signature suffix (without java::). Tests are only written for functions that match one of the entryPointsInclude prefixes (AND none of the entryPointsExclude prefixes, see below). An empty entryPointsInclude array means 'include all'.

entryPointsExclude

This option will instruct Diffblue Cover to skip analyzing the specified functions

Usage

The option is set using an array of strings that are prefixes of full function names, including signature suffix (without java::). Tests are not written for functions that match one of the entryPointsExclude prefixes. An empty entryPointsExclude array means 'exclude nothing'.

results matching ""

    No results matching ""