![](bg2.png)
2 RELATED WORK
One the main difficulties in software testing research
and which, according to (Bertolino, 2007), consti-
tutes an important obstacle to any advance in its
automation, is the description of the oracle, which is
the mechanism provided to each test case to deter-
mine, after its execution, whether the system under
test passes or fails the test.
(Baresi and Young, 2001) present a wide state of
the art with respect to the oracle problem. Most of
the proposals they analyze consist of the insertion of
instructions in programs which perform any kind of
checking or use formal descriptions of the programs.
However, their writing and maintenance may be so
complex as the writing and maintenance of the self
program.
In her roadmap about testing research, (Harrold,
2000) suggests the use of “precode artefacts”, such
as design or requirements documents, architectural
specifications, state machines etc., a quite stimulat-
ing approach in the context of SPL. In this respect,
several authors have proposed strategies to obtain
test cases from different types of diagrams as
(Basanieri et al., 2002, Offutt et al., 2003)
In (Bertolino et al., 2004) the use cases are
adapted to SPL and the test cases are derived manu-
ally from these. In (Olimpiew and Gomaa, 2006)
test models are created from use cases using activity
diagrams, decision tables and test templates. Related
to test case derivation from sequence diagrams in
SPL, in (Nebut et al., 2003) is proposed a method in
which behavioural test patterns (behTP) are obtained
from high-level sequences which are used to auto-
matically generate test cases specific to each prod-
uct.
In general, the goal of deriving test scenarios and
test cases from state machines, interaction diagrams,
etc. has been significantly researched over the last
years, and important results have been obtained.
However there is a lack of advances in the treatment
of the oracle.
As with some of the reviewed works, our pro-
posal makes it possible to obtain test cases from
interaction diagrams, both at domain and product
engineering. A significant contribution of this work
is the possibility of generating concrete oracles (for
specific products of the line) from some annotations
introduced in the sequence diagrams.
3 DESIGN OF THE PRODUCT
LINE
Following some ideas of the authors mentioned in
the previous section, the product line design starts
with use cases (to represent and describe the re-
quirements) and sequence diagrams (to represent the
scenarios of the use cases). Additionally, sequence
diagrams are annotated with a description of the
states that the instances involved in the diagram
must reach during execution. State descriptions
(which may or may not come from state machines)
will be used later to deal with oracles.
A single example will be used to illustrate the
product line building method and the test case gen-
eration strategy. Later, in Section 0, the metamodels
used to represent the artefacts and the algorithms
applied to execute the transformations will be pre-
sented.
3.1 Use Case Design in a SPL
Let us suppose we need to build a product line to
play different Board games (Trivial, Chess, Ludo,
etc.) with a computer. There will be a games server
which will receive client connections, each one op-
erated by a human player, which takes the game
decisions he/she considers. According to the de-
scription, there exist two systems in this product
line: the client applications (which are communi-
cated with the human player) and the server system
(which interacts with the clients).
For each use case, the classes involved in its
execution are identified and categorized (bounda-
ries, controllers and entities). In this example, one of
the server use cases is Piece movement, which is
executed when the client sends a piece movement to
the server. In order to keep the example simplified,
we assume that two classes are sufficient to manage
this use case: “Game” (an entity class) and “Con-
trol” (an use case controller). As with other devel-
opment methodologies, a textual description of use
cases is given in a template.
Although use cases are not directly used to gen-
erate test cases, work in product lines imposes the
joint and rigorous management of traceability and
variability.
In this respect, several proposals exist to deal
with variability during development, such as (Berto-
lino et al., 2004), who describe the PLUCs (Product
Line Use Cases) that hold the traditional information
of use cases plus the variability to be supported by
the described functionality. They use the labels Al-
AUTOMATIC GENERATION OF TEST CASES IN SOFTWARE PRODUCT LINES
125