Brill
11/27/2025, 2:46 PMOliver.O
11/27/2025, 4:20 PMBrill
11/27/2025, 9:43 PMsrc/test and src/androidTest in a single platform project).
As for how I personally tend to use the two types of test: unit tests verify that my code does what I think it does, and UI tests verify that I have the acceptance criteria in the story correct. Both help me avoid regression.Oliver.O
11/27/2025, 9:49 PMandroidTest). Although you might also need to run (non-UI) unit tests on androidTest, like when you are checking hardware/OS interactions like sensors.
But you are free to structure your tests as you like, so what's missing in Compose UI tests?Brill
11/27/2025, 9:54 PMOliver.O
11/27/2025, 10:01 PMcomposeTestRule. Now we have Compose Multiplatform which is based on Jetpack Compose, but extended to other targets like desktop (JVM) and browsers (JS/Wasm). Its runComposeUiTest function provides basically the same functionality as composeTestRule, but as a this context, so its a bit less boilerplate. Those UI components that don't need Android-specific APIs can even be tested on desktops. And UI tests on desktops are fast, because now you don't need an emulator. Does that help?Oliver.O
11/27/2025, 10:06 PMOliver.O
11/27/2025, 10:25 PMcomposeApp/src/commonTest/kotlin looks strange when you're coming from Android. That's because now your UI tests can cover multiple target platforms, Android being just one of them. And in this case, you'll put UI code in commonMain and UI tests in commonTest. On the Android side, you still have your separate directories for what's now called "host-side tests" (formerly unit tests) and "device-side tests" (formerly instrumented tests).