Espresso is a framework created by Google for Android that allows us to write tests on the user interface. It has a simple API, easily adapts to our needs and eliminates the complexity of managing different threads.
Espresso is based on Android instrumentation framework, which means the automation test is built into a single test apk. This test apk is different from normal application apk
Espresso Testing works basically in three blocks:
ViewMatchers– allows you to find an item in the view ViewActions– allows executing actions on the elements ViewAssertions – validate a view state
Working with espresso it is advisable to have below sheet nearby. --> Espresso Guide
Record Espresso Test
For this we must go in the options bar of Android studio to Run -> Record Espresso Test It will launch a screen where we can go making assertions. And in the end we will generate the test code:
Espresso is based on Android instrumentation framework, which means the automation test is built into a single test apk. This test apk is different from normal application apk
There is instrumentation registered in AndroidManifest.xml, which will be registered to the Android system once test apk is installed
The test apk must be signed using the same signature with the application apk, in order to run automation test
The test apk runs in the same process as application apk
Above are the only requirements of any instrument based test framework has. So there is no dependency on source code.