<!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>1 Testing Object-Oriented Configurators With ASP</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Andreas A. Falkner</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gottfried Schenner</string-name>
        </contrib>
      </contrib-group>
      <abstract>
        <p>Testing is an important aspect of every software project. For configurator applications it is equally important but often neglected. This paper shows how to support testing object-oriented and constraint-based configurators by automatically generating positive and negative test cases using answer set programming (ASP). The object-model of the configurator is mapped to ASP code; the constraints to be tested are coded redundantly in ASP. Based on that, the ASP solver generates appropriate test cases, which are then used for unit testing in the object-oriented configurator. There are different strategies to improve this basic process, e.g. reduction of the number of test cases with symmetry breaking.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Testing is an important but often neglected aspect of every software
development project. Especially for object-oriented (OO) languages,
unit testing with a testing framework like JUnit [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] is well established
and an integral part of development methods like Extreme
Programming [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Unit testing frameworks are also gaining acceptance
outside of object-oriented programming [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
      </p>
      <p>A configurator is a software system that enables the user to
configure complex systems or services using predefined components. In
a constraint-based configurator, constraints describe the conditions
which the configured system must satisfy. In order to test the
correctness of each individual constraint, the tester must provide positive
and negative test cases for it. A positive (negative) test case is a partial
configuration where the constraint is satisfied (violated). Obviously,
the test cases cannot be created by the solver of the configurator
because one cannot use the possible faulty constraint to generate the test
case. Therefore, the test cases currently must be created manually.</p>
      <p>
        There are different testing strategies such as black-box and white
box testing ([
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]. In black-box testing, the internal structure of the
test object must not be known to the tester and the tests are devised
according to the specification of the software system. In white-box
testing, the internal structure is known and the tester designs the tests
to achieve a high test coverage. In practise both strategies should be
used because they tend to find different kind of errors.
      </p>
      <p>
        The basic idea of this paper is to semi-automatically generate test
cases for object-oriented configurators by first translating the
configurator’s knowledge base (without the constraints to be tested) to
an answer set programming (ASP) program. The constraints to be
tested are then coded manually in ASP. Implementing the same
constraint both in Java and ASP achieves the necessary diversity to
detect conceptional errors (similar to N-Version programming [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]). The
1 This work has been developed within the scope of the project RECONCILE
(reconciling legacy instances with changed ontologies) and was funded by
FFG FIT-IT (grant number 825071).
2 Siemens AG O¨sterreich, Vienna, Austria
firstname.fmiddleinitial.glastname@siemens.com
3 Universita¨t Klagenfurt, Austria firstname.lastname@aau.at
ASP solver runs this program and generates positive and negative test
cases which are translated back into test cases for the object-oriented
configurator.
      </p>
      <p>The following section defines necessary features of the
configurator and provides a brief introduction to the ASP systems. In Section 3
we describe the approach in more details presenting the OO-ASP
mapping and examples for a small application. We show different
ways to reduce the number of generated test cases to a reasonable
size in Section 4 and conclude in Section 5.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Context</title>
      <p>
        For this work, we used a configurator based on Generative Constraint
Satisfaction (GCSP) which is a combination of object-oriented and
constraint-based technologies. In general however, any system that
complies to the definition of the following subsection can be used.
The current target system is the Potassco ASP suite4 [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] - it could
easily be replaced by another ASP system.
2.1
      </p>
    </sec>
    <sec id="sec-3">
      <title>Object-oriented constraint-based configurator</title>
      <p>The results of this paper can be applied to any existing configurator
framework which complies to the following definitions.
Definition 1 (Knowledge Base, KB) The knowledge base of an
object-oriented and constraint-based configurator comprises an
object model and a set of constraints.</p>
      <p>The KB specifies the relevant domain knowledge in a declarative
way. The solver comprises a general constraint solver which reasons
over that knowledge, e.g. checks consistency, searches solutions (i.e.
valid configurations), etc.</p>
      <p>Definition 2 (Object Model) An object model contains classes,
their inheritance hierarchy, attributes (Boolean, enumeration,
integer), and associations (bidirectional).</p>
      <p>
        The object model describes the structure of the possible
configurations, including the multiplicities (cardinalities) of the parts. It can
be specified by an UML class diagram [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ].
      </p>
      <p>Definition 3 (Configuration) A configuration is an instantiation of
the object model.</p>
      <p>Without loss of generality, only instances of leaf classes (classes
without subclasses) are allowed in a configuration. For the course of
this paper, it is assumed that the configurator maintains one current
configuration. In an interactive configurator, the user would
manipulate the current configuration by adding/deleting objects and setting
4 http://potassco.sourceforge.net
attributes and associations until a valid configuration is found.
Alternatively the constraint solver can be used to extend a configuration
to a valid configuration. Constraints are used to describe the valid
configurations of the configurator.</p>
      <p>Definition 4 (Constraint) A constraint is a condition which every
valid configuration must satisfy.</p>
      <p>This is a very general definition of the concept constraint. To make
our approach broadly applicable, no special constraint techniques
like domain-filtering, constraint propagation, etc. are required. A
constraint can be thought of as an invariant constraint in UML/OCL.
In its simplest form, constraints are Boolean methods of an
objectoriented language defined over the current configuration. From a
knowledge engineering view, constraints should correspond to some
requirements that the product to configure must satisfy. The scope of
a constraint can range from simple expressions like ’wheel1.size =
wheel2.size’ to ’The light-system of this vehicle is configured
correctly’ (represented by some complex code accessing sub-parts and
their properties).
2.2</p>
    </sec>
    <sec id="sec-4">
      <title>Answer Set Programming</title>
      <p>
        Answer set programming is an approach to declarative problem
solving which has its roots in logic programming and deductive
databases. This is a decidable fragment of first-order logic extended
with default negation, aggregation and weight constraints. ASP
allows modeling of a variety of search and optimization problems in a
declarative way [
        <xref ref-type="bibr" rid="ref13 ref5 ref7">13, 7, 5</xref>
        ] using model-based problem specification
methodology. Efficient ASP solvers allow fast identification of
solutions that correspond to answer sets of a program. Recent examples
include areas such as molecular biology, decision support and
planning. The DLV system [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] was used to plan shifts at Gioia-Tauro
Seaport which reduced the time required to define working teams’
assignments from hours to just a few minutes. A Potassco [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]
program is able to detect inconsistencies in large biological networks.
      </p>
      <p>
        Since configuration problems are a type of combinatorial
(optimization) problems, ASP was used by Soininen et al. [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] in their
approach which was one of the earliest industrial applications of ASP.
This first approach to the configuration problem was extended by
Friedrich et al. [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] to both configuration and reconfiguration cases.
Recently, Gebser et al. [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] have suggested a novel ASP based
modeling approach to configuration support of a Linux package
management system.
      </p>
      <p>This work uses the following language constructs of Potassco
(similar constructs are available in DLV):
constant: lower-case string or number
variable: upper-case string or
predicate: predicatename(A1; : : : ; An) with each Ai being a
constant or variable
condition: P : C (with P and C being predicates) generating a set
of ground instances for P corresponding to the existence of ground
instances of C
(counting) aggregate: LfA1; : : : ; AngU (with L being a lower
bound, U an upper bound, and each Ai a predicate possibly
generated by a condition) stating that the number of ground instances
Ai shall be within the bounds
fact: A0: with A0 being a predicate
rule: A0:-L1; : : : ; Ln: with A0 and Li being predicates or
aggregates, Li possibly negated
constraint: :-L1; : : : ; Ln: with Li being predicates or aggregates,
possibly negated</p>
    </sec>
    <sec id="sec-5">
      <title>Test case generation</title>
      <p>Since the main purpose of our approach is to detect conceptual
errors, the tester has to reimplement the constraint to be tested in
ASP, based on the requirements describing the constraint. Although
possible, one cannot automatically translate the constraint from the
OO configurator to ASP because an automatic translation would also
translate the errors in the constraint. For the same reason the tester
should be unaware of the implementation of the constraint in the
object-oriented configurator. This process implements a black-box
testing strategy like in traditional software engineering.</p>
      <p>The generated ASP code and the ASP definitions for the constraint
are used to compute answer sets that represent positive and negative
test cases. These answer sets are then translated back into an
objectoriented configuration and used in unit tests for the constraint.
3.1</p>
    </sec>
    <sec id="sec-6">
      <title>OO-ASP Mapping</title>
      <p>To illustrate the approach, a simple example domain for configuring
bicycles (Figure 2) is used. A bicycle has a frame, two wheels and
optional lights. A possible configuration can contain multiple bikes
of different types, wheel sizes, etc. A valid configuration consists of a
collection of correctly configured bicycles as defined by the allowed
domains of the attributes (e.g. type), the given cardinalities of the
associations (e.g. 0..1 for the lights), and two explicit constraints:
constraintWheelsize disallows wheels of different sizes.
constraintLights is complexer and requires that city bikes have
lights, that racing bikes do not have lights, that mountain bikes
may only have battery lights, and that the Boolean attribute
hasLights must correspond to the existence of a Lights instance.</p>
      <p>The object model is mapped to ASP according to the following
schema:</p>
      <p>Every class C is mapped to two unary predicates
&lt;aspnameC&gt;(X) and &lt;aspnameC&gt;Domain(X). The
domain predicates are needed to describe the possible instances of a</p>
      <p>Examplesofuser-definedmaximumofinstancesandoffactsgenerated by the solver as part of a test case like in Figure 5:
bicycleMaxInstances(1).
bicycleDomain(1).
wheelMaxInstances(3).
wheelDomain(201).</p>
      <p>By this mapping the Java class Bicycle is mapped to the unary
predicatebicycle,classWheeltopredicatewheel,itsattributesizeto 4. Especially for big domains, some basic symmetry breaking
conthe binary predicate wheelSize, and the association between Bicycle straintsarerequiredtoavoidexplosionofthenumberofgenerated
and Wheel to the binary predicate bicycle2wheel. test cases. Since the instances of a class are interchangeable we
Example of generated facts (for the listed part of the mapping): disallow usage of instances with a higher ID unless all instances
with a lower ID are used as well:</p>
      <p>In order to be able to enumerate every possible configuration, the
following additional ASP code is generated:
class-similartovariablestobeactivatedinconditionalconstraint 1. For every class C, the instances up to the given maximal number
satisfaction problems. The maximal number of instances is are generated by:
IdEnevsfietanrynecdaetsmtraiabrneuutieadleAlynTtiTvfiiReadopbfryecdliaincstaestgeCer&lt;issavmsaplaunpeapsme.deCto&gt;aMbaixnIanrsytapnrceedsi(cXat)e. 0{&lt;&lt;aassppnnaammeeCC&gt;&gt;(MXa)x:I&lt;nasstpannacmeesC(&gt;MDAoXm)a.in(X)}MAX
:&lt;aspnameATTR&gt;(X,Y)whereXisanintegerrepresentinganin- Example:
stance of class X and Y is a possible value of attribute ATTR.</p>
      <p>Every association ASSOC between class C1 and C2 is mapped to 0{bicycle(X):bicycleDomain(X)}MAX
:a binary predicate &lt;aspnameASSOC&gt;(X,Y), where X and Y are bicycleMaxInstances(MAX).
integers representing instances of class C1 and C2.</p>
      <p>ThemappingiscontrolledbyanXMLfile.Itcanbeusedtoignore
irrelevant information, e.g. the attribute type of the frame. The
following excerpt shows those parts of the mapping which are needed
for constraintWheelsize.
&lt;classmapping&gt;
&lt;javaname&gt;bikeshop.kb.Bicycle&lt;/javaname&gt;
&lt;aspname&gt;bicycle&lt;/aspname&gt;
...
&lt;assocmapping&gt;
&lt;javaname&gt;wheels&lt;/javaname&gt;
&lt;javaotherclass&gt;bikeshop.kb.Wheel
&lt;/javaotherclass&gt;
&lt;aspname&gt;bicycle2wheel&lt;/aspname&gt;
&lt;/assocmapping&gt;
&lt;/classmapping&gt;
&lt;classmapping&gt;
&lt;javaname&gt;bikeshop.kb.Wheel&lt;/javaname&gt;
&lt;aspname&gt;wheel&lt;/aspname&gt;
&lt;attrmapping&gt;
&lt;javaname&gt;size&lt;/javaname&gt;
&lt;aspname&gt;wheelSize&lt;/aspname&gt;
&lt;/attrmapping&gt;
&lt;/classmapping&gt;
2. For every attribute ATTR of class C and possible values V1..Vn,
one rule is needed to ensure exactly one value:
1{&lt;aspnameATTR&gt;(X,V1),...,</p>
      <p>&lt;aspnameATTR&gt;(X,Vn)}1 :- &lt;aspnameC&gt;(X).</p>
      <p>Example:
1{wheelSize(X,20),...,wheelSize(X,28)}1
:</p>
      <p>wheel(X).
3. For every association ASSOC between C1 and C2 and cardinality
restrictions L..U, a rule is generated for the lower bound:
&lt;L&gt;{&lt;aspnameASSOC&gt;(X,Y):</p>
      <p>&lt;aspnameC2&gt;Domain(Y)} :- &lt;aspnameC1&gt;(X).</p>
      <p>The upper bound of the association is checked with a constraint:
:- &lt;aspnameC1&gt;(X), U+1{&lt;aspnameASSOC&gt;(X,Y):</p>
      <p>&lt;aspnameC2&gt;Domain(Y)}.</p>
      <p>Example (upper bound = lower bound = 2):
2{bicycle2wheel(X,Y):wheelDomain(Y)}
:</p>
      <p>bicycle(X).
:- bicycle(X),</p>
      <p>3 {bicycle2wheel(X,Y):wheelDomain(Y)}.
:- &lt;aspnameC&gt;Domain(X), &lt;aspnameC&gt;Domain(Y),</p>
      <p>X&lt;Y, &lt;aspnameC&gt;(Y), not &lt;aspnameC&gt;(X).</p>
      <p>With this mapping it is possible to enumerate all configurations
up to the given upper bound of the number of instances (preferring
instances with a lower ID). The mapping is also used to translate
an answer set back into a configuration of the object-oriented
configurator. E.g. for the term bicycle(1) an instance of class Bicycle is
created, for bicycle2wheel(1,201) the objects for bicycle with id 1
and the wheel with id 201 are associated, etc.</p>
      <p>If the generated program does not have an answer set
(unsatisfiable) then the object model itself is inconsistent. The UML class
diagram in Figure 3 shows an example of an inconsistent object model.</p>
      <p>
        For every instance of class A, two instances of B and three
instances of C must exist. Since there is a 1-1 association between B
and C this class diagram is inconsistent. In this case the testing
system reproduces the functionality of an earlier method [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] that uses
integer programming for automatic detection of inconsistencies in
UML class diagrams.
3.2
      </p>
    </sec>
    <sec id="sec-7">
      <title>Test cases for constraints</title>
      <p>
        To test a constraint, the tester needs to implement the constraint in
ASP using the predicates of the generic mapping. With the
generated program code of the preceding section and the manually written
constraint, an ASP solver can find answer sets which satisfy the
constraint or violate the constraint (counterexamples). By that, we get a
set of test cases (represented as partial configurations) for each
constraint. This approach is similar to the one supported by Alloy ([
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]).
      </p>
      <p>To avoid making the same conceptional errors as the implementer
of the OO constraint, the tester should be unaware of the OO
constraint code when writing the constraint. The implementer of the ASP
constraint is only given a verbal description of the constraint or the
requirement that should be checked by the constraint.</p>
      <p>As an example, take the constraint that the wheels of a bicycle
must have the same size (constraintWheelsize in Section 3.1).
Following the convention that ASP constraints specify what is not a
valid configuration, the tester expresses this with the following ASP
code:
constraintWheelsize
:bicycle(X),
bicycle2wheel(X,W1),
bicycle2wheel(X,W2),
W1!=W2,
wheelSize(W1,S1),
wheelSize(W2,S2),</p>
      <p>S1!=S2.
% find positive test case
:- testpositive, constraintWheelsize.
% find negative test case (counterexample)
:- testnegative, not constraintWheelsize.</p>
      <p>The two atoms testpositive and testnegative control whether the
solver finds positive or negative test cases for the tested constraint.
In a positive test case the constraint is satisfied, in a negative one it is
violated.</p>
      <p>Figure 4 shows a positive test case found by the ASP solver
running the program for constraintWheelsize. In this automatically
generated graphical representation, rectangles represent instances,
ellipses represent values, and the edges are labeled by the predicates
between the nodes.</p>
      <p>Running the same program with the fact testnegative produces the
negative test case in Figure 5, i.e. a counterexample for the constraint.</p>
      <p>Each answer set represents one test case and can be translated into
a partial configuration for the object-oriented configurator. All
positive and negative test cases can be used for unit testing the constraint.</p>
      <p>Note that the generated partial configurations for positive test
cases might violate other constraints of the domain. For instance,
constraintLights requires that the attribute bicycleHaslights is true,
iff the bicycle has lights. This constraint is violated in the positive
test case of Figure 4.
3.3</p>
    </sec>
    <sec id="sec-8">
      <title>Unit testing</title>
      <p>The whole process of test case generation can easily be integrated
into unit testing. The test cases are added to the unit test suite of
the configurator and used for regression testing. The following code
sequence shows the unit test for constraintWheelsize which first
runs all positive test cases and then all negative ones. The
function generateT estcases executes the ASP solver as described in
the preceding section and returns a list of answer sets. The
function createConf igurationF or creates the partial configuration for
an answer set which can be accessed by getter methods such as
getBicyles.
public void testConstraintWheelsize() {
List&lt;Set&lt;String&gt;&gt; tcs;
tcs = generateTestcases("testpositive");
for (Set&lt;String&gt; answerSet : tcs) {
createConfigurationFor(answerSet);
Bicycle bike = getBicycles().get(0);
IConstraint c =
bike.getConstraint(CONSTRAINTWHEELSIZE);
assertEquals(Boolean.TRUE,c.getVal());
}
tcs = generateTestcases("testnegative");
for (Set&lt;String&gt; answerSet : tcs) {
createConfigurationFor(answerSet);
Bicycle bike = getBicycles().get(0);
IConstraint c =
bike.getConstraint(CONSTRAINTWHEELSIZE);
assertEquals(Boolean.FALSE,c.getVal());
}
}</p>
      <p>If an assert fails (i.e. a test case reports a discrepancy) then the
reason for it has still to be found. For example, consider the
following faulty Java implementation of the constraint. Since it returns true
for the counterexample, we know there is a discrepancy between the
ASP and the OO implementation of the constraint. Looking at the
Java code below it is easy to identify the error. Due to a typing error,
w2 is never referenced.
// in class Bicycle
public boolean constraintWheelsize() {
List wheels = getWheels();
if (wheels.size()!=2) { return false; }
Wheel w1 = wheels().get(0);
Wheel w2 = wheels().get(1);
return w1.getSize()==w1.getSize();
}</p>
      <p>In many cases, comparing the two implementations (i.e. static
analysis) is sufficient for identifying an error. If two constraint
implementations use different parts of the model this is an indication of
an error. For instance, if one constraint depends on an attribute value
and the other does not then there is a high chance that the first is more
specific than the other.</p>
      <p>
        Note that an OO implementation of the constraint in the
configurator is not needed to generate test cases with our approach. Therefore,
this method can also be used for the test-first approach of Test Driven
Development [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
    </sec>
    <sec id="sec-9">
      <title>Improving the test cases</title>
      <p>Uninformed test case generation as described in the last section
creates many possible configurations. Usually, this leads to a good test
coverage. However, the number of test cases gets too large for
practical use, especially for large-scale configuration.</p>
      <p>Therefore, a method is needed to choose test cases which are likely
to detect errors in the implementation. To generate test cases with
specific properties, the tester can add statements describing those
properties to the ASP implementation. For instance, adding
1 { wheelSize(X,Y):Y=24..25 } 1 :- wheel(X).
will only generate test cases where the wheelSize is 24 or 25.
Specifying all relevant test cases manually this way is a tedious task.
The alternative is to use advanced filtering techniques like symmetry
breaking.
4.1</p>
    </sec>
    <sec id="sec-10">
      <title>Symmetry breaking</title>
      <p>
        For black-box testing in software engineering, techniques such as
equivalence partitioning and boundary value analysis have been
developed to reduce the number of test cases [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]. These techniques
define equivalence classes for the input data and test only one value
from every equivalence class.
      </p>
      <p>For constraint-based systems a similar effect can be achieved by
defining equivalence classes over the possible configurations by
using symmetry breaking techniques. For instance, in the positive test
cases for constraintWheelsize, the actual value of the wheel size is
irrelevant as long as the values are all the same (assuming a reasonable
implementation). For negative test cases, at least two different values
are needed, but it does not matter which values are actually chosen.</p>
      <p>
        Detection of the equivalence classes for an ASP program is done
by reducing it to the colored graph automorphism problem [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. In
this case, the grounded program is represented as a colored graph.
The symmetry breaking tool is searching for such transformations
of the graph (permutation) that map vertices of it to vertices of the
same color. The coloring schema in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] allows to identify
permutations of graph vertices corresponding to equivalent grounded atoms,
e.g. wheels of different sizes, in a program. The permutations are
used by the preprocessor SBASS5 [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] to generate symmetry
breaking constraints that introduce a lexicographic order on elements of a
solution space. The symmetry breaking constraints are added to the
grounded program and the result is forwarded to the solver.
      </p>
      <p>Roughly speaking, in the case of wheel sizes, constraints will
require to use wheels of size 20 first, since 20 is lexicographically the
smallest value. Only if it is impossible to find a configuration with
wheels of the size 20, the solver will try the size 21 and so on.</p>
      <p>Inclusion of the preprocessing step in the testing tool chain reduces
the number of possible configurations for the bicycle example
(without coding the two constraints in ASP) from 1459 to 129. For the
test case generation example for constraintWheelsize as described in
Section 3.2, execution of SBASS reduces the number of positive test
cases from 163 to 13. Although the number of test cases can be
reduced drastically by symmetry breaking, one still has to ensure that
the coverage of the created test cases is enough to find potential
errors.</p>
      <p>For instance, consider the case where the knowledge base is
modified by allowing bicycles to have more than two wheels (i.e.
tricycles, etc). The following faulty constraint implementation works, if
5 http://potassco.sourceforge.net/labs.html
the differences in wheel sizes always occur in the first two wheels. If
symmetry breaking creates only such test configurations, one can no
longer detect the error in the constraint implementation.
// faulty implementation, but works
// if the "first" 2 wheels are of same size
public boolean constraintWheelsize() {
List&lt;Wheel&gt; wheels = getWheels();
for(int i = 0 ; i&lt;wheels.size() ; i++) {
for(int j=i+1 ; j&lt;wheels.size() ; j++) {
if (wheels.get(i).getSize().equals(</p>
      <p>wheels.get(j).getSize())) {
return true;
}</p>
      <p>}
}
return false;
}
4.2</p>
    </sec>
    <sec id="sec-11">
      <title>White box testing</title>
      <p>The kind of errors in the implementation often depend on the
programming language used. A knowledge engineer using a specific
Java framework will make different errors than a knowledge
engineer using ASP. Therefore, the generation of test cases cannot be
fully automated without additional information about likely errors.</p>
      <p>By looking at the code (white box testing) an experienced
developer can identify suspicious parts of the code which should be tested.
From that, she can derive which properties a test case must have and
can create such test cases manually. For automated test case
generation, it is possible to generate test cases with specific properties by
adding additional constraints to the ASP program similar to the
example at the beginning of Section 4.
4.3</p>
    </sec>
    <sec id="sec-12">
      <title>Maintaining test configurations</title>
      <p>By combining all the constraints of the domain, the described
approach can also be used to generate complete and valid test
configurations for the object-oriented configurator. The limiting factor here
is that the performance of the generic mapping and the fact that all
constraints of the configurator must be reimplemented in ASP.</p>
      <p>Complete test configurations are often used for integration testing,
system tests, etc. A common problem is how to maintain the
consistency of the test configurations in case of knowledge base evolution.
Whenever the requirement of a constraint changes, one needs to
reconcile those changes with existing legacy test configurations.</p>
      <p>
        Since many tests may depend on the existing test configuration, the
changes in the legacy test configuration should be minimal. An ASP
method for finding reconfigurations with minimal costs is suggested
in [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
5
      </p>
    </sec>
    <sec id="sec-13">
      <title>Conclusions</title>
      <p>We described how to map the object model and configurations of an
object-oriented and constraint-based configurator to and from ASP.
One application of this mapping is the generation of test cases for
the OO configurator. Since the mapping is symmetric it could also
be used to generate test cases for an ASP-based configurator.</p>
      <p>The generation of test cases so far has been tried for toy examples
like the bikeshop domain and some small fragments of real world
domains. For the future we plan to evaluate translation of existing
knowledge bases of our real-world configurators (&gt;100 classes) into
ASP. We expect that we have to refine the techniques of Section 4 in
order to get sufficient performance.</p>
      <p>The current approach cannot be used for test cases containing a
lot of components. For instance, the bikeshop domain already uses
more than 1GB of memory if the domain size is set to more than 50.
Fortunately, test cases for single constraints usually do not involve
hundreds of components.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Algirdas</surname>
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Avizienis</surname>
          </string-name>
          ,
          <source>Software Fault Tolerance</source>
          , volume
          <volume>2</volume>
          ,
          <string-name>
            <given-names>chapter ”The</given-names>
            <surname>Methodology of N-Version</surname>
          </string-name>
          <string-name>
            <surname>Programming</surname>
          </string-name>
          ”,
          <fpage>22</fpage>
          -
          <lpage>45</lpage>
          , John Wiley &amp; Sons,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Beck</surname>
          </string-name>
          , Test Driven Development: By Example,
          <string-name>
            <surname>Addison-Wesley Longman</surname>
          </string-name>
          Publishing Co., Inc., Boston, MA, USA,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Kent</given-names>
            <surname>Beck. JUnit</surname>
          </string-name>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Kent</given-names>
            <surname>Beck</surname>
          </string-name>
          and
          <string-name>
            <given-names>Cynthia</given-names>
            <surname>Andres</surname>
          </string-name>
          ,
          <source>Extreme Programming Explained: Embrace Change (2nd Edition)</source>
          ,
          <string-name>
            <surname>Addison-Wesley Professional</surname>
          </string-name>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Gerhard</given-names>
            <surname>Brewka</surname>
          </string-name>
          , Thomas Eiter, and Miroslaw Truszczynski, '
          <article-title>Answer set programming at a glance'</article-title>
          ,
          <source>Communications of the ACM</source>
          ,
          <volume>54</volume>
          (
          <issue>12</issue>
          ),
          <fpage>92</fpage>
          -
          <lpage>103</lpage>
          , (
          <year>2011</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Christian</given-names>
            <surname>Drescher</surname>
          </string-name>
          , Oana Tifrea, and Toby Walsh, '
          <article-title>Symmetry-breaking answer set solving'</article-title>
          ,
          <source>AI</source>
          Commun.,
          <volume>24</volume>
          (
          <issue>2</issue>
          ),
          <fpage>177</fpage>
          -
          <lpage>194</lpage>
          , (
          <year>2011</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Thomas</given-names>
            <surname>Eiter</surname>
          </string-name>
          , Giovambattista Ianni, and Thomas Krennwallner, '
          <article-title>Answer set programming: A primer'</article-title>
          ,
          <source>in Reasoning Web</source>
          , pp.
          <fpage>40</fpage>
          -
          <lpage>110</lpage>
          , (
          <year>2009</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Andreas</given-names>
            <surname>Falkner</surname>
          </string-name>
          , Ingo Feinerer, Gernot Salzer, and Gottfried Schenner, '
          <article-title>Solving practical configuration problems using UML'</article-title>
          ,
          <source>in Proceedings of ECAI 2008 Workshop on Configuration Systems</source>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>6</lpage>
          , (
          <year>2008</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Onofrio</given-names>
            <surname>Febbraro</surname>
          </string-name>
          , Nicola Leone, Kristian Reale, and Francesco Ricca, '
          <article-title>Unit testing in aspide'</article-title>
          ,
          <source>CoRR</source>
          , (
          <year>2011</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Gerhard</surname>
            <given-names>Friedrich</given-names>
          </string-name>
          , Anna Ryabokon, Andreas A.
          <string-name>
            <surname>Falkner</surname>
          </string-name>
          , Alois Haselbo¨ck, Gottfried Schenner, and Herwig Schreiner, '
          <article-title>(Re)configuration based on model generation'</article-title>
          , in LoCoCo, eds.,
          <string-name>
            <surname>Conrad</surname>
            <given-names>Drescher</given-names>
          </string-name>
          ,
          <source>Ins Lynce, and Ralf Treinen</source>
          , volume
          <volume>65</volume>
          <source>of EPTCS</source>
          , pp.
          <fpage>26</fpage>
          -
          <lpage>35</lpage>
          , (
          <year>2011</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Martin</surname>
            <given-names>Gebser</given-names>
          </string-name>
          , Roland Kaminski, and Torsten Schaub, '
          <article-title>aspcud: A linux package configuration tool based on answer set programming'</article-title>
          , in LoCoCo, pp.
          <fpage>12</fpage>
          -
          <lpage>25</lpage>
          , (
          <year>2011</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Martin</surname>
            <given-names>Gebser</given-names>
          </string-name>
          , Benjamin Kaufmann, and Torsten Schaub, '
          <article-title>Conflictdriven answer set solving: From theory to practice', Artif</article-title>
          . Intell.,
          <volume>187</volume>
          ,
          <fpage>52</fpage>
          -
          <lpage>89</lpage>
          , (
          <year>2012</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>Michael</given-names>
            <surname>Gelfond</surname>
          </string-name>
          and Vladimir Lifschitz, '
          <article-title>The stable model semantics for logic programming'</article-title>
          ,
          <source>in 5th International Conference and Symposium on Logic Programming</source>
          , pp.
          <fpage>1070</fpage>
          -
          <lpage>1080</lpage>
          , (
          <year>1988</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>Daniel</given-names>
            <surname>Jackson</surname>
          </string-name>
          , '
          <article-title>Alloy: A logical modelling language'</article-title>
          ,
          <string-name>
            <surname>in</surname>
            <given-names>ZB</given-names>
          </string-name>
          , p.
          <fpage>1</fpage>
          , (
          <year>2003</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <surname>Nikola</surname>
            <given-names>Leone</given-names>
          </string-name>
          , Gerald Pfeifer, Wolfgang Faber, Thomas Eiter, Georg Gottlob, Simona Perri, and Francesco Scarcello, '
          <article-title>The DLV system for knowledge representation and reasoning'</article-title>
          ,
          <source>ACM Transactions on Computational Logic (TOCL)</source>
          ,
          <volume>7</volume>
          (
          <issue>3</issue>
          ),
          <fpage>499</fpage>
          -
          <lpage>562</lpage>
          , (
          <year>2006</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <surname>Glenford</surname>
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Myers</surname>
            and
            <given-names>Corey</given-names>
          </string-name>
          <string-name>
            <surname>Sandler</surname>
          </string-name>
          ,
          <source>The Art of Software Testing</source>
          , John Wiley &amp; Sons,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <surname>James</surname>
            <given-names>Rumbaugh</given-names>
          </string-name>
          , Ivar Jacobson, and Grady Booch, '
          <article-title>The unified modeling language reference manual', in The unified modeling language reference manual</article-title>
          , (
          <year>2005</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <surname>Timo</surname>
            <given-names>Soininen</given-names>
          </string-name>
          , Ilkka Niemela¨,
          <string-name>
            <given-names>Juha</given-names>
            <surname>Tiihonen</surname>
          </string-name>
          , and Reijo Sulonen, '
          <article-title>Representing configuration knowledge with weight constraint rules'</article-title>
          ,
          <source>in 1st International Workshop on Answer Set Programming: Towards Efficient and Scalable Knowledge</source>
          , pp.
          <fpage>195</fpage>
          -
          <lpage>201</lpage>
          , (
          <year>2001</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>