@ExperimentalTime class InstancePerTestSpecRunner : SpecRunner
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
<init> |
Implementation of SpecRunner that executes each TestCase in a fresh instance of the Spec class. InstancePerTestSpecRunner(listener: TestEngineListener) |
execute |
The intention of this runner is that each TestCase executes in it's own instance of the containing Spec class. Therefore, when we begin executing a test case from the queue, we must first instantiate a new spec, and begin execution on that instance. suspend fun execute(spec: Spec): Try<Map<TestCase, TestResult>> |