Kotlin / kotlin-koans

Kotlin workshop
MIT License
2.6k stars 1.41k forks source link

Starting single test in Android Studio 2.3 requires full rebuild #90

Open smdremedy opened 7 years ago

smdremedy commented 7 years ago

Now that Kotlin is an official language for Android, can you fix this: https://discuss.kotlinlang.org/t/kotlin-koans/2808

I taught Kotlin last weekend to Android developers, and they had to call gradlew test after each change. Installing InteliJ just to do koans is a bit too much.

svtk commented 7 years ago

Please vote and subscribe to this issue: https://youtrack.jetbrains.com/issue/KT-18948.

liangfenxiaodao commented 7 years ago

I'm experiencing the same issue, and when I try to run a single unit test in Android Studio 3.0 Preview 2, I got this error:

Class not found: "i_introduction._0_Hello_World.N00StartKtTest"Empty test suite.

khalodark commented 7 years ago

@jackylimel Have you found solution for this issue? I am still facing it now

liangfenxiaodao commented 7 years ago

not yet, I'm running the koans with Intellij Idea now

afaktor commented 6 years ago

I ran into the same problem after loading kotlin-koans into Android Studio 3.0. No solution found yet.

MahatmaSun commented 6 years ago

I ran into the same problem after loading kotlin-koans into Android Studio 3.0. No solution found yet.

tsunhua commented 6 years ago

See my case here:https://stackoverflow.com/a/47706652/5671221

lisongting commented 6 years ago

I ran into the same problem after loading kotlin-koans into Android Studio 3.0.1. No solution found yet.

KevCron commented 6 years ago

I ran into the same problem after loading kotlin-koans into Android Studio 3.0.1. as well. No solution found either.

elrondliu commented 6 years ago

I found a solution in Android Studio 3.0.1, open Gradle panel, Tasks -> build -> testClasses. Wait complete, and run test

lisongting commented 6 years ago

I found a method to solve this problem.

2018-01-30_224732

After several seconds, then you will see something like this. 2018-01-30_224801

Click the left green button of every test class , then you can see whether your code is right or not. 2018-01-30_225330

bstrathearn commented 6 years ago

To be clear, once you perform the above :testClasses gradle task, you can right-click on each test file and run individual tests as expected.

The annoying part is that you need to run :testClasses each and every time you modify the kotlin koans and want to see updated results.

DanielNovak commented 6 years ago

That's really a major issue for anyone starting with Kotlin - it really leaves a bad first impression. You clone the Koans tutorial and you are stuck right in the beginning.

jimandreas commented 6 years ago

See these Android Studio issues. Hopefully this will get fixed soon. For now I am working on the Koans in IntelliJ IDEA (Community Edition) and the experience is awesome. https://issuetracker.google.com/issues/78601041 https://issuetracker.google.com/issues/71694304

LDuncAndroid commented 6 years ago

If you edit the "Android JUnit" configuration under "Defaults" and add a gradle task to run before launch, you can run the testClasses task before each of the tests are run.

image

lawloretienne commented 6 years ago

Every time you make a change to a test you have to rerun the testClasses Gradle task. This is not obvious at all. Please add a disclaimer on the repo about this problem until it's resolved.

lawloretienne commented 6 years ago

Looks like this is still an issue nearly a year later. https://youtrack.jetbrains.com/issue/KT-18948

Dorrro commented 6 years ago

I've ended up using https://kotlinlang.org/docs/tutorials/edu-tools-learner.html At least it works out of the box.