Summary
In this chapter, we learned how to add automatic tests to our application. We started with testing basic logic, which should be isolated from Android SDK classes and methods, using unit tests to instrumentation tests for those tests that had dependencies with Android. Eventually, we progressed to performing UI tests to check whether the UI layer behaves in the way it was designed to.
Automating tests is very important. Not only does it help the programmer develop the code while proactively thinking about quality, but it also solves a lot of issues when merging code from other colleagues and prevents regression issues when adding new features on top of an already existing functionality. Tests have to be smart and test the right thing; we could add almost infinite tests that would test useless functionalities, which would definitely be a waste of time and money as well. As a recommendation, test the critical functionality, edge cases, and, if you are working in a team, get an...