Basic activity app covered with tests using CI/CD practice
- android SDK 34
- android build tools
- android emulator
- google processor APIs
- Use
./gradlew connectedAndroidTest
to run the tests on a connected emulator or device. - Use
./gradlew test
to run the unit test on your local host.
- Use UI Automator locally
- Use UI Automator on CI
- BeforTest with build task
- BeforTest with prebuilt app
Instrumented tests run on Android devices, whether physical or emulated. As such, they can take advantage of the Android framework APIs. Instrumented tests therefore provide more fidelity than local tests, though they run much more slowly. UI tests are usually Instrumented tests that verify the correct behavior of the UI.
Set up continuous integration To run tests as part of the build, you need to either configure your continuous integration server to use the Android Emulator or use Firebase Test Lab to run your tests, so Gradle Managed Devices or GMD improve consistency, performance, and reliability for your automated instrumented tests. This feature, available for API levels 27 and higher, allows you to configure virtual test devices in your project's Gradle files. The build system uses the configurations to fully manage—that is, create, deploy, and tear down—those devices when executing your automated tests. GMD runs with hardware acceleration by default (additional setup needed), but to avoid settings use Automated Test Device (ATD). [Accept Licence]
./gradlew build
./gradlew pixel3api30DebugAndroidTest
- Emulator acceleration
- Manifest files
- UI Automator article UiAutomator does just that, by delivering input events in a way a regular user would, but more consistent.
- Write automated tests with UI Automator
- Unresolved reference after changing SDK versions:
File > Invalidate Caches