During this workshop, we will cover the following topics:
- Introduction to Android testing
- How to interact with
Activity
,Fragment
,Jetpack Compose
in Android UI tests - What is "End-to-End(E2E) testing"?
- What is "Functional testing"?
- What is "Screenshot testing"?
- How to apply E2E, functional and screenshot testing techniques to the testing Android apps?
- Which frameworks we can use for testing Android apps?
The "mood-tracker-android" is an Android application that allows you to collect information about the emotional state during the day.
The "mood-tracker-api" is an API that allows you to store information about users. This project created for demo in this project as it doesn’t save emotional state data in the remote database.
To configure and run an "Android app" and "API" projects, I recommend using the following IDEs:
This project requires a few environment variables which can be added in the IntelliJ IDEA:
SECRET_KEY
SESSION_ENCRYPT_KEY
(HEX string)SESSION_AUTH_KEY
(HEX string)
I recommend to an emulator with the following parameters:
- Pixel 5
- Android 12 Google APIs (API 31)
To execute screenshot tests which uses the "shot" library, we can use the following commands:
./gradlew :app:debugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.alexzh.moodtracker.annotation.AppScreenshotTest
- execute all screenshot tests./gradlew :app:debugExecuteScreenshotTests -Precord -Pandroid.testInstrumentationRunnerArguments.annotation=com.alexzh.moodtracker.annotation.AppScreenshotTest
- execute all screenshot and update screenshots
The "Maestro" framework includes the "Maestro Studio", you can run it by executing the maestro studio
command.
To execute test "Maestro" test cases, you can use the maestro test --format junit e2e-flow-test
command.