Espresso Framework: Creating UI Tests using Page Object Model

Dmitry Yarygin
Software Testing: Break and Improve
6 min readMar 10, 2020

--

Photo by Rohit Tandon on Unsplash

Page Object Model in Software Testing is not a new concept. Some people heard about it, others wanted to switch over and implement it, but it all comes down to the specific needs of the client. In some cases, it may be worth utilizing it, while in other cases it creates an unnecessary overhead.

Today we are going to create a basic Espresso test framework to execute Android UI Test Cases on it. The main goal of this tutorial is to show the basic mechanisms behind the Page Object Model (POM).

Also, if you are interested in Web Testing, consider watching my video tutorial about TestCafe and WebDriver + POM.

Page Object: The Basics

First of all, what is a Page Object? This concept is based on the idea that every UI element (page or fragment) of the application has a separate implementation of the methods. This allows us to write a reusable code that is easy to modify when necessary.

Secondly, why would we need it? Having tests using Page Object Method pattern allows us to make readable code that new team members can understand and write code faster.

Finally, with the right approach, it’s possible to make an automation testing available to non-technical team members. There is a big potential when it…

--

--

Dmitry Yarygin
Software Testing: Break and Improve

Nomad lifestyle writer. Passionate about breaking software— QA Engineer. My Travel & Tech YouTube channel: https://www.youtube.com/c/nomadicdmitry