And I have another question :sweat_smile: , I’m tr...
# multiplatform
r
And I have another question 😅 , I’m trying to add some platform specific test, and I’m having some issues. • There is a strange
androidAndroidTestRelease
autogenerated source set • If I put the tests on
androidTest/kotlin
I cannot run the tests because AS says “No task available” • If I put the tests on
androidAndroidTest/kotlin
then AS runs the tests, but it looks like the tests are not included in the apk so no tests are run
In fact, this is with a new project created from scratch in AS.
No tasks available
😞
(and in the project view, androidTest is not marked as
test sources root
k
That seems to be a bug in the IDE plugin, this is a workaround that worked for me:
Copy code
kotlin {
    sourceSets {
        if (isIdeaSyncing) {
            androidAndroidTestRelease {}
        }
    }
}
where
Copy code
boolean isIdeaSyncing = System.getProperty('idea.sync.active') != null
(like in the other thread we were discussing 🙂 )
r
thanks for answering!
It looks like it is not helping 😞 I’m using gradle plugin 7, not sure if this can affect somehow
k
So are we, what error are you getting? The androidAndroidTestRelease target will be visible in the IDE but shouldn’t affect any gradle builds.
r
thanks for your help Karel, my main problem is that I cannot run android specific tests. If I place them in
shared/src/androidTest/kotlin/SampleTest.kt
I cannot run them with AS because it says “No Task available”
if you place them in
shared/src/androidAndroidTest/kotlin/SampleTest.kt
AS can try to run them, but the actual test is not in the generated test apk, so no tests are actually executed
I think there is a problem while AS expects to have the test in one place, but gradle project in other place
k
I see, that looks like it. Then I’d try to add
androidAndroidTestRelease { dependsOn(androidTest) }
And get rid of the IDE condition as it should then work for both gradle and the IDE. Hopefully both androidTest and androidAndroidTestRelease should be runnable then.
r
no luck, still same thing 😞
I can reproduce the “No task available” when creating a new project in AS. The auto generated android test shows the same message
k
yes, it’s definitely a bug
r
👍 😞
should I report it somewhere? IIRC, plugins for KMM are not open source
s
Hey! You can always report issues on YouTrack 👍 https://youtrack.jetbrains.com/issues/KT
m
There is a bug report for
No tasks available
problem. For other problems, you should create new ones.
👍 1
t
I really hope this gets implemented at some point: https://github.com/JetBrains/kotlin/pull/2829
As of now I can't run any tests from the IDE except desktop tests.