Book Image

Testing and securing android studio applications

Book Image

Testing and securing android studio applications

Overview of this book

Table of Contents (18 chapters)
Testing and Securing Android Studio Applications
About the Authors
About the Reviewers

Tools for unit testing

As we have seen in Chapter 9, Unit and Functional Tests, unit testing is performed with minimal connection to the system infrastructure and tests the different components in isolation. We will see different tools that allow us to easily perform unit tests on Android applications. They are as follows:

  • Spoon

  • Mockito

  • Android Mock

  • FEST Android

  • Robolectric


Spoon is not a new form of unit testing. Instead, it makes use of the existing unit testing instrumentation such as JUnit to run tests on multiple devices. With Spoon, you can test your application on many devices at the same time. When the test is completed, you will receive a summary generated by Spoon with all the information regarding the test performed on the devices. You can also use Spoon for functional testing.

For a device to be considered by Spoon to run tests on, it has to be visible to the Android Debug Bridge (adb) devices. You can even perform the tests on different types of devices at the same time, such...