Espresso
Espresso
The Espresso is an API provided by Google to enable testers to think in terms of
what a user might do while interacting with the android application - locating UI
elements and interacting with them. Espresso also blocks the test to directly
interacts with activities and views of the application because holding on to these
objects.
This set-up of Espresso makes it to mimic to behave like actual user, enabling the
QA forum to use it for functional testing :).
Web vs Mobile - Terminologies
Pages -> Activity Element -> View
How Espresso Works
ā— Start the particular Activity/View.
ā— Find a particular View among the whole View hierarchy.
ā— Perform some action on that view.
ā— Make assertions on the view.
Layout Inspector
Find the View
Perform Action
Assert View
Espresso Vs Appium
Espresso Vs Appium
Espresso Vs Appium
Spoon
ā— Spoon simplify tasks by distributing instrumentation test
execution and displaying the results in a meaningful way.
ā— Spoon runs the tests on multiple devices simultaneously.
ā— Capture screenshots of failed tests.(also for Debugging).
ā— Runs tests on multiple devices (Recommended to have diff
specs)
Spoon
Failure Handler
ā— Handles failures that happen
during test execution.
ā— Override handle method to
have the custom
implementation.
Flakiness
It is highly recommend to turn off system animations on devices used for testing.
On device, under Settings > Developer options, disable the following 3 settings:
ā— Window animation scale
ā— Transition animation scale
ā— Animator duration scale
Android Test Orchestrator
ā— Tool which allows you to run each of your app’s tests within its own
invocation of Instrumentation.
ā— Prevents test failures of previous test to impact the upcoming ones.
ā— Starts a new instance of the app with each test and closes the one from
the previous test.
Android Test Orchestrator
References
https://medium.com/stepstone-tech/android-test-orchestrator-unmasked-83b88799
28fa
https://developer.android.com/studio/debug/layout-inspector
https://square.github.io/spoon/
https://developer.android.com/reference/android/support/test/espresso/FailureHan
dler
Moral of the story
QAs and Devs lived happily ever after.

Espresso