kotest-runner-junit5 / io.kotest.runner.junit.platform / JUnitTestEngineListener

JUnitTestEngineListener

class JUnitTestEngineListener : TestEngineListener

Notifies JUnit Platform of test statuses via a EngineExecutionListener.

JUnit platform supports out of order notification of tests, in that sibling tests can be executing in parallel and updating JUnit out of order. However the gradle test task gets confused if we are executing two or more tests directly under the root at once. Therefore we must queue up notifications until each spec is completed.

Gradle test run observations:

using Platform 1.6.0 -- TestDescriptor.Type.CONTAINER seem to be ignored in output. TestDescriptor.Type.CONTAINER_AND_TEST appear as siblings of their nested tests if not added as a child Add child first, then register dynamic test, then start the test

Top level descriptors must have a source attached or the execution will fail with a parent attached exception. Type.CONTAINER_TEST doesn't seem to work as a top level descriptor, it will hang leaf tests do not need to be completed but they will be marked as uncomplete in intellij. Dynamic test can be called after or before addChild. A Type.TEST can be a child of a Type.TEST. Intermediate Type.CONTAINER seem to be ignored in output. Intermediate containers can have same class source as parent. Type.TEST as top level seems to hang. A TEST doesn't seem to be able to have the same source as a parent, or hang. A TEST seems to hang if it has a ClassSource. MethodSource seems to be ok with a TEST. Container test names seem to be taken from a Source. Nested tests are outputted as siblings. Can complete executions out of order. Child failures will fail parent CONTAINER. Sibling containers can start and finish in parallel.

Intellij runner observations:

Intermediate Type.CONTAINERs are shown. Intermediate Type.TESTs are shown. A Type.TEST can be a child of a Type.TEST MethodSource seems to be ok with a TEST. Container test names seem to be taken from the name property. Nested tests are outputted as nested. Child failures will not fail containing TEST. child failures will fail a containing CONTAINER. Call addChild before registering test otherwise will appear in the display out of order. Must start tests after their parent or they can go missing. Sibling containers can start and finish in parallel.

Constructors

<init>

Notifies JUnit Platform of test statuses via a EngineExecutionListener.

JUnitTestEngineListener(listener: EngineExecutionListener, root: EngineDescriptor)

Properties

root

val root: EngineDescriptor

Functions

engineFinished

fun engineFinished(t: List<Throwable>): Unit

engineStarted

fun engineStarted(classes: List<KClass<out Spec>>): Unit

specFinished

fun specFinished(kclass: KClass<out Spec>, t: Throwable?, results: Map<TestCase, TestResult>): Unit

specInstantiationError

If the spec fails to be created, then there will be no tests, so we should insert an instantiation failed test so that the spec shows up.

fun specInstantiationError(kclass: KClass<out Spec>, t: Throwable): Unit

specStarted

fun specStarted(kclass: KClass<out Spec>): Unit

testFinished

fun testFinished(testCase: TestCase, result: TestResult): Unit

testIgnored

fun testIgnored(testCase: TestCase, reason: String?): Unit

testStarted

fun testStarted(testCase: TestCase): Unit