<developer.android.com/studio/preview/compose-scre...
# compose
a
developer.android.com/studio/preview/compose-screenshot-testing-with-testsuites does anyone knows how to use it with
com.android.kotlin.multiplatform.library
?
o
Do you want screenshot tests on non-Android targets?
a
if it could that would be great
o
Apparently, the above solution is Android-only. I haven’t tried but expect it to work with
com.android.kotlin.multiplatform.library
, though limited to Android tests. For Multiplatform support you might want to look into Roborazzi and combine it with a multiplatform test framework like TestBalloon (example here).
🙌 1
s
Hi. I looked at the AGP test-suite example and noticed a possible sticking point: it uses a top-level
android { testOptions { ... } }
block and targets a named variant. The Android KMP library plugin docs say the plugin has no top-level Android extension and uses a single variant, so the example doesn’t appear directly transferable. I haven’t tested whether there’s another way to configure the new test-suite integration with this plugin. Adding to Oliver’s Roborazzi suggestion: the Kotlin Foundation starter kit documents an Android host setup with
recordRoborazziAndroidHostTest
and
verifyRoborazziAndroidHostTest
. It may be a useful reference to try: https://github.com/KotlinFoundation/kmp-contest-starter-kit
o
Thanks for pointing out the differences regarding variants. That may limit applicability in this case. The Kotlin foundation example is also valid, but you’d run into limitations if you’d try to use this on iOS and would like to parameterize tests, which
kotlin.test
would not support on all platforms. I’ve shown how this would work with TestBalloon recently at droidCon Berlin:

youtu.be/GjKVKcVmhV8?t=1630â–ľ

(starting at 27:10)