I’m trying to set up a `jvmIntegrationTest` source...
# multiplatform
y
I’m trying to set up a
jvmIntegrationTest
sourceset. It all works in gradle, but Android Studio isn’t able to launch tests when clicking the Run button on the gutter.
Untitled.kt
Using the Run button on a test in the
jvmIntegrationTest
sourceset seems to trigger a run using the JUnit plugin, notice the ◀️▶️ symbol on the left of
JunitWorksIntegrationTest.kt
instead of the usual Gradle symbol. The contents of the test is just
Copy code
class JunitWorksIntegrationTest {
  @Test
  fun junitTest() {
    throw Exception("boom")
  }
}
Running it gets me error like this:
Copy code
Cannot locate tasks that match ':shared:impl:compileJava' as task 'compileJava' is ambiguous in project ':shared:state-machine:data:impl'. Candidates are: 'compileDebugAndroidTestJavaWithJavac', 'compileDebugJavaWithJavac', 'compileDebugUnitTestJavaWithJavac', 'compileReleaseJavaWithJavac', 'compileReleaseUnitTestJavaWithJavac'.
Meanwhile, a test in the
jvmTest
package, like
JunitWorksTest
above, gets kicked off properly with what I assume to be the gradle plugin given the little elephant symbol, and instead runs
Copy code
:shared:impl:cleanJvmTest :shared:impl:jvmTest --tests "com.example.TestJunitWorks"
Running the integration test manually with
gradle :shared:impl:jvmIntegrationTest --tests "com.example.JunitWorksIntegrationTest"
either via the CLI or by manually creating a gradle configuration works just fine. I’m guessing it’s something with Idea not liking how the source set, compilation, or test task is configured and isn’t recognizing it as a KMP Gradle test. I’m at a loss at what to do though. Anyone got ideas?
For now, I only need to get these integration tests running against the JVM target
y
i think my issue is a little different. I have buttons on the gutter. They just do the wrong thing 😞
e
I guess intellij is trying to use its platform runner then, and that isn't working
it doesn't have a way to associate that sourceset with that task
y
do you know how i can fix it? Or is it a bug in the kotlin gradle plugin?
e
afaics it's a missing feature in KTIJ (which might require design changes to the kotlin gradle plugin or elsewhere)
probably should file a youtrack issue
y
will do
huuuuh i was in Android Studio. Switched over to Intellij Community and running from the gutter actually works for
jvmIntegrationTest
Do you know if Intellij and AS use different kotlin plugins? They shouldn’t right?