Writing UI tests - Android
suggest changeVersions
The only version tag on this topic was 1.1.
Introduction
The focus of this document is the goals and the ways to write Android UI and integration tests. Espresso and UIAutomator are provided by Google, so the focus is those tools. Related tools include Appium and Spoon.
Syntax
- Idling resource
- String getName() - Returns the name of the idling resource (used for logging and idempotency of registration).
- boolean isIdleNow() - Returns true if resource is currently idle.
- void registerIdleTransitionCallback(IdlingResource.ResourceCallback callback) - Registers the given IdlingResource.ResourceCallback with the resource
Remarks
JUnit rules:
The MockWebServer example and ActivityTestRule are JUnit rules. You can write your own rules, and a rule runs for each test that uses it. See https://github.com/junit-team/junit4/wiki/rules
Appium
Parameters
Since parameters have some issues, they are placed here until that documentation bug is resolved:
| Parameter | Details |
|---|---|
| Class activityClass | which activity to start |
| initialTouchMode | should the activity be placed in touch mode on start: https://android-developers.blogspot.de/2008/12/touch-mode.html |
| launchActivity | true if the Activity should be launched once per Test method. It will be launched before the first Before method, and terminated after the last After method. |
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents