I am learning to use junit5. I followed the tutorial to write some dynamic tests and then run them using gradle. But the test report output by gradle by default is not good enough for me, it does not contain nested test container structure. Is there any alternative that can output a better-formed test report when running dynamic tests? Similar to the intellij idea test report. the code:
@TestFactory
Stream<DynamicNode> dynamicTestsWithContainers() {
return Stream.of("A", "B", "C")
.map({ input ->
dynamicContainer("Container " + input, Stream.of(
dynamicTest("not null", { -> assertNotNull(input) }) as DynamicNode,
dynamicContainer("properties", Stream.of(
dynamicTest("length > 0", { -> assertTrue(input.length() > 0) }),
dynamicTest("not empty", { -> assertFalse(input.isEmpty()) })
))
))
})
}
run with gradle:
run with intellij idea: