• Every object could have some properties (e.g., lo-
cation). Properties can be modelled using Data
properties or Object properties, that are base ele-
ments in an ontology TBox model.
• Dynamic changes in the environment should also
be modelled using this ontology. We included this
dynamic aspect in the context ontology by defin-
ing the concept of changes with regard to objects
(i.e., an object appears, disappears), their proper-
ties (e.g., a property changes) and relations. Us-
ing these concepts a dynamic context can be de-
scribed.
We also defined context patterns. Each context
pattern represents a fragment of a context model as a
specific arrangement of elements within the context.
These patterns are originated from the specification
(use cases) of the SUT.
We propose the usage of the context ontology
during the requirement specification and test defini-
tion phases due to its expressiveness and the tool-
supported consistency checking facility. In the later
development and test generation phases the context
ontology can be mapped to a domain specific meta-
model and model, while the context patterns can be
mapped to model patterns. Axioms in the ontology
can be mapped to well-formedness constraints (with
regard to the metamodel) and model patterns (that re-
quire a desired configuration of model elements).
4 TESTING CONCEPT
Through the last decades, several approaches have ap-
peared for automatic software test data generation,
however most approaches concentrate on structural
testing. In (Ferguson and Korel, 1996) the authors di-
vided these methods into three classes.
Random methods obviously select input data by
random selection. Path-oriented methods reduce the
test data generation to a path problem, where a path
in the control flow is selected (usually to trigger a
selected program statement), and then the task is to
generate input data to execute that path. In the goal-
oriented approach, the path selection is eliminated,
thus the goal is to find particular input data which trig-
ger a selected statement in the program code. Meth-
ods using this approach monitor the program execu-
tion with the current input data, and classify branches
according to their influence on execution of the de-
sired branch.
The weakness of these approaches in case of agent
testing is the program analysis stage. Both path- and
goal-oriented approaches require the analysis of prog-
ram code, which can be complicated in case of large
programs, partly implemented programs with com-
ponent stubs, or legacy code. Furthermore, all in-
troduced approaches handle complex data structures
with difficulty, though most modern software appli-
cations deal with large and complex input data.
In this paper we focus on functional testing. Our
approach is based on the high-level behaviour speci-
fications of the agent program, that are relations be-
tween the program input and output. For example a
specification states that if a particular configuration
of objects is present in the context, the agent executes
an associated action.
We utilize these specifications to formulate re-
quirements regarding the context of the SUT. These
requirements include the presence of particular con-
figuration of objects stated in the input specification.
These configurations can be represented by context
patterns.
The goal of test data generation is to cover all con-
text patterns. Hence a generated suite of test data
is perfect for our goal, if it covers all required con-
text patterns, this way it is appropriate to determine
whether the SUT behaves as specified. We will refer
to this as sound suite of test data.
The generated test data is an instance model that
conforms to the metamodel constructed from the con-
text ontology, thus it shall fulfill the well-formedness
constraints defined by the metamodel. Additionally,
the test data shall conform with the context patterns
that also originate from the context ontology (for ex-
ample, they require the presence of certain objects
when another object is already present in the instance
model). We will refer to these restrictions as semantic
constraints. We will refer to test data that is well-
formed and satisfies the semantic constraints as valid
test data.
Since the generated test data is an instance model,
manipulation of this model during the execution of
the test data generation algorithm can be implemented
in the form of a model transformation (MT). These
transformations take an input model and produce an
output model by the application of a transformation
rule. In our case the metamodel of the input and the
output instance models are the same, thus we apply
endogenous MTs.
Previously we have stated that a sound and valid
suite of test data covers all required context patterns
and satisfies the semantic constraints. Finding the op-
timal set of test data is a non-trivialproblem due to the
large number of patterns, the hierarchy of objects and
relations included in these patterns and the overlap-
ping nature of patterns and semantic constraints (e.g.,
patterns may contain configurations of elements from
other patterns, constraints may complementary etc.).
ONTOLOGY-BASED TEST DATA GENERATION USING METAHEURISTICS
219