Book Image

Learning Android Application Testing

Book Image

Learning Android Application Testing

Overview of this book

Table of Contents (16 chapters)
Learning Android Application Testing
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


In this chapter, several real-world examples of tests that cover a wide range of cases were presented. You can use them as a starting point while creating your own tests.

We covered a variety of testing recipes that you can extend for your own tests. We used mock contexts and showed how RenamingDelegatingContext can be used in various situations to change the data obtained by the tests. We also analyzed the injection of these mock contexts into test dependencies.

Then, we used ActivityUnitTestCase to test Activities in complete isolation. We tested Views in isolation using AndroidTestCase. We demonstrated the use of Mockito to mock objects combined with ArgumentMatchers to provide custom matchers on any object. Finally, we treated the analysis of potential memory leaks and took a peek into the power of testing UI with Espresso.

The next chapter focuses on managing your test environment to enable you to run tests in a consistent, fast, and always deterministic way, which leads to automation...