kotest-core / io.kotest.core.engine / InstancePerTestSpecRunner / <init>

<init>

InstancePerTestSpecRunner(listener: TestEngineListener)

Implementation of SpecRunner that executes each TestCase in a fresh instance of the Spec class.

This differs from the InstancePerLeafSpecRunner in that every single test, whether of type TestType.Test or TestType.Container, will be executed separately. Branch tests will ultimately be executed once as a standalone test, and also as part of the "path" to any nested tests.

So, given the following structure:

outerTest { innerTestA { // test } innerTestB { // test } }

Three spec instances will be created. The execution process will be:

spec1 = instantiate spec spec1.outerTest spec2 = instantiate spec spec2.outerTest spec2.innerTestA spec3 = instantiate spec spec3.outerTest spec3.innerTestB