📄️ Set up an Android application project to use Testify
Before building your screenshot test with Testify, make sure to set a dependency reference to the Testify plugin:
📄️ Configure your emulator to run Testify tests
The Sample application includes a baseline for an emulator that's compatible with GitHub Actions. To configure an AVD locally, create a new virtual device with the following settings in the Android Virtual Device (AVD) configuration:
📄️ Write a test
Testify provides two main entrypoints as JUnit4 TestRule subclasses.
📄️ Update your baseline
Testify compares each screenshot test against a PNG baseline image checked in to your project. When a test fails because the UI changed on purpose, or when you add a new test, you need to record a new baseline and copy it from the device to your project.
📄️ Verify the tests
You can use Android Studio's built-in test runner to run your tests. Or, you can invoke the gradle task screenshotTest to run all the screenshot tests in your app. The test will fail if any differences from the baseline are detected.
📄️ Install and use the Android Studio Plugin
Testify screenshot tests are built on top of Android Instrumentation tests and so already integrate seamlessly with existing test suites. Screenshots can be captured directly from within Android Studio or using the Gradle command-line tools.
📄️ Use the Gradle Plugin tasks
The Testify Android Gradle Plugin offers a suite of tasks to conveniently integrate Testify into the normal Android development workflow. It integrates seamlessly with existing test suites, providing tools for running, recording, and managing screenshot tests. The plugin enhances testing efficiency by simplifying device and emulator configurations and supports Android Studio integration for a streamlined workflow. For more details and specific instructions, please refer to the Recipe Book.