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

Extensive use of mock objects


In the previous chapters, we described and used the mock classes that are present in the Android SDK. While these classes can cover a great number of cases, there are other Android classes and your own domain classes to consider. You might have the need for other mock objects to furnish your test cases.

Several libraries provide the infrastructure to satisfy our mocking needs, but we are now concentrating on Mockito, which is perhaps the most widely used library in Android.

Note

This is not a Mockito tutorial. We will just be analyzing its use in Android, so if you are not familiar with it, I would recommend that you take a look at the documentation available on its website at https://code.google.com/p/mockito/.

Mockito is an open source software project available under the MIT license, and provides test doubles (mock objects). It is a perfect match for Test-driven Development due to the way it verifies expectations and due to its dynamically generated mock objects...