Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mastering Screenshot Testing Libraries for Android

Mastering Screenshot Testing Libraries for Android

Slides of my workshop "Mastering Screenshot Testing Libraries for Android: A Hands-On Workshop" at Droidcon Berlin 2023
-------------------------------------------------------------------------------
Join me for an in-depth workshop where you'll discover the most popular screenshot testing libraries for Android. With so many options to choose from, I'll guide you through the pros and cons of each library, including the newest player on the scene: Roborazzi, based on Robolectric from Google.

This is a hands-on workshop where you'll have the opportunity to explore the different libraries and write both, JVM and on-device screenshot tests on your own. By the end of the workshop, you'll have the skills and knowledge to confidently choose the best screenshot testing libraries for your projects.

Regardless of your level, this is a must-attend workshop to take your UI testing skills to the next level. Don't miss out on this chance to become a screenshot testing pro!
---------------------------------------------------------------
Repos of the workshop:
https://github.com/sergio-sastre/Android-screenshot-testing-playground
https://github.com/sergio-sastre/AndroidUiTestingUtils

Sergio Sastre Flórez

July 11, 2023
Tweet

More Decks by Sergio Sastre Flórez

Other Decks in Programming

Transcript

  1. Android Studio Electric Eel | 2022.1.1 AGP 7.4 JDK 11

    Emulator API 30 - Pixel 3a Tools for the workshop 1 3 4 @Gio_Sastre Github Repo https://github.com/sergio-sastre/Android-screenshot-testing-playground 2 Screenshot testing companion library https://github.com/sergio-sastre/AndroidUiTestingUtils
  2. Dropshot, Roborazzi & Paparazzi @Gio_Sastre Workshop’s agenda 1 2 3

    Screenshot testing theory What it is & How it works Existing libraries Final thoughts on-device vs. jvm screenshot tests 5 Jvm screenshot tests Roborazzi & Paparazzi On-device screenshot tests Shot & Dropshots Tips & tricks Testing different configurations Which configurations to test 4
  3. Special type of UI tests take a screenshot of it,

    compare it to its reference we inflate a UI component, where and @Gio_Sastre
  4. @Gio_Sastre Verify Custom on top of java.awt Differ Differ Custom

    wrapper on top of external library comparison algorithm https://github.com/dropbox/differ * * *
  5. jvm layoutlib robolectric robolectric * Needs to be con igured

    * Screenshot testing libraries @Gio_Sastre
  6. Dropshots Shot tolerance record & verify gradle managed devices test

    reports general value for all tests only from CLI @Gio_Sastre standard xml report configuration problematic Windows support Kotlin gradle scripts AGP 8.0 ⚠ ⚠ super easy per test from CLI & AS very nice HTML with diffs not supported not supported verify on device verify on local machine + diffs
  7. Paparazzi complex animations (views) Side effects (compose) render elevation configuration

    easy but… easy only library Bazel support ⚠ not supported Roborazzi modules app & library modules Bazel support different API levels Activity & Fragment supported not supported not supported not fully supported not supported supported @Gio_Sastre supported2 1 2 1 Due to layoutlib 2 Due to Robolectric 2 supported supported2 2
  8. @Gio_Sastre Configuration matters 1 3 Locale UI Mode 2 Orientation

    4 6 Custom themes Display Size 5 Font Size
  9. @Gio_Sastre possible Display size Font size + Locale UI Mode

    Orientation out of the box out of the box out of the box 1 via updateConfiguration() possible switch height & width 1 Activities under test must be open, otherwise still possible with AndroidUiTestingUtils out of the box Custom theme out of the box possible via updateConfiguration() out of the box out of the box out of the box robolectric based
  10. supported supported supported supported supported complex animations (views) Side effects

    (compose) render elevation not supported different API levels Activity & Fragment not supported not supported supported not fully supported not supported supported @Gio_Sastre supported2 1 2 1 Due to layoutlib 2 Due to Robolectric supported supported 2 robolectric based 2 2
  11. @Gio_Sastre * Only possible with Paparazzi and Roborazzi On-device on-device

    vs. jvm Best fidelity Foldable support Special configuration (adb) Jvm Very fast Less flaky Accessibility services * (no issues with emulators)
  12. Repo & Library recap 1 @Gio_Sastre Github Repo https://github.com/sergio-sastre/Android-screenshot-testing-playground 2

    Screenshot testing companion library https://github.com/sergio-sastre/AndroidUiTestingUtils