kotest / kotest-intellij-plugin

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

Struggling to run individual tests/files from gutter icons (multiplatform/jvm?) #224

Closed BenWoodworth closed 1 year ago

BenWoodworth commented 2 years ago

I'm new to kotest and started trying to add kotest to a multiplatform library of mine. running gradle :allTests seems to work fine, but I'm really struggling to run. Here's a commit that will hopefully help as a reproducer (based on the kotest/kotest-examples-multiplatform repo): https://github.com/BenWoodworth/knbt/commit/abd9dc7529b377139789d912968d326244b8f408


I think it comes down to two main issues. Running the test class, and running tests within the class

IDE info and gradle settings ``` IntelliJ IDEA 2022.2.3 (Ultimate Edition) Build #IU-222.4345.14, built on October 5, 2022 Licensed to FastCraft / Ben Woodworth Subscription is active until January 11, 2023. For non-commercial open source development only. Runtime version: 17.0.4.1+7-b469.62 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 5.19.11-200.fc36.x86_64 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 4 Registry: debugger.watches.in.variables=false Non-Bundled Plugins: com.intellij.nativeDebug (222.4345.14) org.jetbrains.kotlin (222-1.7.20-release-201-IJ4167.29) org.jetbrains.kotlin-js-inspection-pack-plugin (0.0.10) org.jetbrains.compose.desktop.ide (1.1.1.1) kotest-plugin-intellij (1.2.62-IC-2022.2) com.demonwav.minecraft-dev (2022.2-1.5.21) Kotlin: 222-1.7.20-release-201-IJ4167.29 Current Desktop: GNOME ``` ![image](https://user-images.githubusercontent.com/1829157/194720478-68831cd0-a68f-43fa-b4a5-c27f082fbb53.png)

Running a test class

I'm not sure if this is a issue with the kotest gradle plugin or the IDEA plugin, but when I run a test class, all of the tests are skipped

With all run configurations deleted, clicking the double green run all gutter icon -> "Run KotestSpec":

Test results ![image](https://user-images.githubusercontent.com/1829157/194721032-4e95bf0c-ca98-49fc-888d-c21474cd4515.png)
Generated run configuration ![image](https://user-images.githubusercontent.com/1829157/194721104-17f49f2f-fc00-4d1b-ab63-d014b9b5098b.png)

Running a specific test

Similar to before, with all run configurations deleted, clicking the first single green run gutter icon -> "Run KotestSpec: Fail test"

This time nothing appears to happen (though a run configuration is created). I'm not able to run the same test again though, since the "Run KotestSpec: Fail test" option is grayed out, in addition to the green run arrow next to the created run configuration. The only way I know how to get the run button/menu option back is to restart the IDE.

Also worth noting that this time it created an IDEA/Kotest run configuration, not a gradle task run config

Grayed out run buttons ![image](https://user-images.githubusercontent.com/1829157/194722401-8e6a56e3-bfb2-4474-9aa3-74558a25dd17.png)
Generated run configuration ![image](https://user-images.githubusercontent.com/1829157/194722485-924b29a8-3d92-4a1d-8574-6fde56db18d0.png)
BenWoodworth commented 2 years ago

The first part, "Running a test class", was fixed by upgrading my kotest-framework-engine dependency to 5.5.1 (release here)

For the second part with 5.5.1, "Running a specific test", now the run button doesn't break when I try to do a specific test, but the specific test does fail with an unspecific error when I run it: image

Now though I am able to edit that run configuration to run jvmTest instead of commonTest, and that allows the test to run. On the JVM, at least :) image

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.