Niko
12/17/2021, 8:06 AM./gradlew test
.
Currently, I have a root project with multiple subprojects (modules), and I'm applying some conventions (like applying Kotest) to all the subprojects using a Gradle plugin. I'm wondering, if this setup has somehow screwed up the discovery
(more in thread).gradle
and build
dirs, no effect
• Running ./gradlew dependencies
lists all Kotest deps correctly
This is the part in the plugin, that applies Kotest:
private fun initTesting(project: Project) = project.run {
<http://logger.info|logger.info>("Setting up testing for the project (kotest ${Versions.kotestVersion})")
tasks.withType<Test>() {
useJUnitPlatform()
}
// TODO: combine with above?
val test by tasks.getting(Test::class) {
// bootstrap Kotest system properties (-Dx=y) to enable targeting test tags
// via CLI: <https://kotest.io/docs/framework/tags.html>
systemProperties = System.getProperties()
.map { it.key.toString() to it.value }.toMap()
// TODO: once the build script moves forward from 1.4.31, migrate to
// .associate {}
}
dependencies {
add("testImplementation", Dependencies.kotestRunner)
add("testImplementation", Dependencies.kotestAssertionsCore)
}
}
sam
12/17/2021, 8:13 AMNiko
12/17/2021, 8:17 AMStringSpec
) > Run '<class>' Ctrl+Shift+F10 > IDEA shows the Run panel with which seems to be a Gradle run config, and not a Kotest one (I'm guessing the Gradle runner should delegate the test execution somehow to Kotest..?)sam
12/17/2021, 8:41 AMNiko
12/17/2021, 8:45 AMsam
12/17/2021, 8:46 AMNiko
12/17/2021, 8:47 AMsam
12/17/2021, 8:47 AMNiko
12/17/2021, 8:52 AMgradle clean test
in terminal will also run the tests in silence, and only report build failure if I make a test fail:
> Task :test
dev.niko.sc.LoadFactorsTest > all load factors detected FAILED
java.lang.AssertionError at LoadFactorsTest.kt:23
Caused by: java.lang.AssertionError at LoadFactorsTest.kt:23
19 tests completed, 1 failed
> Task :test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///.../sc/build/reports/tests/test/index.html
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 11s
26 actionable tasks: 5 executed, 21 up-to-date
I remember previously seeing a terminal output of the Kotest runner itself..?sam
12/17/2021, 8:53 AMtasks.named<Test>("test") {
useJUnitPlatform()
testLogging {
showExceptions = true
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL
}
}
Niko
12/17/2021, 8:57 AMtestLogging {}
, now the assertion errors are printed, but no other changes (it's a start).
Previously I remember running the class for tests would create a Kotest run config, and bring up the Kotest panel, and not the Gradle run config onesam
12/17/2021, 9:01 AMNiko
12/17/2021, 9:03 AMsam
12/17/2021, 9:05 AMNiko
12/17/2021, 9:06 AMsam
12/17/2021, 9:07 AMNiko
12/17/2021, 9:07 AMsam
12/17/2021, 9:09 AMNiko
12/17/2021, 9:10 AM