spekframework / spek

A specification framework for Kotlin
Other
2.23k stars 180 forks source link

Test fails in Spek Android Studio plugin but works in Gradle due to different classpath #975

Open nathan815 opened 3 years ago

nathan815 commented 3 years ago

I have a Spek test running successfully with ./gradlew test, but it fails when running with the Spek Framework Android Studio plugin. For some reason the Spek plugin isn't picking up my override of android.util.Log (in src/test/java/android/util) so the default Log stub class is being loaded instead.

Stub!
java.lang.RuntimeException: Stub!
    at android.util.Log.i(Log.java:33)
...

Is there a way to get the plugin to use the same classpath as tests run through ./gradlew test?

raniejade commented 3 years ago

Hey @nathan815, what AS and spek plugin version are you using? It might be that you pulled in the plugin for IJ not for AS. For AS 4.2 you have to use https://plugins.jetbrains.com/plugin/10915-spek-framework/versions/dev/126685 for now.

nathan815 commented 3 years ago

Hey @raniejade, here are my versions:

AS: 4.2.2 Spek plugin: 2.0.16-IJ2020.2

So I did have the IntelliJ version. The one you sent works well - thank you!

nathan815 commented 3 years ago

Is it possible to download the AS version of the plugin directly through AS plugin marketplace?