Gavin Ray
08/17/2021, 5:56 PM.jar
files.
• JUnit5 has the ConsoleLauncher
under junit-platform-console-standalone
• Kotest has KotestEngineLauncher
under io.kotest.engine.launcher.MainKt
• I think other frameworks also have standalone .jar
launchers which can discover and run + report tests, given some set of CLI args
My question is around how exactly the Kotest one works/how to use it. I wasn't able to find very much documentation on it -- only by digging through code:
data class LauncherArgs(
// A path to the test to execute. Nested tests will also be executed
val testpath: String?,
// restricts tests to the package or subpackages
val packageName: String?,
// the fully qualified name of the spec class which contains the test to execute
val spec: String?,
// true to force true colour on the terminal; auto to have autodefault
val termcolor: String?,
// the fully qualified name of a reporter implementation
val reporter: String?,
// Tag expression to control which tests are executed
val tagExpression: String?,
// true to output the configuration values when the Engine is created
val dumpconfig: Boolean?
)
Is there a guide anywhere on how someone interested in make a process-based wrapper for Kotest would go about it?
And perhaps a bit unrelated, is this even a good idea?sam
08/17/2021, 7:12 PMGavin Ray
08/17/2021, 8:38 PM$ java -jar kotest-runner-junit5-jvm-4.6.1.jar
no main manifest attribute, in kotest-runner-junit5-jvm-4.6.1.jar
$ java --module kotest-framework-launcher-4.2.0.module/io.kotest.engine.launcher.MainKt
Error occurred during initialization of boot layer
java.lang.module.FindException: Module kotest-framework-launcher-4.2.0.module not found
sam
08/17/2021, 8:39 PMsam
08/17/2021, 8:39 PMsam
08/17/2021, 8:39 PMGavin Ray
08/17/2021, 8:46 PM.jar
and passing argsGavin Ray
08/17/2021, 8:47 PMjava -jar
to tell it to run a specific class/method maybesam
08/17/2021, 8:47 PMGavin Ray
08/17/2021, 8:47 PM// <https://github.com/kotest/kotest-gradle-plugin/blob/2301c432a3b320c8683fe28972aa68c57f31ce66/src/main/kotlin/io/kotest/gradle/Kotest.kt>
//
private fun exec(classpath: FileCollection): JavaExecAction {
val exec = DefaultExecActionFactory.of(fileResolver, fileCollectionFactory, executorFactory, null).newJavaExecAction()
copyTo(exec)
exec.main = "io.kotest.engine.launcher.MainKt"
exec.classpath = classpath
exec.jvmArgs = allJvmArgs
exec.args = args()
// this must be true so we can handle the failure ourselves by throwing GradleException
// otherwise we get a nasty stack trace from gradle
exec.isIgnoreExitValue = true
return exec
}
Gavin Ray
08/17/2021, 8:48 PMsam
08/17/2021, 8:48 PMkotest-framework-engine-launcher
module that just calls the launcher from a main methodsam
08/17/2021, 8:48 PMGavin Ray
08/17/2021, 9:00 PM$ java -cp ./kotest/kotest-framework-engine-jvm-4.6.1.jar io.kotest.engine.launcher.MainKt -h
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at io.kotest.engine.launcher.MainKt.main(main.kt)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
... 1 more
Gavin Ray
08/17/2021, 9:01 PM.module
file that comes with it also describes the required dependencies right?sam
08/17/2021, 9:01 PMsam
08/17/2021, 9:01 PMsam
08/17/2021, 9:02 PMGavin Ray
08/17/2021, 9:02 PMGavin Ray
08/17/2021, 9:03 PMsam
08/17/2021, 9:03 PMsam
08/17/2021, 9:03 PMsam
08/17/2021, 9:03 PMsam
08/17/2021, 9:03 PMsam
08/17/2021, 9:03 PMGavin Ray
08/17/2021, 9:07 PM