spek icon indicating copy to clipboard operation
spek copied to clipboard

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

Open nathan815 opened this issue 4 years ago • 3 comments

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?

nathan815 avatar Jul 11 '21 06:07 nathan815

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.

raniejade avatar Jul 11 '21 11:07 raniejade

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 avatar Jul 11 '21 16:07 nathan815

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

nathan815 avatar Jul 11 '21 16:07 nathan815