How to test UI

Testing the UI can help us prevent the user from discovering unexpected situations, crashing the application, or getting poor performance. We strongly recommend you to write UI tests so you are sure your UI performs as expected. For this purpose, we will introduce the Espresso Framework.

First of all, we will add the dependency for it as follows:

    compile '' 
    androidTestCompile '    core:2.2.2' 

Before you write and run Espresso tests, disable animations on your testing device because this will affect tests, expected timings, and behaviors. We strongly recommend you to do that! On your device, go to Settings | Developer options ...

Get Mastering Android Development with Kotlin now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.