kotest-core / io.kotest.core.runtime / TestExecutor

TestExecutor

class TestExecutor

Executes a single TestCase. Uses a TestExecutionListener to notify callers of events in the test.

The TimeoutExecutionContext is used to provide a way of executing functions on the underlying platform in a way that best utilizes threads or the lack of on that platform.

The validateTestCase function is invoked before a test is executed to ensure that the test case is compatible on the actual platform. For example, in JS we can only support certain spec styles due to limitations in the underlying test runners.

If the given test case is invalid, then this method should throw an exception.

Constructors

<init>

Executes a single TestCase. Uses a TestExecutionListener to notify callers of events in the test.

TestExecutor(listener: TestExecutionListener, executionContext: TimeoutExecutionContext, validateTestCase: (TestCase) -> Unit = {})

Functions

execute

suspend fun execute(testCase: TestCase, context: TestContext): TestResult