LOUISVILLE, KENTUCKY
ATLANTA, GEORGIA
CHICAGO, ILLINOIS
CINCINNATI, OHIO
DENVER, COLORADO
MADISON, WISCONSIN
RARITAN, NEW JERSEY
TORONTO, ONTARIO
NOIDA, INDIA
HYDERABAD, INDIA

V-Soft's Corporate Headquarters

101 Bullitt Lane, Suite #205
Louisville, KY 40222

502.425.8425
TOLL FREE: 844.425.8425
FAX: 502.412.5869

Denver, Colorado

6400 South Fiddlers Green Circle Suite #1150
Greenwood Village, CO 80111

TOLL FREE: 844.425.8425

Chicago, Illinois

208 N. Green Street, #302, Chicago, IL 60607

TOLL FREE: 844.425.8425

Madison, Wisconsin

2810 Crossroads Drive, Ste. 4000
Madison, WI 53718

TOLL FREE: 844.425.8425

Atlanta, Georgia

1255 Peachtree Parkway Suite #4201
Cumming, GA 30041

TOLL FREE: 844.425.8425

Cincinnati, Ohio

Spectrum Office Tower 11260
Chester Road Suite 350
Cincinnati, OH 45246

Phone: 513.771.0050

Raritan, New Jersey

216 Route 206 Suite 22 Hillsborough Raritan, NJ 08844

Phone: 513.771.0050

Toronto, Canada

1 St. Clair Ave W Suite #902, Toronto, Ontario, M4V 1K6

Phone: 416.663.0900

Hyderabad, India

Incor 9, 3rd Floor, Kavuri Hills
Madhapur, Hyderabad – 500033 India

PHONE: 040-48482789

Noida, India

H-110 - Sector 63 ,
NOIDA , Gautham Budh Nagar ,
UP – 201301

Types of Automated Unit Tests in Android Mobile App Development

Types of Automated Unit Tests in Android Mobile App Development

Live and breathe "agile development" is the slogan of the most successful business solutions companies and as a part of process, the Continuous Integration (CI) process is considered one of the main support systems. Other than the continuous build process itself, the other plug-ins that we add to the process, make it invaluable. Some of these other plug-ins are: Static Code Analysis, Automated Unit Tests, Automated UI Tests, Profiling, Beta Deployment etc. In this post, we will focus more on the ‘Automated Unit Tests’ part of it, and explain it in the context of Android app development.

Mobile Application Testing Process

Mobile Application Testing can be done either by automation or manual testing process. It's a process to build an application software by testing it for its functionality, usability, and consistency. 

Andriod Testing Process

(Note: The diagram above shows the extra steps that we’ve plugged into the Continuous Integration process.)

In this post, we’ll focus more on the ‘Automated Unit Test’ part of it, and explain it in the context of Android app development. In Android, there are two test types.

    • The tests running on our local Java Virtual Machine (JVM).
    • The tests running on our Android platform (in which we need devices or emulator).

The local unit tests and instrumented tests are just terms that help distinguish the tests that run on your local JVM from the tests that run on the Android platform.

Android Testing Suite

The real testing types that you should understand when building a complete test suite are described below:

Andriod Testing Suit.jpg

Unit Tests

Normally, in Android development, we are writing the the Java code and need JVM to run it. If a test code has no dependencies, or only has simple dependencies on Android or when you can mock the Android framework dependencies, you should run your test on a local development machine. This testing approach is efficient because it helps you avoid the overhead of loading the target app and unit test code onto a physical device or emulator every time your test is run.

In this approach, we can use small parts of our code in total isolation and test the input and outputs of our data flow. In the local unit test, With the help of mock object, we can test our codes which depend on Android framework.

1. Local Unit Tests

Unit tests that run locally on the Java Virtual Machine (JVM). Use these tests to minimize execution time when your tests have no Android framework dependencies or when you can mock the Android framework dependencies.

2. Instrumented unit tests

Unit tests that run on an Android device or emulator. These tests have access to Instrumentation information, such as the Context of the app you are testing. Use these tests when your tests have Android dependencies that mock objects cannot satisfy.

Integration Tests

For Android development, Integration test are of two types that are mentioned below:

1. Components within your app only

This type of test verifies that the target app behaves as expected when a user performs a specific action or enters a specific input in its activities. For example, it allows you to check that the target app returns the correct UI output in response to user interactions in the app’s activities. UI testing frameworks like Espresso allow you to programmatically simulate user actions and test complex intra-app user interactions.

2. Cross-app Components

This type of test verifies the correct behavior of interactions between different user apps or between user apps and system apps. For example, you might want to test that your app behaves correctly when the user performs an action in the Android Settings menu. UI testing frameworks that support cross-app interactions, such as UI Automator, allow you to create tests for such scenarios.

Free Testing Center White Paper


About the Author

Kunj Gupta is a Mobile Development Expert Kunj Gupta is a Google Certified Senior Mobile Developer at V-Soft. He works on developing apps for Android and iOS platforms, following best practices to ensure that apps run efficiently with respect to memory, CPU, battery, and network. He is also an expert in DevOps side of mobile app development, especially on automated Unit Tests and UI Tests on the Continuous Integration pipeline. Recently he has been working on applying Machine Learning in mobile apps as well.

 

Topics: Technology, Mobile Application Development, Mobile Apps, Mobile, Testing, Mobile Apps Testing, Mobile App Testing

Get tech and IT industry Updates

Mobile Apps