kotest-core / io.kotest.core.listeners / TestListener

TestListener

interface TestListener : Listener

Functions

afterInvocation

Invoked after each 'run' of a test, with a flag indicating the iteration number. This callback is useful if you have set a test to have multiple invocations via config and want to do some setup / teardown between runs.

open suspend fun afterInvocation(testCase: TestCase, iteration: Int): Unit

afterSpec

Is invoked after the TestCases that are part of a particular Spec instance have completed.

open suspend fun afterSpec(spec: Spec): Unit

afterTest

This callback is invoked after a TestCase has finished.

open suspend fun afterTest(testCase: TestCase, result: TestResult): Unit

beforeInvocation

Invoked before each 'run' of a test, with a flag indicating the iteration number. This callback is useful if you have set a test to have multiple invocations via config and want to do some setup / teardown between runs.

open suspend fun beforeInvocation(testCase: TestCase, iteration: Int): Unit

beforeSpec

This callback is invoked after the Engine instantiates a Spec to be used as part of a TestCase execution.

open suspend fun beforeSpec(spec: Spec): Unit

beforeTest

This callback will be invoked before a TestCase is executed.

open suspend fun beforeTest(testCase: TestCase): Unit

finalizeSpec

Called once per Spec, after all tests have completed for that spec.

open suspend fun finalizeSpec(kclass: KClass<out Spec>, results: Map<TestCase, TestResult>): Unit

prepareSpec

Called once per Spec, when the engine is preparing to execute the tests for that spec.

open suspend fun prepareSpec(kclass: KClass<out Spec>): Unit