hello. I have an existing module with a kotlin tes...
# kotlintest
a
hello. I have an existing module with a kotlin test suite written in junit4. After importing
kotlintest-runner-junit4 v.3.2.1
as dependency (without using or configuring it, just importing!), i'm getting the following exception when trying to run the test suite from intellij 2018.3.4/android studio3.3. Works 100% fine when running from gradle (im using gradle5). Works 100% fine when running individual test files from intellij/Android studio. I would like to migrate to kotlintest gradually in this project, so the plan was to have all new tests written in kotlintest and keep the existing ones in junit for a while. Is there a way to do this without compromising the possibility to run the test suite from intellij? i've seen a previous issue reported on this, but it has been closed: https://github.com/kotlintest/kotlintest/issues/385 so maybe i'm missing something. Thanks
Copy code
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/platform/launcher/TestExecutionListener
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at com.intellij.junit5.JUnit5IdeaTestRunner.createListeners(JUnit5IdeaTestRunner.java:39)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:45)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
l
If it's a Unit test, junit 5 will likely work. However, Instrumentation Tests must use JUnit 4 in Android
s
Oh is that right.