Hey guys, I'm interested in Android testing in rea...
# android
v
Hey guys, I'm interested in Android testing in real world applications. Are there any open source projects that cover the app with meaningful tests? Any good books about testing in general or Android-specific? I'm mostly interested in unit tests, but also highly interested in VRT/snapshot, component/integration tests. I understand this can be a bit opinionated topic, lately I've re-read some articles (Martin Fowler's, Android docs, Google blog) and watched some YT videos (from past droidcon conferences) with testing topic in general + specifically testing on Android, but still some things don't sit right with me. Most of the examples and talks mention basics and very small examples that are not really applicable to real-life big repos. I'd like to see unit (and other) tests that actually do give confidence in the project and don't just blindly follow the one class per test pattern because everyone is doing it. We can also discuss a bit in the thread if you'd like to about different approaches and ideas, I'm interested to see what others think.
not kotlin but kotlin colored 3
d
Our app Mullvad VPN is open source mullvad, however it is a bit limited on unit tests. We do have a pretty broad set of test though: • Unit tests • Screen tests • Integration tests (mostly view model and use cases) • Convention/Architectural tests with Konsist • MockAPI E2E tests • E2E tests • Network/leak tests (we setup a test router and control/analyse traffic, part of E2E tests) Currently we run pretty plain tests with junit, but I believe we will integrate testballoon testballoon in the future.
testballoon 2
kodee loving 1
🙌 1
o
Alex Vanyo has a sizeable Android/Compose project started in 2021 with advanced tests using testballoon #testballoon (search for
testSuite
), but also living nicely side-by-side with JUnit.
❤️ 1
v
I'll check both out, thanks! Seems like testballoon is widely used very nice
o
Certainly not yet. 😆 It's the most recent addition to the Kotlin ecosystem, but even at its pre-1.0 levels it’s already pretty stable, Kotlin-first and comes with uncompromising Android support, including Robolectric.
v
What are your selling points to consider it over junit?
I've seen some mentions of testballoon here before
d
I think the git README covers most of it, the alternative if you want a framework and not just plain junit would be kotest.
👀 1
o
I'd throw in: Ease of use. Conciseness. Flexibility. Speed. Multiplatform. And you can really own it.
v
@David how many instrumented tests do you approximately have? I see both app and mockapi instrumented tests run in 6 and 9 mins, seems pretty fast for instrumented tests
d
17 mock API tests, 30 e2e, and 211 screentests. We also avoid clicking some in our UI by connecting to our Daemon over grpc and setting the settings we want to avoid unnecessary overhead. E.g clicking and setting and enabling/disabling stuff. We also implemented our own page pattern for making the tests more readable
nice spin 1
o
points to consider it over junit?
To come up with some more specific anwers: • These migration docs show direct comparisons of typical patterns side by side. • More important is probably the tests that don't get written because doing so is too cumbersome. As you mention, just following the "usual" patterns might not be sufficient. A framework proves itself at scale. Try to do the second parameterization with JUnit and you get an idea. • With genAI workflows, translate "don't get written" into "don't get properly reviewed". Would that make sense?
❤️ 1
l
There is a study about Android Testing, it gives a good view about test effectiveness in Android https://link.springer.com/article/10.1007/s10664-025-10726-x
🙌 1