Spek: Spek is crashing when running any test displaying wrong test results

Created on 8 May 2019  路  4Comments  路  Source: spekframework/spek

AS 3.4
Spek version: 2.0.4
Spek gradle plugin version: v2.0.4-Studio3.4

Can't run tests because of errors:

Exception in thread "main" java.lang.NoClassDefFoundError: kotlinx/coroutines/CoroutineScope
    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:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.spekframework.spek2.runtime.SpekRuntime.execute(SpekRuntime.kt:34)
    at org.spekframework.ide.Spek2ConsoleLauncher.run(console.kt:24)
    at org.spekframework.ide.ConsoleKt$main$1.invoke(console.kt:35)
    at org.spekframework.ide.ConsoleKt$main$1.invoke(console.kt)
    at shadow.com.xenomachina.argparser.SystemExitExceptionKt.mainBody(SystemExitException.kt:74)
    at shadow.com.xenomachina.argparser.SystemExitExceptionKt.mainBody$default(SystemExitException.kt:72)
    at org.spekframework.ide.ConsoleKt.main(console.kt:33)
Caused by: java.lang.ClassNotFoundException: kotlinx.coroutines.CoroutineScope
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

or

Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/streams/jdk8/StreamsKt
    at org.spekframework.spek2.runtime.JvmDiscoveryContextFactory.scanClasses(JvmDiscoveryContextFactory.kt:58)
    at org.spekframework.spek2.runtime.JvmDiscoveryContextFactory.create(JvmDiscoveryContextFactory.kt:23)
    at org.spekframework.ide.Spek2ConsoleLauncher.run(console.kt:17)
    at org.spekframework.ide.ConsoleKt$main$1.invoke(console.kt:35)
    at org.spekframework.ide.ConsoleKt$main$1.invoke(console.kt)
    at shadow.com.xenomachina.argparser.SystemExitExceptionKt.mainBody(SystemExitException.kt:74)
    at shadow.com.xenomachina.argparser.SystemExitExceptionKt.mainBody$default(SystemExitException.kt:72)
    at org.spekframework.ide.ConsoleKt.main(console.kt:33)
Caused by: java.lang.ClassNotFoundException: kotlin.streams.jdk8.StreamsKt
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 8 more

whereas results are green:
Screenshot from 2019-05-08 16-51-26

test project:
https://github.com/yaroslav-shlapak/TestSpekProject

Most helpful comment

@yaroslav-shlapak I've pulled in your project and it is working for me. I had to make one tweak: use kotlin-stdlib-jdk8.

All 4 comments

It be might somehow related to the plugin version inconsistency on the web:
Screenshot from 2019-05-08 17-00-22
but in the IJ IDE marketplace it is available:
Screenshot from 2019-05-08 17-00-31

Thanks for the report! I鈥檒l check it out. What JDK version are you using?

@yaroslav-shlapak I've pulled in your project and it is working for me. I had to make one tweak: use kotlin-stdlib-jdk8.

Thanks Ranie!

The first excepetion (from the project which does have kotlin-stdlib-jdk8) is fixed by uninstalling and installing the newest version of the gradle plugin from the marketplace - though the versions are the same, the old one didn't work.
The second exception (from the test project) is fixed by https://github.com/yaroslav-shlapak/TestSpekProject/commit/76f9a1bfc7778eba87f2742409f3c05f8a011223

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fabiocarballo picture fabiocarballo  路  3Comments

robstoll picture robstoll  路  7Comments

ddubson picture ddubson  路  7Comments

SalomonBrys picture SalomonBrys  路  8Comments

raosuj picture raosuj  路  3Comments