Posted by Jose Alcérreca, Android Developer Relations Engineer
As apps improve in performance and complexity, manually testing them to confirm conduct turns into tedious, costly, or unimaginable. Trendy apps, even easy ones, require you to confirm an ever-growing record of take a look at factors akin to UI flows, localization, or database migrations. Having a QA workforce whose job is to manually confirm that the app works is an possibility, however fixing bugs at that stage is dear. The earlier you repair an issue within the improvement course of the higher.
Automating checks is the most effective strategy to catching bugs early. Automated testing (any longer, testing) is a broad area and Android affords many instruments and libraries that may overlap. Because of this, rookies usually discover testing difficult.
In response to this suggestions, and to accommodate for Compose and new structure tips, we revamped two testing sections on d.android.com:
Firstly, there’s the brand new Testing coaching, which incorporates the basics of testing in Android with two new articles: What to check, an opinionated information for rookies, and an in depth information on Check doubles.
Faking dependencies in unit checks
After offering an outline of the speculation, the information focuses on sensible examples of the 2 primary forms of checks.
- Native checks that run on a workstation and are sometimes unit checks.
- Instrumented checks that run on a tool. This part contains an introduction to UI checks and the AndroidX Check libraries.
Faking dependencies in UI checks
Secondly, we up to date the Testing part of the Instruments documentation that focuses on all of the instruments that make it easier to create and run checks, from Android Studio to testing from the command line.
The Unified Gradle take a look at runner.
We included an article that describes Superior take a look at setup options akin to working with totally different variants, the instrumentation manifest choices, or the Android Gradle Plugin settings.
These two new sections ought to offer you a basic notion of how and the place to check your Android app. To be taught extra about testing particular options and libraries, it’s best to take a look at their respective documentation pages. For instance: Testing Kotlin flows, Check Navigation, or the Hilt testing information.
Sadly, machines cannot routinely confirm the correctness of our documentation, so if you happen to discover errors or have options, please file a bug on our documentation problem tracker.