<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Industrial Adoption of Automatically Extracted GUI Models for Testing</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Pekka Aho</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>pekka.aho@vtt.fi</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Matias Suarez</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>matias.suarez@f-secure.com</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Teemu Kanstren</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>teemu.kanstren@vtt.fi</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Atif M. Memon</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>atif@cs.umd.edu</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>F-Secure Ltd</institution>
          ,
          <addr-line>Helsinki</addr-line>
          ,
          <country country="FI">Finland</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Maryland</institution>
          ,
          <addr-line>College Park, MD</addr-line>
          ,
          <country country="US">USA</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>University of Toronto</institution>
          ,
          <addr-line>Toronto</addr-line>
          ,
          <country country="CA">Canada</country>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>VTT Technical Research Centre of Finland</institution>
          ,
          <addr-line>Oulu</addr-line>
          ,
          <country country="FI">Finland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Crafting the models for e ective model-based testing (MBT) requires deep understanding of the problem domain and expertise on formal modeling, and creating the models manually from the scratch requires a signi cant amount of e ort. When an existing system is being modeled and tested, there are various techniques to automate the process of producing the models based on the implementation. Especially graphical user interface (GUI) applications have been a good domain for reverse engineering and speci cation mining approaches, but the existing academic approaches have limitations and restrictions on the GUI applications that can be modeled, and none of them have been adopted by the industry for testing commercial software. Although using implementation based models in testing has restrictions and requires special consideration, the generated models can be used in automated testing and supporting various manual testing actions. In this paper we introduce an industrial approach and platform-independent Murphy tool set for automatically extracting state models for testing GUI applications.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Model-based testing (MBT) is a technique of generating test cases from
behavioral models of the system under test (SUT). The idea is to provide more
coste ective means for extensive testing of complex systems. Instead of manually
writing a large set of test cases, a smaller set of test models are built to describe
generally the behavior of the SUT and how it should be tested. A test generator
tool is then used to automatically generate test cases from these models. There
are several bene ts, including easier test maintenance due to fewer artifacts to
update, higher test coverage from the generated test cases, and documenting
the SUT behavior in higher level models which helps in sharing the
information and understanding the system [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. However, crafting the models requires
a great deal of expertise in formal modeling and a deep understanding of the
problem domain. Constructing the models manually from the scratch requires
also a signi cant amount of e ort [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>
        There are several approaches aiming to reduce the time required for
designing the test models for MBT by automating some parts of the modeling process,
such as creating models through reverse engineering or speci cation mining.
Especially in the area of graphical user interface (GUI) software, there are
promising academic approaches to automatically construct models based on observing
an existing application and using the models for testing purposes, such as [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]
[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Unfortunately most of these approaches have limitations and restrictions
on the GUI applications that can be modeled, and so far none of them have been
adopted by the industry to test commercial software products.
      </p>
      <p>As the generated models are based on the behavior of the observed
implementation, instead of the speci cations or expected behavior, it is challenging
to automatically generate meaningful test oracles. In most of the dynamic GUI
reverse engineering approaches for testing, the test oracle is based on the
observed behavior of an earlier version of the GUI application. Using this kind of
test oracle, changes and inconsistent behavior of the GUI can be detected, but
validation and veri cation against the speci cations is problematic. Although
using implementation based models in testing has restrictions and requires
special consideration, the generated models can be used in automated testing and
supporting various manual testing actions.</p>
      <p>In this paper we introduce a platform-independent industrial approach and
Murphy tool set for automatically extracting nite state machine (FSM) based
models for testing GUI applications. The approach is based on observation and
analysis of the GUI during automated interaction and execution of the
application.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Background and Related Work</title>
      <p>
        There are a few approaches using static analysis of the source code for
automatically constructing models of the GUI software, such as [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], but the dynamic
approaches that involve executing the GUI application and observing the
application during the run-time are better suited for extracting the behavior of GUI
applications [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>
        Grilo et al. [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] describe a dynamic approach for reverse engineering GUI
applications using a combination of manual and automated steps in the modeling
process. The tool uses Microsoft UI automation library for the automated steps
and the created model has to be manually validated and completed with the
expected behavior. The nal models are in Spec# format and can be used for
model-based GUI testing (MBGT).
      </p>
      <p>
        Memon et al. [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] have extensively published their research on GUI Ripping,
a technique for dynamically reverse engineering models of GUI applications for
test automation purposes. Memons team has implemented GUITAR tool set,
a model-based system for automated GUI testing, to execute and observe Java
GUI applications to generate models for MBGT. The main target of GUITAR
tool set has been Java desktop applications, but it can also be used to model
other GUI applications, such as web and android applications, to some extent.
      </p>
      <p>
        Miao et al. [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] propose a nite-state machine (FSM) based GUI Test
Automation Model (GUITAM). In GUITAM, a state of the GUI is modeled as
a set of opened windows, GUI objects (widgets) of each window, properties of
each object, and values of the properties. Events or GUI actions performed on
the GUI may lead to state transitions and a transition in GUITAM is modeled
with the starting state, the event or GUI action performed, and the resulting
state. To reduce the amount of states into computationally feasible level, not
all di erent property values are considered for distinguishing di erent states of
GUITAM. The authors provide only a short introduction of the tool for
automatically constructing the models and the tool is not publicly available.
      </p>
      <p>
        Aho et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] present GUI Driver, a dynamic reverse engineering tool for Java
GUI applications. In [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] the authors introduce an iterative process of manually
providing the valid input values into the GUI application and automatically
improving the created models. They highlight the importance of increasing the
level of GUI automation in order to include all parts of the GUI application in
the created models. Unfortunately the tool is currently restricted to Java based
GUI applications only.
      </p>
      <p>
        GUITAR, GUI Driver and GUITAM model a GUI window in the same way:
A window consists of widgets, properties of the widgets, and values of the
properties. GUITAM and GUI Driver use a similar FSM-based GUI state model where
the nodes are states of the GUI and the edges are user actions that trigger
transitions between the states. In event ow graph (EFG) [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] or event interaction
graph (EIG) [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], created by the GUITAR tool set, the nodes of the model are
events or user actions, and the edges capture the ow of the GUI events.
      </p>
      <p>
        Amal tano et al. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] have researched automated modeling and testing of
Android applications. The approach is based on a tool that explores the application
GUI by simulating real user events on the user interface and reconstructs a GUI
tree model. The nodes of the tree represent individual user interfaces in the
Android application, while edges describe event-based transitions between
interfaces. The GUI exploration technique supports the automatic derivation of test
cases that can be executed both in crash testing and regression testing processes.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Automated Extraction of GUI Models for Testing</title>
      <p>F-Secure Ltd is a software company from Finland having both client and server
side products related to safety and security, such as virus protection, including
applications with GUI for the end users. F-Secure have developed a tool set
called Murphy for automatically extracting models of GUI applications from
the user interface (UI) ow, and using the created models for GUI testing.</p>
      <p>Murphy dynamically analyses the GUI while automatically interacting with
the application, as if it were an end user trying out all the possible user
interactions, such as entering text in a text eld, pressing a button or a link, selecting
items or ticking checkboxes. The main idea is to traverse through all the possible
states of the GUI application and automatically construct a nite state machine
(FSM) based model of the observed behavior during the execution, or as we call
it, crawling the GUI.</p>
      <p>The goal of the Murphy tool is not to nd all the possible paths to reach a
speci c node, but to discover as many nodes as possible. The reason for this is
that the GUI applications tend to have a very large number of paths between
the nodes, making it impractical to try to reach a speci c node again through
a di erent path. Instead, with an appropriate level of abstraction, covering all
the states of the GUI is more practical approach. However, it is possible to
customize the scripts of Murphy tool to contemplate special cases, for example
if the models are meant to be used for testing all the possible transitions between
speci c states.</p>
      <p>To accomplish platform independency, Murphy uses various approaches called
drivers for recognizing elements and windows of the GUI application. Among the
already implemented drivers, one uses Windows APIs for UI element detection
and enumeration, another uses a proprietary API developed by F-Secure for
enumerating and querying windows and elements of the UI, and a third driver
simulates the end user by cycling through the UI elements by pressing the 'tab'
key and analyzing the changes in the screen to determine the elements and
behavior of the GUI. The idea is to compare automatically taken screenshots to
nd the changing areas, such as the bounding rectangle of the selected element
on the screen and the shape of the mouse cursor, and reason the structure and
behavior of the GUI based on the clues that the GUI application o ers for the
end user.</p>
      <p>
        Internally Murphy creates a directed graph to model the behavior of the GUI
application. The nodes of the model are states of the GUI screen or window, and
the edges are actions that the end user could perform in that speci c state of
the GUI, in a similar way as in [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] and [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. An edge of the model could be
for example pressing an OK button, selecting a speci c item in a drop down
box, or entering a prede ned value in a text eld. A node of the model, i.e. the
state of a GUI application, is de ned mainly by its appearance, excluding data
values, such as texts in the text elds, selected values of drop down boxes or
status of check boxes. In other words, a dialog that has an OK button enabled
represents a di erent node than otherwise similar dialog with the OK button
disabled, but a dialog would represent the same node regardless of the value in
a text eld of the dialog. During the UI crawling, screenshots of the GUI are
automatically captured after each interaction, and they are used for visualization
of the resulting graph; a picture of the GUI in that speci c state is presenting
the node in the graphical presentation of the model. The images are also used
by one of the drivers for detecting changes in the UI and the interactions that
are available for the end user.
      </p>
      <p>Murphy provides generic UI crawling and window scrapping services as a
library. The process of extracting the model is mostly automated and fully
customizable, and Murphy provides hooks and callbacks for such customizations.
The script that is used for invoking the generic UI crawling library can be
modi ed with application speci c rules, but often the generic UI crawler library is
su cient for generating the models. For simple GUI applications, the invocation
script will merely setup the initial state, such as start up the application to be
modeled, and then invoke the generic UI crawler library. For more complex GUI
applications, application speci c modi cations can be used for adjusting or
correcting the behavior of the generic UI crawler library, for example adding extra
edges to a node when all interactions were not properly recognized, instructing
the crawler of the values to be used in certain text elds, removing edges from a
node, or instructing the crawler not to visit speci c edges of the speci ed nodes.
For example, in a dialog for selecting the language for the installation of an
application, the invocation script could be modi ed to instruct the UI crawler library
to crawl only the English version of the UI ow. The model extraction would
have de ned the edge for selecting the installation language into the model, but
the UI crawler would ignore it and select English.</p>
      <p>In order to limit the scope of the UI crawler into the areas of interest,
Murphy has the notion of boundary nodes. Boundary nodes are used for marking
the nodes that Murphy should not go beyond during the UI crawling, for
example when the GUI application launches a web browser and opens a web page,
or when it is not feasible to crawl through the whole help system of the GUI
application. Boundary nodes are manually speci ed into the invocation script.
In our experience, it was also useful to add edges representing special actions
with environment considerations, for example performing certain UI action when
access to the network is not available, or when running low on memory. These
special edges have to be manually inserted into the invocation script but in some
cases they enriched the resulting model in useful ways.</p>
      <p>The Murphy tool has been able to satisfactory extract most parts of the
UI ow of the GUI applications of F-Secure with very little user intervention.
The invocation scripts were usually between 10 and 200 lines of Python code
and produced models capable of exercising in the range of 80% of the possible
UI ows. It is important to notice, that most of the GUI applications used in
experimenting the approach and Murphy tool set were ow based applications
having a relatively low amount of the possible values that the end user may use
as input into the system.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Discussion and Conclusion</title>
      <p>In this paper we have introduced an approach and Murphy tool set for
automatically extracting GUI models that can be used in testing GUI applications.
Compared to the related approaches, the main advantage of Murphy tool set is
that it does not restrict the modeled GUI application to a speci c programming
language or execution platform. To accomplish platform independency, Murphy
uses various approaches called drivers for recognizing elements and windows of
the di erent types of the modeled GUI applications.</p>
      <p>We have promising preliminary experiences on using the generated models
for testing commercial software products in industrial testing environment. It
seems that using the automatically generated models for automating the GUI
testing would reduce the amount of hand written code related to GUI testing
compared to manually written test scripts, which reduces the maintenance e ort
related to test code. Also, with the help of Murphy tool set, it is possible to use
the models to support and reduce the e ort required for manual GUI testing.</p>
      <p>So far, we have used the approach and Murphy tool set only on desktop
and web applications, but in future we plan to use the approach also on mobile
applications.</p>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgment</title>
      <p>This work was partially supported by grant number CNS-1205501 by the US
National Science Foundation, and a part of ITEA2/ATAC project funded by
the Finnish Funding Agency for Technology and Innovation TEKES.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>M.</given-names>
            <surname>Utting</surname>
          </string-name>
          , and
          <string-name>
            <given-names>B.</given-names>
            <surname>Legeard</surname>
          </string-name>
          ,
          <article-title>Practical Model-Based Testing: A Tool Approach</article-title>
          , Morgan Kaufmann Publishers Inc, San Francisco, CA, USA,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>A.M.P. Grilo</surname>
            ,
            <given-names>A.C.R.</given-names>
          </string-name>
          <string-name>
            <surname>Paiva</surname>
            , and
            <given-names>J.P.</given-names>
          </string-name>
          <string-name>
            <surname>Faria</surname>
          </string-name>
          <article-title>Reverse Engineering of GUI Models for Testing</article-title>
          ,
          <source>5th Iberian Conference on Information Systems and Technologies (CISTI)</source>
          , Santiago de Compostela, Spain,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>P.</given-names>
            <surname>Aho</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Menz</surname>
          </string-name>
          , and
          <string-name>
            <given-names>T.</given-names>
            <surname>Raty</surname>
          </string-name>
          ,
          <article-title>Enhancing generated Java GUI models with valid test data</article-title>
          ,
          <source>2011 IEEE Conference on Open Systems (ICOS</source>
          <year>2011</year>
          ),
          <fpage>25</fpage>
          -
          <lpage>28</lpage>
          Sep 2011, Langawi, Malaysia.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>A. M. Memon</surname>
          </string-name>
          <article-title>An event- ow model of GUI-based applications for testing</article-title>
          ,
          <source>Software Testing, Veri cation and Reliability</source>
          , Volume
          <volume>17</volume>
          , Issue 3 (
          <year>Sep 2007</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Y.</given-names>
            <surname>Miao</surname>
          </string-name>
          , and
          <string-name>
            <surname>X. Yang</surname>
          </string-name>
          <article-title>An FSM based GUI Test Automation Model</article-title>
          ,
          <source>11th Int. Conf. Control, Automation, Robotics and Vision Singapore</source>
          ,
          <fpage>7</fpage>
          -
          <lpage>10th</lpage>
          Dec
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>D.</surname>
          </string-name>
          <article-title>Amal tano,</article-title>
          <string-name>
            <given-names>A. R.</given-names>
            <surname>Fasolino</surname>
          </string-name>
          and
          <string-name>
            <given-names>P.</given-names>
            <surname>Tramontana</surname>
          </string-name>
          <article-title>A GUI Crawling-Based Technique for Android Mobile Application Testing, 3rd Int</article-title>
          . Workshop on Testing Techniques &amp;
          <article-title>Experimentation Benchmarks for Event-Driven Software</article-title>
          , IEEE CS Press,
          <year>2011</year>
          , pp.
          <fpage>252</fpage>
          -
          <lpage>261</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>J.C.</given-names>
            <surname>Silva</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Silva</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.D.</given-names>
            <surname>Gonalo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Saraiva</surname>
          </string-name>
          , and J.
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Campos The GUISurfer tool: towards a language independent approach to reverse engineering GUI code</article-title>
          ,
          <source>Proc. 2nd ACM SIGCHI symposium on Engineering interactive computing systems</source>
          , Berlin,
          <year>2010</year>
          , Germany, pp.
          <fpage>181</fpage>
          -
          <lpage>186</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>A. M. Memon</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          <article-title>Banerjee, and</article-title>
          <string-name>
            <surname>A. Nagarajan</surname>
          </string-name>
          <article-title>GUI ripping: reverse engineering of graphical user interfaces for testing</article-title>
          ,
          <source>Proc. 10th Working Conference on Reverse Engineering (WCRE'03)</source>
          . IEEE Comp Society, Washington DC, USA.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>P.</given-names>
            <surname>Aho</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Menz</surname>
          </string-name>
          ,
          <source>T. Raty, and I. Schieferdecker Automated Java GUI Modeling for Model-Based Testing Purposes, 8th Int. Conf. on Information Technology : New Generations (ITNG2011)</source>
          ,
          <source>April 11-13</source>
          ,
          <year>2011</year>
          ,
          <string-name>
            <given-names>Las</given-names>
            <surname>Vegas</surname>
          </string-name>
          , Nevada, USA.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <given-names>Q.</given-names>
            <surname>Xie</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A. M.</given-names>
            <surname>Memon</surname>
          </string-name>
          <article-title>Rapid crash testing for continuously evolving GUIbased software applications</article-title>
          ,
          <source>Proc. 21st IEEE Int. Conf. on Software Maintenance (ICSM'05)</source>
          , IEEE Computer Society, Washington DC, USA,
          <fpage>473</fpage>
          -
          <lpage>482</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>