fail

Common
JVM
JS
Native
1.0
fun fail(message: String? = null): Nothing
(source)

Marks a test as having failed if this point in the execution path is reached, with an optional message.

Common
JVM
JS
Native
1.4
fun fail(
    message: String? = null,
    cause: Throwable? = null
): Nothing

(source)

Marks a test as having failed if this point in the execution path is reached, with an optional message and cause exception.

The cause exception is set as the root cause of the test failure.