Test runner not including resources on classpath

#1

My automated tests fail when I run them from IntelliJ because they don’t have their resources on the classpath. This is a multiplatform project created by IntelliJ so I’m wondering if this is a bug or if there is something I can configure.

When I run the test (by clicking a green arrow in the test source code), the output panel shows the java command used along with the classpath. The main Java class is com.intellij.rt.execution.junit.JUnitStarter. The classpath is long, mostly dependencies, but I see:

/[...]/MyProject/build/classes/kotlin/jvm/test
/[...]/MyProject/build/classes/kotlin/jvm/main

Those folders contain only class files.

When IntelliJ created this multiplatform project, it created 6 modules. The jvmMain module has a resources folder. Shouldn’t those resources be included in the classpath for the test runner? Is there a way to make that happen?

If I go to terminal and run through gradle, it works, but I’d prefer to run through the IDE if I can.

gradle jvmTest --tests FooTests.checkThingy

#2

I have this issue too. I think it is a known bug. Probably it either is, or is related to: https://youtrack.jetbrains.com/issue/KT-24463. Check that it works correctly when running gradle.