Test Formatting
Last updated
Last updated
To configure the format of tests written by Cover Plugin, go to Diffblue > Change Settings > Test Formatting
in IntelliJ.
It's important to note that the formatting of tests produced by Cover Plugin for IntelliJ, especially regarding indentation and other style settings, is in line with your current IntelliJ Code Style configurations. This ensures that the generated tests adhere to the code style settings you've set up in your IDE. If you experience formatting conflicts with other tools, such as Spotless, you might need to align your IntelliJ code style settings with those tools to maintain consistency.
You are able to turn off IntelliJ Code Style formatting through the Diffblue settings menu "Apply code style formatting". With this setting turned off tests will be formatted in a way that will match the output of Cover CLI.
Select your preferred Test Style
from the drop-down menu ( Brief
, Standard
, Verbose
, or Custom
). Selecting Brief
, Standard
, or Verbose
will configure preset settings for the individual formatting options. The Custom
style allows you to configure the options as you wish.
Brief Test Style
Using this style, Diffblue Cover will create tests in a more condensed format - the contents of the Arrange
and Act
sections are inlined into the Assert
section, for example:
Using this style provides a compromise between the Brief and Verbose styles. The Arrange
, Act
, and Assert
sections will be labelled, but may still be combined together by inlining if they're small, for example:
Using this style, Cover Plugin creates tests containing up to three commented sections - Arrange
, Act
, and Assert
. For example:
Selecting the Custom
style allows you to configure the formatting options as you wish. Also note that changing any of the default options for Brief
, Standard
, or Verbose
will automatically change the Test Style
to Custom
.