- [Instructor] Espresso allows us to…exercise and verify the UI of our app,…but tests often break when we update a UI.…The robot pattern mitigates that by…separating the what from the how.…In the recipe example, our robot has…a function called Is Favorite.…This extracts the how, verifying that the recipe is a…favorite away from the what that the title Is Selected.…When we update a UI, we have a central place…that updates the how while keeping the what intact.…

In other words, the test will still call…Is Favorite on the robot whenever it wants to verify…that the UI shows the recipe as a favorite.…If you take a look at the test itself,…you can see that we call Is Favorite in already favorite.…And if you re-factor cut to favorite,…the same is going to apply to the Cut To Favorite function.…When we change the UI, we only need…to update the Is Favorite function.…

In one central place, we will be able to change…the logic of our test to reflect the UI changes.…The separation of concern of what versus how…makes our test more robust to changes.…

Resume Transcript Auto-Scroll

Author

Released

8/30/2017

There's a difference between knowing how to implement testing and knowing when and why to do it. In this project-based course, get acquainted with best practices for testing Android apps by walking through a development workflow where testing is integrated throughout the process. As instructor Chiu-Ki Chan shows how to build the app, she explores the differences between JVM and on-device tests, explaining when to use each one. She also explores advanced techniques such as the MVP pattern. By demonstrating how testing fits into an app development workflow, she helps you bolster your ability to catch bugs—and determine where and when you should test.