Thursday, August 11, 2016

Mobile Espresso

Introduction Espresso -( Introduced in oct.2013)

1)      Expresso is a testing framework for android
2)     Easy to write reliable user interface tests for single application.
3)     Automatically synchronized user test actions with the user interface for your application

Component Espresso 

·        ViewMatchers - allows to find view in the current view hierarchy
·        ViewActions - allows to perform actions on the views
·        ViewAssertions - allows to assert state of a view
Base Espresso Test
·        onView(ViewMatcher)      
·         .perform(ViewAction)    
·           .check(ViewAssertion);

The Espresso testing framework is an instrumentation-based API and works with theAndroidJUnitRunner test runner.

Espresso UI recorder


Android Studio provides an Run ▸ Record Espresso Test menu entry which allows you to record the interaction with your application and create a Espresso test from it.

Running Espresso tests

Right-click on your test and select Run.