kotest / kotest-intellij-plugin

The official Kotest plugin for Intellij and Android Studio
Apache License 2.0
179 stars 25 forks source link

Android Studio run from Kotest pannel can't find classes #260

Open TraceM171 opened 1 year ago

TraceM171 commented 1 year ago

Kotest version: 5.6.2 Kotest IntelliJ plugin version: 1.3.69-IC-2022.2 Android Studio version: 2022.2.1

I am unable to run a single test in Android Studio using the gutter icons.

For example, in the following screenshot: image Trying to run all tests in the spec with the double green run button works as expected, but trying to run the single test that is inside the spec alone with the single play button seems to not find classes and throws ClassNotFoundException for dependencies like kotlin.reflect.full.KClasses or the test subject defined in the main directory.

This behavior also happens when running the spec or single tests from the Kotest plugin tool window.

A minimal sample project where this error shows up can be found in the following repo: https://github.com/TraceM171/kotest-android-studio-error-sample

wujek-srujek commented 1 year ago

Just wanted to report this very issue: whole spec works, single tests don't and fails with java.lang.ClassNotFoundException: kotlin.reflect.full.KClasses.

Android Studio Giraffe | 2022.3.1 Kotest 5.6.2 Kotest plugin 1.3.69-IC-2022.3

I will try to fight, but this might just be the death of Kotest in our team, IDE integration is very important, this issue basically prevents us from debugging a single test in a comfortable way. Yes, there are workarounds, like disabling all the other tests, but DX suffers greatly.

wujek-srujek commented 1 year ago

I tried adding kotlin-reflect to my testImplementation dependencies, and the error I got was similar, but now it failed to find a class from my src/main/kotlin source set, very strange.

Pitel commented 1 year ago

I have same issue. Running the whole spec works, running the single test doesn't: ClassNotFoundException for a class in the main source set.

AlbRoehm commented 9 months ago

Similar issue for me, Running the whole spec works fine, but running a single tests result in UnsatisfiedLinkError because of missing android.util.Log. Main difference I see is that for the whole spec a gradle task is running and for a single test a kotest-configuration is running. I also played with the config, tried to mock android.util.log staticly with mockk (which worked for other scenarios) but did not had any luck getting it to work.

edgarmiro commented 3 months ago

Same issue here:

Is the team working on it? Currently we're deciding if we change our whole test suite to Kotest. Definitely, this is a stopper for us. We can provide another sample project if it adds value.