This is a Android example app to study purposes about UI instrumentation tests, using Espresso framework.
For this example, we are using the Login Activity Android Studio template
Screenshot
-
Clone this repo
-
With Android Studio, click on
File
=>Open
and select the cloned folder -
Open the class
LoginBehaviorTest
and click on green arrow beside of the methodperformAuth_sameActivity()
Or, right-click on the test class in the projects panel, and select
Run
.Obs: More explanation about running tests, see this link: Running Espresso tests
-
Choice a avd emulator. The UI test will run like the screen below:
The refence links below contains tutorials and helpers about Android testing.
- Testing UI for a Single App
- Testing Support Library (AndroidJUnitRunner, UI Automator)
- Espresso - google.github.io