I'm trying to set up an androidUnitTest (w/o robol...
# testballoon
d
I'm trying to set up an androidUnitTest (w/o robolectric -- but to test classes in the androidMain source set) with test balloon, but I'm getting:
Copy code
Execution failed for task ':player:testAndroidHostTest'.
> There are test sources present and no filters are applied, but the test task did not discover any tests to execute. This is likely due to a misconfiguration. Please check your test configuration. If this is not a misconfiguration, this error can be disabled by setting the 'failOnNoDiscoveredTests' property to false.
when running the gradle testAndroidHostTest, but when running from the ide, I get:
Cannot locate tasks that match ':player:cleanTestDebugUnitTest' as task 'cleanTestDebugUnitTest' not found in project ':player'.
any ideas why this isn't working @Oliver.O? Thanks!
o
Which Android Gradle plugin are you using?
com.android.application
or
com.android.kotlin.multiplatform.library
? Which version?
d
com.android.kotlin.multiplatform.library
Copy code
"8.12.3"
o
That plugin is severely broken and the Google documentation does not match the actual implementation. There is this README in TestBalloon explaining how you could make something work.
d
So I can't run the tests using the idea plugin?
Also I ran that last command, and i still got:
Task playertestAndroidHostTest FAILED
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task 'playertestAndroidHostTest'.
There are test sources present and no filters are applied, but the test task did not discover any tests to execute. This is likely due to a misconfiguration. Please check your test configuration. If this is not a misconfiguration, this error can be disabled by setting the 'failOnNoDiscoveredTests' property to false.
o
That's what the README explains.
d
1.
gradlew --no-build-cache testAndroidHostTest
2. [OK] 8 tests completed, 4 failed
but by me, I got that error what do you recommend I do? Is this only a problem with test balloon?
o
Yes, you need to do the entire three-step dance described in the README. If you look into the parameters and the build script of the README's example, it involves removing and then re-adding a dependency. It is completely unrelated to TestBalloon and/or its IDEA plugin. This is a bug on Google's side and they need to fix it.
d
I tried those three commands, but I still get: Execution failed for task 'playertestAndroidHostTest'.
There are test sources present and no filters are applied, but the test task did not discover any tests to execute. This is likely due to a misconfiguration. Please check your test configuration. If this is not a misconfiguration, this error can be disabled by setting the 'failOnNoDiscoveredTests' property to false.
I also don't get the same messages you got in those commands... should I be trying 8.13?
o
Using the commands in the README works only if you have something like this in your build script:
Copy code
named("androidHostTest") {
            dependencies {
                // WORKAROUND: See examples/multiplatform-library-with-android/README.md
                if (project.findProperty("local.androidHostTestDance") != "removeDependency") {
                    implementation("de.infix.testBalloon:testBalloon-framework-core-jvm:${testBalloonVersion}")
                }
            }
        }
d
like this:
Copy code
getByName("androidHostTest") {
            dependencies {
                if (project.findProperty("local.androidHostTestDance") != "removeDependency") {
                    implementation(libs.testBalloon.core)
                }
                implementation(libs.turbine)
                implementation(kotlin("test"))
            }
        }
?
it's just the test balloon dep that needs to be removed?
o
I don't know. Maybe another dependency would work as well. Something like this should never happen, so we can only try.
d
The build now succeeds (I switched to 8.13), but it still doesn't detect any test balloon tests, but when I run a Kotlin Test test, it works... @Oliver.O. Sorry for bothering you, I could just go back to KotlinTest, but I'd really like to start working with testBalloon if it doesn't take much more time..
the kotlin test command is Executing tasks: [playercleanTestAndroidHostTest, playertestAndroidHostTest, --tests, ....player.SampleTest] in project when using the green ide arrow, whereas testballon does: Executing tasks: [playercleanTestDebugUnitTest, playertestDebugUnitTest, --tests, ...*player*PlayerServiceImplTest*] in project
I think that may be the source of the problem?
It works in agp 8.12.3 with kotlintest too... and I can understand that Cannot locate tasks that match 'playercleanTestDebugUnitTest' as task 'cleanTestDebugUnitTest' not found in project ':player'.... since there are no such tasks in the new agp... maybe you could update the Intellij plugin to work with this new agp version?
What's funny is that even when running all tests in that sourceset, testballoon's tests aren't detected.
No pressure now, I just switched over to KotlinTest until test balloon will start working with this agp bug 🤷🏼‍♂️... thanks anyways for the help!
o
Luckily, there is now a known workaround for the issue: https://kotlinlang.slack.com/archives/C7L3JB43G/p1761052246460729 The upcoming TestBalloon release (hopefully in about a week or so) will contain that workaround and should support Android Local (host/unit) tests with the AGP/KMP plugin without issues.
🚀 1