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

prepareSpec

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

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

Regardless of how many times the spec is instantiated, for example, if InstancePerTest or InstancePerLeaf isolation modes are used, this callback will only be invoked once, with the first instance of the Spec.

The top level tests declared in the spec are supplied as a list of instances of RootTest which includes a flag set to true if the test is active or false if inactive.

If there are no active tests in a spec, then this callback will still be invoked.

The order of the list of tests is the same as the order of execution.

Parameters

kclass - the Spec class

tests - the list of top level tests