Android Testing Options

Published May 26, 2017
Android Testing Options

Automated Testing is an unchartered territory for many Android developers out there. If done properly, it can reduce the bugs in production environment. There are many different testing tools and frameworks available for testing in Android. In this post I will throw light on popular approaches available.

Unit Testing
Unit testing as the name suggest is about testing a (unit) particular fucntionality (i.e. an activity, fragment or model object) excluding other components. Unit tests do not require a device or emulator. Some popular libraries are Robolectric and JUnit. Both these test frameworks are built over JVM

Instrumentation Testing
In Android, Instrumentation is a set of "hooks" into the Android system that allow you to control the lifecycle or behaviour of Android components as it depends on Android context.These tests simulate button clicks, scroll events, touch events, etc. Th emajor goal of this testing is to check UI behavior. These tests require an actual device or emulator to run. Some popular options are Espresso, Selendroid.

Mocking
A mock object is a dummy implementation for an interface or a class in which you define the output of certain method calls. Mock objects are configured to perform a certain behavior during a test. They typical record the interaction with the system and test can validate that.Mockito is a popular choice among developers for mocking

Discover and read more posts from Divyansh Jain
get started
Enjoy this post?

Leave a like and comment for Divyansh

2