Skip to content

Suiteopensavvy.prepared.suite.configIgnoredIf

If

inline fun If(predicate: () -> Boolean): TestConfig

Marks this test or an entire suite as disabled if predicate returns true.

If predicate returns false, does nothing.

Example

Mark a suite as disabled:

suite("Suite name", Ignored.If { true }) {
    // …
}

Mark a test as disabled:

test("Some kind of test", Ignored.If { true }) {
    // …
}

Use-case

Conceptually, marking a test as ignored:

test("Some kind of test", Ignored.If { someCondition }) {
    // …
}

is similar to not declaring the test at all:

if (!someCondition) {
    test("Some kind of test") {
        // …
    }
}

However, some test runners (e.g., TestBalloon) crash when a suite is declared that contains no tests at all.

See also