Is it possible to run common tests for Compose UI on a local jvm for Android so that `connectedAndro...
e
Is it possible to run common tests for Compose UI on a local jvm for Android so that
connectedAndroidTest
doesn't need to be run?
a
In which way are you trying to run Compose UI tests? If you want to use the Android implementation for components, but without an emulator or real device, you could use Robolectric to run them in Android’s unit tests. If you want to use the desktop implementations for components, you could run them in desktop’s tests. If you are trying to test logical Compose code (without any UI), you could use Molecule as a test wrapper in unit tests to be able to call
@Composable
code without needing a way to emit UI.
e
I'm trying to run a suite of tests for Compose UI Multiplatform across all of my targets (Android, JVM, JS, and Wasm).
e
my project has removed all our instrumented tests except for https://developer.android.com/topic/performance/baselineprofiles/overview, because we get enough coverage faster with JVM tests
https://github.com/takahirom/roborazzi has been working out for our compose (and other) screenshot tests, which was previously the last thing we were using emulators for
e
That wouldn't work for CMP though, right?
e
Roborazzi has CMP support (Paparazzi doesn't)
e
My issue is that running
./gradlew allTests
runs
connectedAndroidTest
. I don't think Roborazzi would help with that (unless I manually mess around with the task dependencies).
e
Copy code
androidComponents.beforeVariants { variantBuilder ->
    androidTest.enabled = false
}
then it won't even create the test tasks
e
Interesting, and then just the Android unit tests would run?
e
right. you can also use similar to control which Android variants have unit tests created
e
Cool thanks