From the course: Android Compose with Kotlin

Unlock this course with a free trial

Join today to access over 24,300 courses taught by industry experts.

Create screenshot tests

Create screenshot tests - Kotlin Tutorial

From the course: Android Compose with Kotlin

Create screenshot tests

- [Instructor] Screenshot testing is a great way to check how your UI looks to users. The composed preview screenshot testing tool makes it super easy by combining the convenience of composable previews with the efficiency of host side screenshot test. There's minimal setup, which you can find here on developer.android.com. However, once that's in place, you can simply use your existing composed previews. Let's check it out. I've added a new file to the screenshot test module. This test is used to confirm the behavior of our session item in both light and dark mode. Now, we'll open the terminal and run the Gradle tasks that are necessary to generate and validate the screenshots. So I'll come here, I'll open up the terminal and I'll do our first task, which is Gradle, and it's updateDebugScreenshotTest. Okay, and let's hit Enter. This task will go through all previews in the screenshot source set and create the reference images. Okay, once the task is successful, you can find them in…

Contents