You are on page 1of 10

2018 6th International Conference in Software Engineering Research and Innovation

Edroid: A Mutation tool for Android Apps


Eduardo Luna Omar El Ariss
Department of Computer Science Department of Computer Science
Pennsylvania State University Texas A&M University-Commerce
Harrisburg, PA, USA Commerce, TX, USA
eal5376@psu.edu Omar.El.Ariss@tamuc.edu

Abstract— Android applications have experienced an In order to reduce the laborious process of manually
outstanding growth in recent years with a projected figure of generating mutants for a system under test, automated
378 billion in the number of application downloads by 2020. As
mutation tools have been developed to target different
a result, verification and validation of Android apps and their
graphical user interface through testing is crucial for quality programming languages. Some of the popular tools are
assurance. One way to assess quality assurance is through the Proteum for the C language [2], Mutpy for Python [3], Mutant
use of mutation testing. Mutation testing modifies the code of the for Ruby [4] and Mujava for Java[5].
System Under Test in small ways in order to produce faulty
versions of the program called mutants and compare them to
the original version. However, the cost of mutation testing can
The importance of an Android Mutation tool lies on the
be expensive and time consuming. We propose a graphical user- fact that Android mobile applications have experienced a
friendly Android mutation tool called Edroid whose primary noticeable growth in the last decade with a promising
purpose is to mutate Android’s main components such as projected figure of nearly 378 billion apps downloads by
activities, services, content providers and broadcast receivers 2020 [6]. Companies that develop Android apps tend to
using the source code of XML files. We introduce fourteen
Android mutation operators, where ten of them are new, that accelerate the development process and apply rapid
are derived from operators used in different fields such as development techniques such as Agile to increase
mutation testing for Graphical User Interface and XML productivity and reduce cost efforts [7]. Unfortunately, due
schema. We evaluate Edroid on five real world Android to the eagerness of releasing the apps before the competitors,
applications using testing methodologies such as random testing
most of the time, the testing process falls short and is not
and black box testing. Results from these experiments
demonstrate that Edroid facilitates the generation of mutants. given enough time. Appbrain shows that nearly 13% of
In addition and equally important, the set of proposed mutation Android apps have low quality [8]. This can be due to the fact
operators are effective in revealing errors that improve the that the apps need to be tested on different screen sizes and it
quality of a given test suite. is considered to be a tedious process. In addition, there is
insufficient knowledge among developers on how the apps
Keywords—mutation testing, mobile application testing, should be properly tested. Google provides various tools to
verification & validation, fault-based testing, software testing test android apps such as UIAutomator [9], Espresso [9] and
AndroitJUnitRunner [9]. These tools are very useful to ease
the testing process and generate test suites faster.
I. INTRODUCTION Furthermore, it is important to evaluate the effectiveness of
the test suite of the app being tested.
Mutation testing, as a fault-based technique, modifies the
code of the System Under Test (SUT) in small changes in In this paper, we propose Edroid, an automated mutation
order to produce faulty versions of the program called testing tool whose goal is the automatic generation of mutants
mutants. This approach was originally proposed in the early for Android apps from their graphical user interface (GUI).
1970’s by Richard Lipton [1]. Each modification is based on Edroid applies strong mutation testing also called traditional
a well-defined syntactic rule called a mutation operator. Tests mutation testing with a full generation of source code for
cases are then executed on these mutants and their result mutants. Edroid as a tool allows the user to mutate their
(actual output) is compared to the original one (expected Android app using a list of fourteen mutation operators. Our
output). If the actual and expected output differ, then we list of mutation operators includes operators that are used in
imply that the mutant is killed. As a result, the quality of a traditional GUI applications, XML (Extensible Markup
test suite is measured by using the mutation score which is Language) code, and from recent research done on Android
the percentage of killed mutants. The higher the mutation apps [10-11]. Android mutation operators from previous
score, the better the test cases. In other words, the main goal work focus mainly on mutating the GUI and configuration
of mutation testing is to evaluate an existing test suite and files of Android apps. In addition, we use mutation operators
give directions on how to design more effective test cases. applied from different fields such as operators used to mutate

978-1-5386-6577-0/18/$31.00 ©2018 IEEE 99


DOI 10.1109/CONISOFT.2018.00022

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.
XML schemas [12-14] and Java programs with GUI [15-17] Richard Lipton [1], and was later developed and published by
and use these operators to design new mutation operators for DeMillo et al [21]. Pilot mutation System (PIMS) [22] was
Android apps. the first recognized Mutation tool that pioneered the process
of automated mutation testing. PIMS consisted of three
The proposed study makes the following contributions: phases. First, the mutants are generated from the original
• Ten newly introduced mutation operators for code. Second, the mutation tool accepts the test cases as input
Android apps. from the user. Finally, the test cases are executed on all the
• Evaluate Android apps through the GUI and mutants and the number of killed mutants is determined.
configuration rather than the java code. To handle Since then, most of the mutation testing tools that are
specific components such as Activity, Services and developed by various researchers, and which we will follow
Content providers, only present in the Android here in this paper, try to follow this approach.
development platform.
• Development of Edroid with the goal of enabling Much of the mutation testing tools developed up to date
module extension and future improvements in the target the Java programming language, being MuJava [5] the
Android Mutation testing field. mostly used tool among them. MuJava uses traditional
statement level mutation operators and class level operators
The rest of the paper is organized as follows. Section II to apply mutation testing on java programs. The mutation is
describes related work done in the mutation testing field such done directly at bytecode level to improve the performance
as the development of previous mutation systems. Section III of the tool. Mujava allows the tester to select the mutation
introduces our proposed mutation operators. Section IV operators through an easy-to-use interface. It has been
describes Edroid, its functionalities and limitations. Section utilized by a great amount of research studies due to its
V describes the methodology used in order to apply mutation accessibility and simplicity to accomplish the mutation
testing on Android apps and how the mutants are evaluated. process. For this reason, Edroid’s layout is influenced by
Section VI evaluates Edroid on three Android mobile apps Mujava’s interface and design.
and Section VII concludes the paper with vision for future
work. Few research have explored the field of mutation testing
on GUIs. Alegroth et al [15], introduced a set of eighteen
II. RELATED WORK mutation operators and divided them into three different
classes: “removing”, “modifying” and “adding” code in the
In this section we focus on recent research done in four system under test. The authors applied their proposed
areas: Android testing, mutation testing for GUI, operators on two GUI tools: Guitar (an automated
configuration files for android apps, and an overview of component-based GUI) [15] and Vgt Guitar (a visual GUI
existing mutation testing tools. prototype) [23]. The latter one being not useful in practice but
only for the purpose of the authors’ research. Oliveira et al.
The Android Development environment [9] incorporates a [16] evaluated the same mutation operators on two different
testing framework that includes testing automation tools such applications: a regular Java calculator program and a real-
as Espresso, UI Automator, and AndroidJUnitRunner. The world application. Alsmadi [17] on the other hand, proposed
Espresso test recorder tool allows the creation of User seven mutation operators that switch, delete and add GUI
Interface (UI) tests for Android apps, which is suitable for components. These operators were evaluated using four small
functional UI testing [18]. The UI Automator provides a set open source applications. We believe that testing the GUI of
of APIs to design UI tests that allows the tester to perform an Android app is an essential step for the assurance of system
interactions on the Android device and apps such as quality, since the majority of the interactions of the users
inspecting the layout hierarchy of the target device or occur through its GUI. We therefore concluded that GUI
touching a button within an installed app. These interactions mutation operators should also be applied on Android apps
are suitable for cross-app UI testing across the android device and will be included in our tool.
operating system. AndroidJunitRunner extends Junit [19]
functionality and is suitable for unit testing. In addition, Communication between Android applications is crucial
commercial tools such as Robotium [20] are often used for and needs to be considered while testing an Android app. The
the design of UI tests. Robotium allows the recording of UI Android Application Framework layer provides high-level
tests faster and simpler than most existing Android testing services. Services that are used to perform actions in the
tools and is suitable for functional UI testing. All of the background such as playing music through a music player.
previous mentioned tools are useful for the design of test Applications made by developers can use these services,
cases, and will be used in order to evaluate our proposed tool.
communicate and respond to them using a broadcast receiver.
Mutation testing was initially proposed in 1971 by Avancini and Ceccato [12], proposed an approach to test the

100

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.
inter-application communication in mobile devices. The mutation tools, can also be included to Edroid’s mutation
authors modified the intent filters that are required for operator list. We conclude that some of the mutation
android apps to have a correct communication. Therefore, we operators used in other languages such as C can also be
introduce two mutation operators based on intent filter applied in the context of Android Mutation testing.
communication for services and receivers.
III. EDROID DESIGN
Although XML files present in an android app source code
are slightly different and have a distinct purpose from Edroid, is an Android mutation system that supports
traditional XML files, the presentation semantics of automated generation of mutants for Android apps. The
structured data on both is very similar. Li and Miller [13], purpose of Edroid is to reduce the cost of mutating Android
applications, which tends to be time consuming and highly
proposed a set of eighteen mutation operators based on
expensive to achieve. This section describes Edroid’s
common faults that can occur when developing XML functions, and its limitations.
Schema. Franzotte and Vergilio [14] on the other hand,
introduced ten mutation operators for XML Schema A proper understanding of the organization of an Android
documents. These operators are also based on common faults project is needed in order to design Android mutation
made by developers and are divided into two groups that operators. Android app is built using four main components
produce elementary and structural mutations. Elementary such as activities, services, content providers and broadcast
mutation operators modify elements and attribute values in receivers [24]. These components and their interaction within
the document while structural mutation operators modify the the app are described in the Android Manifest file [25]. Fig.
tree structure of the XML schema. In both of those work, the 1 summarizes the function of each component.
authors’ objective is to reveal possible faults in XML
schemas through the use of mutation analysis. In this paper,
we benefit from this structural similarity in XML schemas
and make use of some of the previously proposed mutation
operators and apply them to the XML of an Android app.

As a starting point on the field of Android mutation testing,


Deng et al. [11] introduced an Android mutation tool that uses
eleven Android mutation operators along with the traditional
java operators in Mujava. These android mutation operators
are based on common faults made by developers. Their
operators also target the GUI and configuration files of Fig 1. Android Application components
Android apps. The GUI operators target individual elements
of the interface while the configuration operators only target Fig. 2 demonstrates the mutation testing procedure that
the application permissions. Their mutation tool is then Edroid follows. First, mutants are generated by modifying the
evaluated using eight applications from Google Play source files of the Android apps by either using a subset or
Marketplace. Their work implements the first android our entire proposed mutation operators. Edroid allows the
mutation tool. In addition, Linares-Vasquez et al. [32] [33] generation of first order or high order mutants. Second, the
proposed a framework for Android mutation testing called Mutant Executor uses a test suite to evaluate the mutants. The
MDroid+. This framework implement 38 mutation operators source files of the mutant app are compiled as an APK file.
based on android and java faults. Furthermore, the authors The APK file is then run on a mobile device. The behavior
produced a taxonomy of android faults and grouped them into and output of this APK file are then documented as the actual
android, java and mixed faults. These works have similar results. Finally, the expected results are compared with the
approach to our goal. However, in our work, the proposed actual results to determine which mutants are killed. The
mutation operators mutate the layout of a group of elements mutation score is finally calculated by the number of killed
in the GUI, and mutate the broadcast receivers and services mutants in proportion to the total number of mutants.
used by the Android app using the source code of XML files.
Further, our proposed mutation tool focuses on generating In its current version, some of Edroid‘s components are
mutants through the utilization of an easy to use interface. not yet automated. The modules with blue color in Fig. 2
indicate the ones that are currently automated while the rest
By analyzing the related work, we conclude that the are done manually. Edroid’s set of mutation operators
currently only mutates the source code of XML files of
process of automated mutation testing implemented to PIMS
android apps. The future goal of Edroid is to cover the entire
can also be implemented to the development of Edroid. In
mutation testing process, to include java mutation operators
addition, the various set of existing mutation operators from [11, 32, 33] and to work for both standard Java programs
mentioned in this section, which have been used in previous

101

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.
and Android apps. Edroid does not detect equivalent mutants a folder named after the name of the mutant and its current
during any part of the mutation process nor does it allow them generation number.
to be removed manually through the interface.
IV. ANDROID MUTATION OPERATORS

Edroid includes fourteen mutation operators, eleven of


them target the graphical user interface while three of them
target the configuration files. Out of these fourteen operators,
eight GUI operators and two configuration operators are
newly introduced by us. Table I describes the list of newly
proposed Android Mutation operators from this research
along with its abbreviation and its type.

TABLE I. List of newly proposed Android Mutation Operators

# Abbreviation Description
1 BWI Set Button Widget Invisible (GUI)
2 TWI Set Edit Text Widget Invisible (GUI)
3 VGI Set View Group Layout Invisible (GUI)
4 VGT Change View Group Type (GUI)
5 BWA Change Button Widget Appearance (GUI)
6 TWA Change Edit Text Appearance (GUI)
7 BWX Button Widget Text Switch (GUI)
8 BWP Button Widget Duplicate (GUI)
Fig. 2 Edroid mutation testing procedure
9 RFC Change Intent Filter Receiver (config.)
Edroid consists of an interface that allows the user to 10 SFC Change Intent Filter Service (config.)
generate Android mutants. The interface includes three
components: 1) the list of files to be mutated, 2) the list of
The rest of Edroid’s mutation operators are based on the
mutation operators available to select from and 3) a console
work of Deng et al. [11]. APD (Activity Permission Deletion)
that updates the user regarding the current state of the
which mutates the Android manifest file and BWD (Button
mutation process.
Widget Deletion), BWS (Button Widget Switch) and TWD
(EditText Widget Deletion) which mutate the GUI. These
Edroid first requires the user to enter the location of the
operators also mutate the GUI and configuration files of
folder that contains the Android source files. Then, the next
Android apps.
step is for the user to select the list of mutation operators to
be applied to the Android app. Mutants are generated by
In the following section, we describe in detail how the
pressing the “Generate” button. Edroid detects whether the
Android mutation operators work using two running
type of file is a XML Layout or Android Manifest file and
examples: Calculator for Android and Forecastie apps.
generates the mutants that are selected by the user according
Calculator for Android [27], is a simple calculator that
to its type. The console shows the type and number of
provides basic operations and some advanced mathematical
generated mutants. For every mutant that is generated, the
functions such as sine, cosine and tangent. It has one activity,
mutated file and the rest of the files are also generated with
one Android Manifest file and two Layout files to display the
it. The mutated file shows which excerpt of the source code
GUI of the activity. The leftmost screen of Fig. 3a illustrates
was modified by the mutant.
the original GUI of the main activity. We chose the
Calculator app as a running example for its simplicity and
In order to generate each mutant, Edroid follows a four-
large number of GUI elements. This implies that a large
steps workflow similar to the methodology used by Oliviera
number of mutants will be generated by the GUI Mutation
et al. [16]: (1) Each XML file is read as a text file; (2) a
operators. Forecastie [28] is a weather app that updates the
specific keyword or set of keywords are found on the source
user with the weather conditions of surrounding areas. It has
code; (3) the keywords are replaced one at a time and the part
four activities, one Android Manifest file and eight Layout
of code being replaced is commented with the name of the
files. Forecastie is chosen here as an example to demonstrate
mutant; (4) the newly modified version of the file is saved in
the configuration mutation operators. It receives three

102

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.
broadcast messages and offers one service. These messages Group Layout on the screen. The purpose of this
are called implicitly, which follow the assumption that we operator is to assert that widgets such as
need to test the mutation operators. checkboxes, radio buttons and every other widget
inside the View Group are accessible on the
application GUI.
A. XML Layout Mutation Operators
• Change View Group Type (VGT): This operator
An XML Layout file is used to define the visual layout changes the display properties of the elements in a
of the GUI of an Android app. In this file we declare the GUI view group layout. This modification may
components such as buttons, text fields and screen layouts. sometimes lead to improper arrangement of the
There exist seven different types of layout: Linear Layout, elements on the screen. VGT operator is applied to
Relative Layout, Table Layout, Absolute Layout, Frame every layout on the screen. The purpose of the VGT
Layout, List View, and Grid View. Each layout has a set of operator is to ensure that the tester checks for the
properties that determine the visual features of that layout. desired distribution and location of the elements on
Linear Layout, Relative Layout, Table Layout, and Absolute the screen. Fig. 3b shows an example of a VGT
Layout are considered common layouts used to organize the mutant where the buttons on the screen are displayed
elements that are contained within them. In contrast, List incorrectly.
View and Grid View Layouts are used to display a list of
items. Usually these layouts are filled at runtime to display • Change Button Widget Appearance (BWA):
dynamic content. They use an adapter which acts like a BWA changes the appearance of a button widget
middleman between the data source and the layout. The one at a time. The appearance can be modified by
adapter extracts content from an external source such as a selecting a different text color, background color,
database or an internal source such as an array and transform text-style or typeface. Fig. 3c illustrates an example
each record into a list item [26]. of a BWA mutant where the button “4” text color
has been modified.
Without a proper declaration of a layout and the elements
inside of it, the expected GUI may not have the desired • Change Edit Text Appearance (TWA): Similar to
output. Because of this, we introduce the following operators BWA, this operator changes the appearance of an
that mutate the syntax of XML Layout files specifically the edit text widget one at a time. An example of a TWA
type of layout used, and elements such as buttons and text mutant is shown in Fig. 3d where the result text field
fields. background color is changed to a white color.
• Set Button Widget Invisible (BWI): This operator The purpose of BWA and TWA operators is to obligate
removes one button at a time by making it the tester to build test cases that check whether the buttons
inaccessible from the GUI while the functionality and text fields inside of the GUI are displayed as desired. This
specified in the Java code and the space it occupies involves that the expected behavior depends on the change
still remains being intentional or unintentional [16]. Utilizing the BWA
mutant displayed in the third screen of Fig 3c as an example,
• Set Edit Text Widget Invisible (TWI): Similar to a test should fail if the desired text color of button “4” is not
BWI, an Edit Text widget is removed one at a time black, otherwise the test should pass.
from the apps’ GUI maintaining its code
functionality and space on the screen. • Button Widget Text Switch (BWX): BWX
switches the text of a button widget with the text of
The purpose of the previous mutation operators is to every other button on the screen one at a time. The
assert that the test case fails if the widget is not accessible underlying functionality of both buttons remains but
on the application GUI [16]. To kill a mutant of this type, the text displayed in each button is swapped
the tester must verify that each widget is properly shown
on the screen. • Button Widget Duplicate (BWP): The BWP
operator replaces and overwrites the text of a button
• Set View Group Layout Invisible (VGI): A view widget to the text of every other button on the
group layout can contain one or more widgets such screen. The functionality of the buttons is not
as text fields, buttons, checkboxes and radio buttons. modified but the text displayed on both buttons
Each element inside a layout is treated as a child. changes the GUI and makes it look as if two equal
The objective of doing this is to dictate the way that buttons are on the screen.
children are arranged on the screen. The VGI
operator removes the entire layout and all the Similar to the BWA operator, the purpose of BWX and
elements inside of it. This is done for every View BWP operators is to check whether the buttons inside of the

103

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.
Fig. 3a Original GUI Fig. 3b VGT Mutant Fig. 3c BWS Mutant Fig.3d TWA Mutant

GUI have the desired behavior. This implies that the expected As mentioned in the Related Work Section, this
action of a button depends on the change made by the mutant configuration is regulated by using intent filters on services
as intentional or unintentional. and receivers. A service is a long-running operation that is
performed in the background of the Android operating
B. Android Manifest Mutation Operators
system. An example of a service is a user playing music while
browsing other applications. In the other hand, a broadcast
The Android Manifest file stores essential information receiver is usually sent by the Android operating system and
regarding an Android app. Its purpose is to define the received by the application. An example of a broadcast
organization and interaction between the Android main receiver is the arrival of a new text message. Without an
application components and their attributes. In addition, any appropriate configuration of the services and receivers in the
permission required by the device such as Wi-Fi, Bluetooth Android manifest file, the application might have issues
or location services is also specified in the Manifest file [24]. starting and using services such as connecting to the Internet
Fig. 4 shows an excerpt of the Alarm Klock Manifest file. It and accessing the user’s location with the Global Positioning
begins with the root manifest tag and its attributes. The System (GPS). Therefore, we introduce the following
manifest tag contains the uses-permission tag that specifies mutation operators that mutate the syntax of intent filters on
the permissions needed by the Alarm Klock app. For services and receivers specified in Android manifest files.
example, WAKE_LOCK keeps the screen turned on while
READ_EXTERNAL_STORAGE allows the application to • Change Intent Filter Receiver (RFC): RFC
read from an external storage such as an SD card. Further, the changes the intent filter action of a receiver into any
manifest tag also includes alarm clock activity services, such other action that is not defined in the intent filter.
as alarm notification and receivers such as Alarm trigger. Fig. 5 illustrates an example of an RFC mutant
where the action name of the intent filter is
modified. In this example the type of intent in the
original file is “App widget update”, which is sent
when the application widget needs to be updated.
The mutant modifies the type of intent using any
other type of intent. For this particular case, it is
modified with “App widget deleted” which deletes
the application widget. An application widget in
Android is the miniature version of an Android
application. It is usually placed in the home screen
and includes limited functionality.

• Change Intent Filter Service (SFC): Similar to


RFC, this operator modifies the intent filter action
of a service with another action that is not present in
the intent filter.

Fig. 4 Excerpt of Alarm Klock Manifest file

104

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.
operators target. For evaluation, we use three test suites that
are built using different testing strategies: random testing,
adhoc testing, and black box testing.

For our first set of experiments, we apply random testing


using Monkey tool from the Android SDK on the five android
apps. Each experiment consists of 5,000 pseudo random
events such as clicks, touches or system-level events. For
each run we specify a seed value. In addition, we add a delay
of 500ms between events to guarantee that the screen
rendering is complete before the next event is executed. For
the second set of experiments, we apply Adhoc testing. An
experienced Android tester manually experiments with the
apps for a considerable amount of time. The tester was
Fig. 5 Examples of RFC Mutants
encouraged to test all the features of every app as much as
V. EVALUATION possible. We recorded the tester’s input with the Robotium
Recorder tool. For the third set of experiments we use black
A. Subjects box testing focusing on testing the requirements,
functionalities, and usability of the app through the elements
In order to evaluate our proposed approach, we select five of the applications’ user interface.
Android apps from the Google Play Marketplace: Calculator
for Android [27], Forecastie [28], Antenna Pod [29], Alarm We check mutant equivalency manually by hand. For GUI
Klock [30] and Tipster [31]. The source code of all five apps testing, an equivalent mutant is a mutant that generates an
can be found on Github. identical GUI in contrast to the original GUI. For
configuration testing, an equivalent mutant is one that does
Calculator for Android and Forecastie provide basic not make any changes to the original functionality of the app.
operations with some advanced mathematical functions and The only mutation operator that generated equivalent mutants
weather condition updates respectively. Antenna Pod is a was VGT. This mutant changes the arrangement of elements
podcast manager and player that has instant access to inside a view group layout. An example of such a case is
hundreds of free and paid podcasts, from independent when the original code uses Linear Layout and the mutated
podcasters to big stations such as CNN (Cables News code uses instead a Table Layout. Both layouts share similar
Network) and BBC (British Broadcast Corporation). In attributes since Table Layout extends Linear Layout. The rest
addition, the user can import and export the sources in a of the GUI mutation operators did not generate any
simple way using RSS (Really Simple Syndication) or Itunes. equivalent mutant. This means that the GUI operators can
It has twenty-two activities along with their respective layout generate a representative and useful set of mutants.
files and one Android manifest file.
In addition, none of the configuration mutation operators
In addition, we select two Android apps that are used in generated any equivalent mutant. This indicates that all the
other research. Alarm Klock, which is a typical alarm clock permissions, services and receivers specified in the Android
app that includes some advanced features such as the use of manifest file are necessary for the functionality of each app.
mp3/media library songs as alarms. It has two activities, one We also notice that some mutants did not allow the app to be
service, two receivers, one Android manifest file and nine started and forced a sudden close. We named these invalid
layout files. Tipster is an app used to calculate tips and split mutants “stillborn”. The only mutation operator that
payments or bills among several customers. It includes one generated stillborn mutants was the VGT operator. An
activity, one Android manifest file and one layout file. example of such a case is when the original layout is a
common layout such as Linear Layout and the mutated layout
is of the kind that uses an Adapter such as List View. This
B. Experiments
caused a syntactic error and was directly detected by the
compiler.
For our experiments, we use the main XML layout files of
each app along with their Android manifest file. Additional Table II lists the apps and the respective files that are tested.
layout files are selected based on the type and number of It also shows the number of equivalent, stillborn and total
elements included in their GUI. For example, to test the number of mutants generated. Edroid generated a total of
Alarm Klock app, we select the notification layout file which 2035 mutants from the nineteen files tested using the fourteen
includes a good number of desired elements and can mutation operators. The number of Android mutants per file
potentially generate a large set of mutants. We ignore layout ranged from 7 mutants in the Android manifest file of Alarm
files such as slider, time_picker and range_bar that do not Klock to 1837 mutants in the XML file of the Calculator app.
include any of the desired GUI elements that our mutation

105

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.
TABLE II. Mutants generated

App Name File # Mutants # Equiv Mut # Stillborn


Calculator calculator.xml 1,837 1 14
Forecastie AndroidManifest.xml 9 0 2
Antenna Pod addfeed.xml 55 1 2
feedinfo.xml 30 3 6
AndroidManifest.xml 12 0 0
Alarm Klock notification.xml 39 3 6
AndroidManifest.xml 7 0 0
Tipster main.xml 46 0 6
Total 2,035 8 36

The Android manifest files for the Calculator and Tipster app widget version of the app. Since a widget is a simple
did not have any mutants generated therefore we did not application extension and is not an activity, it cannot be tested
include them in the table. Although the Calculator app by the Android monkey tool. On the other hand, some of the
consisted of only one file to be tested, our system generated mutants were killed using Adhoc testing and nearly all of
the largest set of mutants among the rest of the apps. This is them using black box testing. In order to achieve a 100%
because the Calculator GUI has a group of thirty-four mutation score for these mutation operators, it is necessary to
elements that includes buttons and text fields. test each service and broadcast receiver at least once.

To apply mutation testing and to obtain the mutation The GUI mutation operators were only applied in the
scores for the different testing techniques of every Android XML Layout files. These operators are divided in three
app we used a Macbook with 2.7 Ghz Intel i5 processor and categories: 1) ones that mutate a button such as BWI, BWA,
a Samsung Galaxy Tab 4. The average compilation time for BWX, BWP, BWD, BWS; 2) ones that mutate a text field
each mutant was around ten seconds. such as TWI and TWD; 3) ones that mutate a group of
elements such as VGT and VGI. Table III displays the
mutation operators of all GUI mutants: 26% for Random
C. Results and Discussion
testing, 65% for Adhoc testing and 100% for black-box
testing. Random testing performed poorly to reveal faults in
The results of our experiments are shown in Table III and the GUI and Adhoc testing made an acceptable performance.
Table IV. Table III summarizes the results obtained for each On the other hand, black-box testing reached a perfect
mutation operator among the five apps tested. Table IV shows mutation score. For this to occur, the tester needs to check for
the results generated for each Android app. the correct location, desired appearance and desired visibility
of every element in the GUI structure of the Android app.
The configuration operators were only applied to the
Android manifest files of three apps: Forecastie, Antenna Pod Table III shows a mutation score of 0% for the BWI, TWI,
and Alarm Klock. Seven of the fifteen APD mutants BWA and TWA operators using Random testing and Adhoc
generated were killed by the Android monkey tool. Two of testing. BWI and TWI operators mutate the visibility of an
the five APD mutants of Forecastie app were stillborn. This element such as removing it from the GUI but leaving the
is due to the fact that Forecastie requested two permissions space it occupies. BWA and TWA operators mutate the
for its initialization (Internet, and access_network_state). The appearance of an element such as the change of its color. The
APD mutant that deleted the BOOT_COMPLETED 0% mutation score is due to the fact that Random testing and
permission was killed in all three testing approaches. This Adhoc testing approaches do not check for the desired
means that for Android apps, it is always necessary to receive visibility and desired appearance of an element in the GUI. In
notifications of the Android Device system, such as the Wi- contrast, black-box testing examines the desired visibility and
Fi has been disconnected. Table III shows the mutation score appearance of an element in the GUI at least once, leading to
of all configuration operators: 27% for Random testing, 38% a perfect mutation score for these operators. Table IV shows
for Adhoc testing and 73% for Black Box testing. For this the total mutation score of all the applications tested: 21% for
study, the mutation score is calculated by the formula: D / (N- random testing, 56% for Adhoc testing and 99% for black-
E-S), where D is the number of mutants killed, N is the total box testing. All XML layout files have a mutation score of
number of mutants, E is the number of equivalent mutants 100% using black-box testing and the configuration files have
and S is the count of stillborn mutants. It can be seen from an overall better performance using this testing approach. In
Table IV that none of the SFC and RFC mutants were killed addition, it can be seen from Table IV that Adhoc testing
using Android monkey tool. We believe the reason for this is outperformed Random testing in revealing faults in all the
that most of the receivers and services communicate with the files of the five applications.

106

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.
TABLE III. Results of each mutation operator

Random Adhoc Black-Box


Testing Testing Testing
Operator Total Equivalent Stillborn Killed MS Killed MS Killed MS
Mutants Mutants Mutants Mutants Mutants Mutants
Configuration Operators
APD 15 0 2 7 0.54 8 0.62 10 0.76
SFC 3 0 0 0 0 1 0.33 2 0.66
RFC 10 0 0 0 0 1 0.10 7 0.70
TOTAL 28 0 2 7 0.27 10 0.38 19 0.73
GUI Operators
BWI 46 0 0 0 0 0 0 46 1
TWI 8 0 0 0 0 0 0 8 1
VGI 15 0 0 3 0.20 6 0.40 15 1
VGT 90 8 34 17 0.35 29 0.60 48 1
BWA 46 0 0 0 0 0 0 46 1
TWA 8 0 0 0 0 0 0 8 1
BWX 580 0 0 155 0.27 388 0.67 580 1
BWP 580 0 0 173 0.30 426 0.73 580 1
BWD 46 0 0 12 0.26 31 0.67 46 1
BWS 580 0 0 148 0.25 409 0.70 580 1
TWD 8 0 0 5 0.62 6 0.75 8 1
TOTAL 2007 8 34 513 0.26 1295 0.65 1965 1
TABLE IV. Results of each testing approach

Total Random AdHoc Black-Box


Mutants Testing Testing Testing
App Name File Killed MS Killed MS Killed MS
Mutants Mutants Mutants
Calculator calculator.xml 1837 387 0.21 1021 0.56 1822 1
Forecastie AndroidManifest.xml 9 2 0.28 3 0.42 6 0.86
Antenna addfeed.xml 55 4 0.08 29 0.55 52 1
Pod feedinfo.xml 30 4 0.19 12 0.57 21 1
AndroidManifest.xml 12 4 0.33 4 0.33 9 0.75
Alarm notification.xml 39 5 0.17 16 0.53 30 1
Klock AndroidManifest.xml 7 1 0.14 3 0.42 5 0.71
Tipster main.xml 46 9 0.22 27 0.675 40 1
TOTAL 2035 416 0.21 1115 0.56 1985 0.99

code and configuration files. Therefore, Edroid makes this


VI. CONCLUSIONS process feasible and can ease and accelerate the mutation
We proposed in this work Edroid. A set of fourteen testing process.
Android mutation operators, of which ten were newly
introduced. These operators modified the functionality, the We applied mutation testing on five real world Android
GUI and the configuration of Android apps. The generated apps. The results showed the effectiveness of our proposed
mutants were designed with a central goal of improving the mutation technique in evaluating a set of the tests cases. We
quality of Android application development through a found out that all three testing techniques need more test
rigorous evaluation of the test cases used. The focus was on cases to improve mutation coverage. It was revealed that the
mutating the GUI and XML schemas of an app. Android mutants proposed can be killed using test cases that: check
mutation testing is an exhaustive process and can become the expected output of each element in the screen at least
complex when testing larger apps with more files, lines of once, check if the elements are shown, check the correct

107

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.
location of each element, check for the desired appearance of [12] A. Avancini and M. Ceccato, "Security testing of the communication
among Android applications," Automation of Software Test (AST),
every element, check the functionality of each service and 2013 8th International Workshop on, San Francisco, CA, 2013, pp. 57-
broadcast receiver at least once. 63.
[13] Jian Bing Li and J. Miller, "Testing the semantics of W3C XML
On the other hand, it was revealed that Random testing with schema," 29th Annual International Computer Software and
Android monkey tool was not as effective to reveal faults on Applications Conference (COMPSAC'05), 2005, pp. 443-448 Vol. 2.
Android apps GUI or its configuration. However, Adhoc [14] L. Franzotte and S. R. Vergilio, “Applying Mutation Testing in XML
Schemas,” in SEKE, 2006, pp. 511–516
testing could be effective to reveal certain faults in the
[15] E. Alegroth, Z. Gao, R. Oliveira and A. Memon, "Conceptualization
functionality of the app if the user tested the proper and Evaluation of Component-Based Testing Unified with Visual GUI
combinations of buttons. It was revealed that Random testing Testing: An Empirical Study," 2015 IEEE 8th International Conference
had the lowest percentage of mutation score among all the on Software Testing, Verification and Validation (ICST), Graz, 2015,
testing approaches applied. Furthermore, it was shown that pp. 1-10.
black-box testing had a perfect mutation score for all GUI [16] R. A. P. Oliveira, E. Alégroth, Z. Gao and A. Memon, "Definition and
evaluation of mutation operators for GUI-level mutation analysis,"
mutation operators. Software Testing, Verification and Validation Workshops (ICSTW),
2015 IEEE Eighth International Conference on, Graz, 2015, pp. 1-10.
For future work, we intend to diminish some of the [17] I. M. Alsmadi, "Using Mutation to Enhance GUI Testing Coverage,"
Edroid’s limitations by designing a new module that accepts in IEEE Software, vol. 30, no. 1, pp. 67-73, Jan.-Feb. 2013.
test cases as input from the user; and allows the user to [18] Android developers guide, https://developer.android.com/studio/test/
espresso-test-recorder.html, last access February 2016.
execute the test cases on mutants to determine the mutation
[19] JUnit. Last access Februrary 2017. http://junit.org/junit5/
score. We also propose to extend Edroid to include traditional
[20] Robotium, https://github.com/RobotiumTech/robotium, last access
Java mutation operators and new Android mutation operators. February 2017.
Furthermore, we realize that additional Android mutation [21] A. T. Acree, T. A. Budd, R. A. DeMillo, R. J. Lipton, and F. G.
operators are needed to achieve a better accurate result for Sayward. Mutation analysis. Technical report GIT-ICS-79/08, School
testing the quality of an android app. We intend to add of Information and Computer Science, Georgia Institute of
mutation operators that can mutate exclusive features of the Technology, Atlanta GA, September 1979.
mobile device such as the orientation and GUI elements that [22] D. M. S. Andre. Pilot mutation system (PIMS) user's manual. Technical
report GIT-ICS-79/04, Georgia Institute of Technology, April 1979.
were not targeted by this study such as checkboxes and radio-
[23] B. N. Nguyen, B. Robbins, I. Banerjee, and A. Memon, “Guitar: an
buttons. In addition, we plan to evaluate Edroid on more innovative tool for automated testing of gui-driven software,”
testing strategies. Automated Software Engineering, vol. 21, no. 1, pp. 65–105, 2014
[24] Projects Overview. Last access February 2017.
VII. REFERENCES https://developer.android.com/studio/projects/index.html
[1] R. Lipton, “Fault diagnosis of computer programs,” Student Report, [25] Android App Manifest, 2017. Last access February 2017.
Carnegie Mellon University,1971. https://developer.android.com/guide/topics/manifest/manifest-
[2] J. C. Maldonado, M. E. Delam\aro, S. C. Fabbri, A. da Silva Simao, T. intro.html
Sugeta, A. M. R. Vincenzi, and P. C. Masiero. Proteum: A family of [26] Android – UI Layouts. Last access February 2017.
tools to support specification and program testing based on mutation. https://www.tutorialspoint.com/android/android_user_interface_layou
In Mutation testing for the new century. 2001. ts.html
[3] Konrad Halas, “Mutpy 0.4.0 mutation testing tool for python 3.x,” [27] Calculator for Android app. Last access December 2016.
https://pypi.python.org/pypi/MutPy/0.4.0, last access Feb 2017 https://github.com/CMDann/Simple-Android-Calculator
[4] M. Schirp, “Mutation testing tool for Ruby,” Online, 2012, [28] Forecastie Weather app. Last access December 2016.
https://github.com/mbj/mutant, last access Feb 2017. https://github.com/martykan/forecastie
[5] Y.-S. Ma, A.J. Offutt, Y.-R. Kwon, "MuJava: An Automated Class [29] Antenna Pod app. Last access December 2016.
Mutation System", Software Testing Verification and Reliability, vol. https://github.com/AntennaPod/AntennaPod
15, no. 2, pp. 97-133, June 2005. [30] Alarm Klock app. Last access December 2016.
[6] Ovum: App Revenue to Double by 2020, Outpacing Download https://github.com/kraigs-
Growth, 2016, https://www.ovum.com/press_releases/ovum-app- android/kraigsandroid/tree/master/android/alarmclock
revenue-to-double-by-2020-outpacing-download-growth/, last access [31] Tipster app. Last access December 2016.
September 2016. https://github.com/IanDarwin/Android-Cookbook-
[7] Agile Methodology in Mobile Application Development, 2017, Examples/tree/master/Tipster
https://project-management.com/agile-methodology-in-mobile- [32] Kevin Moran, Michele Tufano, Carlos Bernal-Cárdenas, Mario
application-development/, last access February 2017 Linares-Vásquez, Gabriele Bavota, Christopher Vendome,
[8] Google Play stats, http://www.appbrain.com/stats last access Massimiliano DiPenta, and Denys Poshyvanyk, “MDroid+: A
September 2016. Mutation Testing Framework for Android”, in Proceedings of the 40th
[9] Testing Support Library. https://developer.android.com/topic/ IEEE/ACM International Conference on Software Engineering
libraries/testing-support-library/index.html, last access December (ICSE'18), Formal Research Demonstrations Track, Gothenburg,
2016 Sweden, May 27-June 3, 2018
[10] Y.-S. Ma, J. Offutt, " Description of muJava’s Method-level Mutation [33] M. Linares-Vásquez, G. Bavota, M. Tufano, K. Moran, M. Di Penta,
Operators", November 2005, https://cs.gmu.edu/~offutt/mujava/ C. Vendome, C. Bernal-Cárdenas, and D. Poshyvanyk, “Enabling
mutopsMethod.pdf. mutation testing for android apps,” in Proceedings of the 2017 11th
Joint Meeting on Foundations of Software Engineering, ser. ESEC/FSE
[11] L. Deng, N. Mirzaei, P. Ammann, and J. Offutt, “Mutation operators 2017. New York, NY, USA: ACM, 2017, pp. 233–244. [Online].
for testing Android apps”, Information and Software Technology, 81, Available: http://doi.acm.org/10.1145/3106237.3106275
pp.154-168, January 2017.

108

Authorized licensed use limited to: University of the Cumberlands. Downloaded on August 09,2021 at 17:58:15 UTC from IEEE Xplore. Restrictions apply.

You might also like