Test Naming

The Diffblue Cover IntelliJ IDEA plugin allows you to define the naming system used for tests generated by Diffblue Cover.

Tools -> Diffblue Cover -> Generation -> Test Naming

which can be found under File -> Settings (Windows/Linux) or IntelliJ IDEA -> Preferences (macOS).

You can define the test names using string literals and replacements.

Available replacements for test classes:

  • ${CLASS_NAME}

For example: ${CLASS_NAME}Test

public class UserAcessTest {

    public String currentUser; 

    ...
}

Available replacements for inner classes (If there's no inner class this will be an empty string):

  • ${INNER_CLASS_NAME}

For example: test${METHOD_NAME}${INNER_CLASS_NAME}

@Test
public void testAppendTitleInner() {
    ...
}

Available replacements for test methods:

  • ${METHOD_NAME}

For example: test${METHOD_NAME}

@Test
public void testAppendTitle() {
    // Arrange
    TooltipBuilder tooltipBuilder = new TooltipBuilder();

    // Act
    TooltipBuilder actual = tooltipBuilder.appendTitle("Foo title");

    // Assert
    assertNotNull(actual.toString());
    assertSame(actual, tooltipBuilder);
}

Disambiguation between tests of the same name will be done automatically using sequential numbering:

@Test
public class testAppendTitle {
    ...
}

@Test
public class testAppendTitle2 {
    ...
}

results matching ""

    No results matching ""