Part 1: The Behaviour-Event Test Generator (BETG)
1. BETG Overview
Behaviour-Event Test Generator (BETG)
is a prototype GUI testing tool which automatically generates test cases from
three inputs: a behaviour model, a GUI model, and a
mapping model. The behaviour model represents highlevel behaviour of the GUI
under test and can be built using external tools such as Spec Explorer. The GUI
model represents widgets of the GUI and their events and attributes. These two
models are connected by a mapping model which is written in a Behaviour-Event Mapping (BEFMAP) language. This language
allows testers to define how behaviour is mapped to
GUI event and attributes. We also introduce coverage criteria which specify how
various permutations of events are covered when generating test cases. BETG
aims to lead GUI testing to a behaviour-oriented
approach and save testing effort.
2. BETG Architecture
We develop the Behaviour-Event Test Generator (BETG), a test automation
tool, based on the framework proposed in this research project. BETG supports
following features:
-
Generate test cases from given BM, GM, and MM.
-
Allow testers to control test coverage by choosing coverage criteria.
-
Automate test execution.

Figure 1 BETG Architecture
-
BEFMAP Parser: this parser syntactically
analyses the MM and converts it into a syntax tree. The parser is built by ANother Tool for Language Recognition (ANTLR), a framework
for constructing compilers.
-
Model Matcher: this component checks
if the MM is consistent against the BM and the GM before test case
generation gets started. Model Matcher helps to avoid these inconsistencies.
-
Test Case Generator (TCG): this is
the core of BETG, where event-level test cases are generated based on the
behaviour-to-event mapping defined in the MM and the coverage criteria being
used. TCG supports 5 types of coverage criteria: First-OneLink-Coverage, Random-OneLink-Coverage,
All-Link-Coverage, N-Way Coverage, and Cartesian Coverage. The generation of N-Way test
cases is one of the most challenging tasks of TCG. There are several approaches
to calculate N-way combinations. Unfortunately, none of them can assure that
the generated test cases are the optimal ones. In most cases, the numbers of
test cases generated by these approaches are approximately equal. In TCG, we used the greedy
algorithm presented in the paper “The AETG system:
an approach to testing based on combinatorialdesign” by Cohen D. MM. et al.
Due to this algorithm, test cases are generated in a step-by-step manner. TCG
makes the locally optimal choice at each step and chooses the test case that
covers most uncovered pairs.
-
External Compiler: the external compiler
compiles the generated test cases and the test harness to build a test project.
Depending on what platform was used to develop the system under test, testers
would need to choose a suitable test harness and a compiler. For instance, if
the system under test is a .NET application, then a .NET test harness and a
.NET complier are needed to build the test project. Similarly, testing a Java
application would require a Java test harness and a Java compiler.
1. Download BETG demo
Download link: BETG_ToDoManagerDemo.zip
This download package
includes:
-
The tool (BETG).
-
A .NET test harness.
-
Sample test models for testing To Do
Manger.
Please read the Readme.doc
file in the download package to learn how to run the demo.
2. BETG user interface
BETG provides a simple user
interface in which user can specify the behavior model (also called the action
model), the GUI model, and the mapping model. Note that testers must create the
mapping model in advanced, outside the tool, using text editors such as NotePad. When testers generate test cases, the test
generation progress will be displayed in the Message window. After test cases
are generated, testers can also execute the generated test cases.

Figure 2 BETG screenshots
Part 2: The GUI
Test Generator (GTG)
3. GTG Overview
GTG is the successor of
BETG. Like BETG, GTG is also a tool which converts Spec Explorer test cases into GUI-level test cases. However, GTG offers the following new features.
-
GTG is able to import information
about GUI events and attributes of the GUI under test. GTG relies on Quick Test
Pro (QTP) to generate this information by reverse engineering the GUI under test.
-
GTG provides a drag-and-drop user
interface which allows testers to manipulate GUI events and attributes in the
mapping models in an intuitive manner.
-
GTG generates GUI-level test cases in the form of QTP scripts. In this way,
GUI test cases access the GUI under test via an automation library that QTP
offers.
-
Based on an action model, GTG is
capable of generating a skeleton of a mapping model. The skeleton includes
mapping function names and parameters. Testers will define mappings by filling
in the mapping function bodies.
4. GTG architecture
Figure 3 presents the architecture of GTG. GTG reuses the
parser of BETG but replaces the test generator of BETG with another test
generator which generates QTP test scripts instead of C# test scripts. GTG
also includes a mapping model editor, which allows testers to create and edit mapping models in an intuitive
manner.

Figure 3 The
architecture of GTG
5. GTG user interface
Figure 4 shows the Model Editor,
the user interface of GTG. The user interface consists of a Mapping Model
Window in the center, an Event Sequence Window and a Widget Window on the right-hand
side, and a Message Window at the bottom. The Mapping Model Window is a text
editor in which testers write mapping models. The Event Sequence Window shows a
list of event sequences recorded by QTP. Testers can drag event sequences from
this window and drop them into the Mapping Model Window. The Widget Window
shows a list of widgets reverse engineered from the SUT by QTP. Under each
widget are GUI attributes. Testers can drag the GUI attributes from this window
and drop them into the Mapping Model Window. The Message Window is where GTG
displays notifications and test reports to users. Before creating a mapping
model, testers must use QTP to record event sequences and GUI attributes in the
SUT and import the recorded information into the Event Sequence and the Widget
Windows. Testers also specify the action model that is used to create the
mapping model skeleton. Once testers specify the action model, GTG generates a
skeleton of the mapping model which consists of mapping function names and
parameters. Testers have to define the mappings in the bodies of the mapping
functions. Once testers complete the
mapping model, they can initialise the test case
generation process. GTG asks testers to provide action test cases as an input
to the generation process. Testers provide action test cases in the form of an XML file as
mentioned above. Testers also specify the coverage criteria. After that, GTG generates the GUI test cases.

Figure 4 The user
interface of GTG
6. Download GTG demo
Download link: GTG_WordPadDemo.zip
This download package
includes:
-
The tool (GTG).
-
Sample test models for testing MS
WordPad.
Please read the Readme.doc
file in the download package to learn how to run the demo.
