Skip to content

Suiteopensavvy.prepared.suite.configOnlyIf

OnlyIf

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

Executes this test or ensuite suite only if predicate returns true.

Conceptually, this is the opposite of Ignored.If.

Example

Only execute a suite if a JVM property is enabled:

suite("Suite name", OnlyIf { System.getProperty("foo") != null }) {
    // …
}

Only execute a test if a JVM property is enabled:

test("Some kind of test", OnlyIf { System.getProperty("foo") != null }) {
    // …
}

See also