-
Notifications
You must be signed in to change notification settings - Fork 0
What is Espresso tool
Devrath edited this page May 17, 2021
·
5 revisions

- Testing is very essential in delivering high-quality software. We test both the
business logicandUIto build high-quality software. - Espresso is a great library for UI testing
- Espresso helps to write
automatedtest cases so that they can be run multiple times - When you are writing an android application, We can test the application manually by looking at the screen finding the
input fields,action buttonsbut it is a tedious job and we may miss corner cases in it. - Having automated tests ensures that every time we make changes for the application on new changes, We can just run the automated test cases to validate that everything is running as expected.
- In addition to the
apkof the app, espresso installs thetest apkand sends UI events from the test apk to the app and observers what happens like whether the button is clicked, whether the list is scrolled etc. - Espresso works only for a single application, If we want to automate across multi apps, we need to use
UI-automater
- It is a part of the android support library and we can be confident that it has support for the foreseeable future.
- It provides
grey box testingmeaning that the tool has access to the code like theIDto automate the tests. -
Synchronizationis the most important feature provided by this tool, meaning there is proper synchronization between the application and the test code
-
UI-Testingcan be flaky due to timing issues - One such example can be that your test code can try to click on a button before it is rendered on the screen, It may seem bizarre but the machine is very fast and the test code may send events before the app is ready.
- Espresso solves this problem by checking the main thread message queue to find out whether any actions are pending. The main thread contains the instructions to render the app on the screen.
- Espresso always performs this check of finding out that the main message queue is empty before performing the test events like
click,type,swipe - Also if there are any background tasks that are taking place, the espresso tool waits for the background tasks to complete and then performs the test action on the application.