OnlyIf

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

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

Ignore a test or suite.

Conditionally ignore a test or suite.