TrimDroid: Testing Reduced GUI CoMbinations for AndDROID


TrimDroid is a novel combinatorial approach for generating GUI system tests for Android apps.


Approach Overview

TrimDroid is comprised of four major components: Model Extraction, Dependency Extraction, Sequence Generation, and Test-Case Generation. Together, these components produce a significantly smaller number of test cases than exhaustive combinatorial technique, yet achieve a comparable coverage.


Model Extraction

TrimDroid automatically extracts two models for each Android app by using program analysis: Interface Model (IM) provides a representation of all the input interfaces of an app, including the input widgets and events for each Activity. TrimDroid uses the IM to determine how a GUI screen can be exercised in order to generate the test cases for it.

  • Interface Model (IM) provides a representation of all the input interfaces of an app, including the input widgets and events for each Activity. TrimDroid uses the IM to determine how a GUI screen can be exercised in order to generate the test cases for it.
  • Activity Transition Model (ATM) is a finite state machine representing the event-driven behavior of an Android app, including the relationships among its Activities and their event handlers (transitions). Since our research targets GUI testing, we only extract information that is related to Activities, not other Android components (e.g., Services).

Evaluation

To evaluate our approach, we measure TrimDroid’s ability to reduce test suites and its effect on their effectiveness. To measure effectiveness, we compare TrimDroid’s code coverage and execution time against exhaustive combinatorial testing as well as prior Android testing techniques.

Test-Suite Reduction


Code-Coverage Vs. Exhaustive Testing


Code-Coverage Vs. Android Monkey and DynoDroid


Artifacts

Our evaluation results can be downloaded from here.

Formal specification for ATM and IM in Alloy language can be downloaded from here

TrimDroid is available for download from here.


M[agi]C models and test cases are available for download here.

Instructions to run TrimDroid

1 - Edit TrimDroid.sh script and set ANDROID_HOME.
2- Place the APK file in the same folder as TrimDroid.jar.
3- Run ./TrimDroid.sh "apk file name".
4- Test-cases will be generated in out/app-name/testCases folder.
5- Create a Robotium test project to run the test cases. Instruction for how to use Robotium can be found here.