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

Introducing Spoon


Device fragmentation is always talked about around Android and it is something you should be considerate of. The number of different devices and form factors means you really need to be confident that your application runs well, on all the aforementioned. Spoon is right here to help; Spoon (http://square.github.io/spoon) is an open-source project that gives you a test runner that allows instrumentation tests to be run on all connected devices in parallel. It also allows you to take screenshots as the tests are running. Not only does this speed up your testing and feedback cycle, it also allows you to potentially visually see where tests went wrong.

Spoon can be added to your project with this dependency:

testCompile com.squareup.spoon:spoon-client:1.1.2

You can then take screenshots inside your tests, allowing you to see the state of your application when you are also asserting behavior:

Spoon.screenshot(activity, "max_celcius_to_fahrenheit");

If you take the screenshot right...