Android Application Testing can be performed with two basic functionality of testing i.e Manual and Automation Testing.
Well, Android Application for manual testing there is always the Android Virtual Device (AVD) tool. It should be easily accessible from IDE. Otherwise, we have to buy an Android-enabled device and fingers should be used. Android Application testing is done with different aspects as there is type with native and web application testing. First the android application should be install in the device or Android virtual Devices.We go through the functionality, usability and consistency for any android application that we build up. The aim of our testing is to make application bug free so we should understand the bug detection saves a huge amount of resources and reduces the maintenance costs. This is the best known reason to write the software test for android application development project. As the witting the test gives deeper understating of requirement and the problem to be solved. The major part we have to be considering while manual testing in android application are:
The following diagram summarizes the testing framework:
Well, Android Application for manual testing there is always the Android Virtual Device (AVD) tool. It should be easily accessible from IDE. Otherwise, we have to buy an Android-enabled device and fingers should be used. Android Application testing is done with different aspects as there is type with native and web application testing. First the android application should be install in the device or Android virtual Devices.We go through the functionality, usability and consistency for any android application that we build up. The aim of our testing is to make application bug free so we should understand the bug detection saves a huge amount of resources and reduces the maintenance costs. This is the best known reason to write the software test for android application development project. As the witting the test gives deeper understating of requirement and the problem to be solved. The major part we have to be considering while manual testing in android application are:
Functional Testing: We will go through the functional testing for android application to ensures that the application is working as per the requirements. Most of the test conducted for this is driven by the user interface and call flows. Functional Test will focus on validating that tasks/defects (as mentioned in Test Scope) have been implemented/fixed as expected. Test Scope define with the objective of test plan describes specifically what you want your testing to accomplish.
Regression Testing: Regression Test will be performed to ensure that the specific changes (enhancements/fixes as mentioned in Test Scope) have not adversely affected any other functionality. The purpose of regression testing in android application is to provide a general assurance that no additional errors were introduced in the process of fixing other problems. Regression testing is commonly used to test the system efficiently by systematically selecting the appropriate minimum suite of these needed to adequately cover the affected change. Common methods of regression testing include re executing previously run tests and checking whether previously fixed defects have re-emerged. The main reasons for regression testing in android application is that it’s often extremely difficult for a android programmer to figure out how a change in one part of the application will affect other parts of the application.
Unit Testing: Unit testing can be performed by the programmers to test the android application. Junit is the term used for the Unit Testing which is the de-facto standard. It performs the test object in isolation and in a repeatable way. It is usually rely on mock objects. The goal of nit testing is to isolate each part of the program and show that the individual parts are correct .A unit test provides a strict, written contract that the piece of code must satisfy. As a result, it affords several benefits. Unit tests find problems early in the development cycle.
Version Compatibility Testing: Version compatibility test, comprising of a non-exhaustive set of tests that aim at ensuring that it works in the different Android Version, will be executed as soon as a new build in QA Environment is received. The purpose of this test is to verify whether the build is stable for different Android Versions.
Performance Testing: Performance testing should be done to measure the performance of android application in a repeatable way. When testing the performance if it cannot be measurable then application cannot be improved. We should focus towards the premature optimization which does more harm than good. Android Application can be tested with the different devices or AVD emulator. It depends upon the hardware part of the devices. As to the better system it will provide the best performance and to the least it will be minor.
Security Testing: Security testing in android application is very important that it should follow all the security objectives. They are confidentiality, Integrity, Authentication, Authorization, Availability, etc.
Integration Testing: Integration testing defines how the components work together in android application. We have to ensure that modules have been unit tested for android components which needs integration with the system. Many testing framework facilitates the integration during the android application testing.
The purpose of integration testing is to verify functional, performance, and reliability requirements placed on major design items. These “ design items”, or groups of units , are exercised through their interfaces using black box testing , success and error access being simulated via appropriate parameter and data inputs.
Usability Testing: Usability testing is carried out to verify if the application is achieving its goals and getting a favorable response from users. This is important as the usability of an application is its key to commercial success. This testing is more feasible during the User Acceptance Testing.
Others:
Memory Leakage Testing: This testing is done to find that how much memory is being used by android application in devices. It is dependent to the performance and size of the application. If the size of application is higher it will take more memory in the application. Though we should test the total memory allocation by application in the devices to prevent from memory leakage.
What to Test
Testing Android Application is challenging for the tester one should have good knowledge of software testing process. There are some ideas for testing which should be in the priority before testing android application. These are the external part of testing as we have discussed all the testing process above. Some of the ideas for testing are as follows:
- Change in orientation
- Change in configuration
- Battery life
- Dependence on external source
Key Challenges in Android Application Testing
- Variety of Mobile Devices - Mobile devices differ in screen sizes, input methods (QWERTY, touch, normal) with different hardware capabilities.
- Different Resolution – Android application should be applicable to different resolutions of devices. One can used the android devices for the feasible we can test in avd emulator by making different resolution of emulator. There is diversity in Mobile Platform/OS so testing a single application across multiple devices running on the same platform and every platform poses a unique challenge for testers.
- Scripting - While testing the android application there may be the variety of devices which makes executing the test script (Scripting) a key challenge. As devices differ in keystrokes, input methods, menu structure and display properties single script does not function on every device.
Test Automation
Android Application testing integrates with the JUnit framework and based with JVM and for testing which required Android System. Android framework is an important part of the development environment which provides and architecture and powerful tools that help to test every aspect of application at every level from unit to framework. Some of automated testing frameworks or tools for Android Applications are including not limited to Activity Instrumentation, Selenium WebDriver2.0, MonkeyRunner, Robotium, or Roboelectric. Android has basic support for instrumentation tests, one of the possibilities being the Activity Instrumentation Test Case class belonging to the android.test package and extending JUnit’s Test Case in order to provide functional testing of Android activities. When an application is tested, each instrumented activity is launched inside the Virtual Machine on and Android emulator or an actual android device.
What can we test?
- Classes
- User Interface
- Services
- Content Providers etc
The major return back of Android frameworks supports followings:
- Android Test suites are based on JUnit. You can use plain JUnit to test a class that doesn’t call the android API, or Android’s JUnit extensions to test android components.
- The Android JUnit extensions provide component-specific test case classes. These classes provide helper methods for creating mock objects and methods that help you control the lifecycle of a component.
- Test suites are contained in test packages that are similar to main application packages, so you don't need to learn a new set of tools or techniques for designing and building tests.
- The SDK tools for building and tests are available in Eclipse with ADT, and also in command-line form for use with other IDEs. These tools get information from the project of the application under test and use this information to automatically create the build files, manifest file, and directory structure for the test package.
- The SDK also provides monkey runner, an API for testing devices with Python programs, and UI/application Exercise Monkey, a command-line tool for stress-testing UIs by sending pseudo-random events to a device.
The following diagram summarizes the testing framework:
Figure 1.0
Test Structure: Android's build and test tools assume that test projects are organized into a standard structure of tests, test case classes, test packages, and test projects. Android testing is based on JUnit. In general, a JUnit test is a method whose statements test a part of the application under test. You organize test methods into classes called test cases (or test suites). Each test is an isolated test of an individual module in the application under test. Each class is a container for related test methods, although it often provides helper methods as well. In JUnit, you build one or more test source files into a class file. Similarly, in Android you use the SDK's build tools to build one or more test source files into class files in an Android test package. In JUnit, you use a test runner to execute test classes. In Android, you use test tools to load the test package and the application under test, and the tools then execute an Android-specific test runner.
Test Project: Tests, like Android applications, are organized into projects. A test project is a directory or Eclipse project in which you create the source code, manifest file, and other files for a test package. The Android SDK contains tools for Eclipse with ADT and for the command line that creates and updates test projects for you. The tools create the directories you use for source code and resources and the manifest file for the test package. The command-line tools also create the Ant build files you need.
The testing API for android testing are as follows:
- JUnit
- Instrumentation
- Test case classes
- AndroidTestCase
- ApplicationTestCase
- InstrumentationTestCase
- Assertion classes
- Mock object classes
- Simple mock object classes
- Resolver mock objects
Key Classes for testing framework are as follows:
- Instrumentation TestRunner
- Android.test
- Android.test.mock
- Junit.framework
Activity Testing:
Activity testing is partially dependent on the Android instrumentation framework. It consists of components, activities which have a complex life cycle based on cal back methods; these can’t’ be invoked directly except by instrumentation. More often we can test the activity of android application by using instrumentation and other test facilities. Activity will not participate in the normal interactions with the system. And some methods should be avoided and will throw the exceptions if called. We can perform the Automation Testing with the help of Activity testing tools. There are methods, classes and activity packages which we will use to create the simple android application for testing.
UI Test:
The final stage of testing is to verify that UI of application. Your special consideration should be taken if your tests involve UI components. As you may have already known, only the main thread is allowed to alter the UI in Android. Thus a special annotation @UIThreadTest is used to indicate that particular test should be run on that thread and would have the ability to alter the UI. On the other hand, if you only want to run parts of your test on the UI thread, you may use the Activity.runOnUIThread(Runnable r) method providing the corresponding runnable containing testing instructions.
A helper class TouchUtils is also provided to aid in the UI test creation allowing the generation of events to send to the views, such as:
- Click
- Drag
- Long click
- Scroll
- Tap
- Touch
Service Testing:
To test a service you use the ServiceTestCase class. It provides the startService() and bindService() methods to interact with the service. The bindService) return immediately a IBinder object without callback. Testing asynchronous processing in services is a challenge as the duration of this processing may vary. It is good practice to test if the service handles correctly multiple calls from startService(). Only the first call of startService() triggers the onCreate() of the service but all calls trigger a call to onStartCommand() of the service.





