The @DisableIfDisplayName annotation can be used to selectively disable parameterized tests based on their display names, which are dynamically registered on runtime. The annotation is only supported on test method level for parameterized tests. Unlike the @Disabled API provided in JUnit Jupiter, which disables the test on first encounter of the annotation , @DisableIfDisplayName is validated before each parameterized test execution. As a consequence, instead of disabling the entire set of parameterized tests, each test (name) can be evaluated and possibly disabled individually.

// disable invocations whose display name contains "disable"
@DisableIfDisplayName(contains = "disable")
@ParameterizedTest(name = "See if enabled with {0}")
@ValueSource(
    // Disabled: 1,2,3,4,5
    // Not disabled: 6
    strings = {
        "disable who", // 1
        "you, disable you", // 2
        "why am I disabled", // 3
        "what has been disabled must stay disabled", // 4
        "fine disable me all you want", // 5
        "not those one, though!" // 6
    }
)
void testExecutionDisabled(String reason) {
    if (reason.contains("disable"))
        fail("Test should've been disabled " + reason);
}

You can also specify more than one substring at a time:

@DisableIfDisplayName(contains = {"1", "2"})
@ParameterizedTest(name = "See if enabled with {0}")
@ValueSource(ints = { 1, 2, 3, 4, 5 })
void testDisplayNameString(int num) {
    if (num == 1 || num == 2)
        fail("Test should've been disabled for " + num);
}

If substrings are not powerful enough, you can also use regular expressions:

// disable invocations whose display name
// contains "disable " or "disabled "
@DisableIfDisplayName(matches = ".*disabled?\\s.*")
@ParameterizedTest(name = "See if enabled with {0}")
@ValueSource(
    // Disabled: 1,2,4,5
    // Not disabled: 3,6
    strings = {
        "disable who", // 1
        "you, disable you", // 2
        "why am I disabled", // 3
        "what has been disabled must stay disabled", // 4
        "fine disable me all you want", // 5
        "not those one, though!" // 6
    }
)
void single(String reason) {
    // ...
}

You can even use both, in which case a test is disabled if contains a substring or matches an expression:

@DisableIfDisplayName(contains = "000", matches = ".*10?")
@ParameterizedTest(name = "See if enabled with {0}")
@ValueSource(ints = { 1, 10, 100, 1_000, 10_000 })
void containsAndMatches_containsAndMatches(int number) {
    if (number != 100)
        fail("Test should've been disabled for " + number);
}