https://kotlinlang.org logo
#kotest
Title
# kotest
s

Sourabh Rawat

06/09/2021, 5:58 AM
How to generate a single report file for a multi module gradle project?
s

sam

06/09/2021, 6:26 AM
Reports are generated via the standard gradle/junit mechanisms, so whatever works for that, will work for kotest
e

Emil Kantis

06/09/2021, 7:11 AM
I remember that was quite hard to find an answer to when searching, and examples from official gradle docs weren't working.. This is how I ended up doing, perhaps it can be improved, let me know..
Copy code
val testReport = tasks.register<TestReport>("testReport") {
    destinationDir = file("$buildDir/reports/tests/test")
    reportOn(subprojects.flatMap { it.tasks.withType<Test>().map { it.binaryResultsDirectory.get() } })
}

subprojects {
    tasks.withType<Test> {
        finalizedBy(testReport)
        useJUnitPlatform()
        reports.junitXml.isEnabled = false
        reports.html.isEnabled = false
    }
}
(above goes in root
build.gradle.kts
)
s

Sourabh Rawat

06/11/2021, 6:08 AM
I tried above approach, but when I was running tests for moduleA only, it was trying to run tests for moduleB also (moduleA depends on moduleB) I dont think I did any config wrong, but ill recheck it again when I get time
35 Views