@John Herrlin hmm did the test run but it just didn’t output anything? can you add this
object TestPrinterListener : TestListener {
/**
* Resolves the test name together with all the contexts, separated by "-"
*
* context - when something - when another - should do xyz
*/
private tailrec fun resolveTestName(
current: TestCase,
separator: String = " - ",
acc: String = ""
): String {
val name = if (acc.isEmpty()) current.name.testName else "${current.name.testName}$separator$acc"
return when (val parent = current.parent) {
null -> name
else -> resolveTestName(parent, separator, name)
}
}
override suspend fun finalizeSpec(kclass: KClass<out Spec>, results: Map<TestCase, TestResult>) {
val testCases = results.filter { it.key.type == TestType.Test }
println(
listOf(
"~~~ ${kclass.simpleName} ~~~",
*testCases
.map { (testCase, result) -> " + ${resolveTestName(testCase)}: TestResult=$result" }
.toTypedArray()
).joinToString("\n", "\n")
)
}
}
and then register it in your `ProjectConfig`:
class ProjectConfig : AbstractProjectConfig() {
override fun extensions(): List<Extension> = listOf(
TestPrinterListener,
// SpringAutowireConstructorExtension,
// JunitXmlReporter(includeContainers = false, useTestPathAsName = true),
// ...
)
}