18th June 2010
Reverse Engineering of GUI Models for Testing
André M. P. Grilo, Ana C. R. Paiva, João Pascoal Faria
CISTI 2010
18th June 2010
Contents
Introduction
Reverse Engineering Approaches
Reverse Engineering and Testing Process
REGUI Tool
Case Study
Conclusions
CISTI 2010
18th June 2010
Motivation
CISTI 2010
18th June 2010
Context
CISTI 2010
AMBER iTest
Visual modellin
g
Coverage informatio
n
UML visual model
Test coverag
e analysis
new Spec Explorer
Test casegeneratio
n
Visual to formal model
translation new
m()prepost
{body}
Test suite
(abstract)
Test results
Test Executio
n Spec Explorer
GUI mapping
code & data (adapter)
GUI Applicatio
nUnder Test
........
......
...
Model to implementatio
n mapping
oracle
Reverse Engineering
new
REGUI Tool
18th June 2010
Objectives
CISTI 2010
Diminish effort required to construct the model
Automate the interactive exploratory process
Extract: Structural Information Navigation Steps Behaviour
Produce a Spec# Model
18th June 2010
Static Approach Dynamic Approach
CISTI 2010
Reverse Engineering Approaches
18th June 2010
Reverse Engineering and Testing Process
CISTI 2010
18th June 2010CISTI 2010
Description of the Algorithm (1/2)
Phase One
18th June 2010CISTI 2010
Description of the Algorithm (2/2)
Phase Two
18th June 2010CISTI 2010
Description of the Algorithm (3/3)
Phase Three
18th June 2010
REGUI Tool
CISTI 2010
18th June 2010
Structural Information
CISTI 2010
<?xml version="1.0" encoding="utf-8" ?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<window>
<name>Find</name>
<AutomationID />
<ControlType>Dialog</ControlType>
<L_Controls>
...
<Control>
<name>Find Next</name>
<AutomationID>1</AutomationID>
<ControlType>button</ControlType>
</Control>
<Control>
<name>Find what:</name>
<AutomationID>1152</AutomationID>
<ControlType>edit</ControlType>
</Control>
...
</L_Controls>
</window>
18th June 2010
Navigational Steps
CISTI 2010
<navigation>
<Nav1>
<source>Notepad</source>
<destination>Find</destination>
<steps>
<Nsteps>6</Nsteps>
<0>setText document = "aaa"</0>
<1>FocusChange Edit</1>
<2>Mouse Click</2>
<3>FocusChange Find</3>
<4>Mouse Click</4>
<5>FocusChange FindWhat</5>
</steps>
</Nav1>
...
</navigation>
</application>
18th June 2010
Inferring Dependencies
CISTI 2010
<dependency>
<dep1>
<window>Find What</window>
<source>textbox Find what:</source>
<destination>button Find Next</destination>
<action>setText(“a”, Find What)</action>
<property>FindNext.IsEnabled = true</property>
</dep1>
...
</dependency>
18th June 2010
Spec# Model//Notepad window
[Action] void SetTextDocument(string typedText)
modifies Document.text && MenuItemFind.IsEnabled;
requires IsEnabled("Notepad");
{ //TODO}
[Action] void MenuItemFind()
requires text!="" && IsEnabled("Notepad") ;
ensures IsOpen("Find"));
{ //TODO}
…
//Find dialog
[Action] void SetTextFindWhat(string str)
modifies TextFindWhat.text && ButtonFindNext.IsEnabled;
requires IsEnabled("Find");{
TextFindWhat.text = str;
}
[Action] void FindNext()
requires IsEnabled("Find");
{ //TODO}
…
CISTI 2010
18th June 2010CISTI 2010
Conclusions
Presented a new technique to obtain a model of the GUI’s structure and some of its behaviour.
Model kept in a XML file Spec#
The reverse engineering process combines automatic with manual exploration
which solves some of the “blocking problems” found in the approaches
Using the REGUI tool, the effort in the construction of the GUI model was reduced
18th June 2010
Main Contributions
A New Reverse Engineering Approach
A REGUI Tool
CISTI 2010
18th June 2010
Future Work
Implement new algorithms to extend the set of dependencies among GUI objects found automatically by the tool;
We also intend to validate the approach with more complex software applications.
CISTI 2010
18th June 2010CISTI 2010
18th June 2010
Thanks for your time
CISTI 2010