Knowledge Base > IntelliJ Plugin > Test naming

Test naming

The Diffblue Cover plugin for IntelliJ allows you to define the naming system used for tests generated by Diffblue Cover. To do this, under File -> Settings (Windows/Linux) or IntelliJ IDEA -> Preferences (macOS), select Tools -> Diffblue Cover -> Generation -> Test Naming.

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

Please note that any exact duplicate tests written will be automatically discarded by Diffblue Cover.

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 {
    ...
}