MODEL DRIVEN TESTING WITH TIME AUGMENTED MARKOV
CHAIN USAGE MODELS
Computations and Test Case Generation Algorithms for Time Augmented Markov
Chain Usage Models
Sebastian Siegl, Vladimir Entin, Reinhard German
Department of Computer Science, FAU Erlangen-N
¨
urnberg, Martensstr. 3, 91058, Erlangen, Germany
Gerhard Kiffe
AUDI AG, 85045 Ingolstadt, Germany
Keywords:
Software tests, Model based testing, Automated test case generation, Statistical testing, Usage modeling,
Testing strategies, Test coverage, Automotive systems, Embedded systems.
Abstract:
In statistical testing Markov Chain Usage Models (MCUM) are employed to describe the possible usage of
the System-under-test (SUT) and to automatically derive test cases. However, MCUMs, as they are applied
today, do not provide a universal concept for the integration of time. The estimated or known delay time of
usage states and execution time of actions can only be considered by auxiliary means. But the importance
of this aspect grows continously with the integration of increasingly complex and time sensitive systems in
the automotive environment, such as hybrid vehicles. To overcome this drawback we present an intuitive
extension of MCUMs that allows the consistent integration of time in MCUMs. We discuss how computations
for MCUMs can be easily adapted to Time Augmented MCUMs and present algorithms for automatic test
case generation from Time Augmented MCUMs together with a case study that has been conducted in the
automotive domain.
1 INTRODUCTION
In many application domains, e.g. avionic and au-
tomotive systems, software has become the method
of choice for innovation. This development is inten-
sified by the customer demand for increasingly safe,
comfortable, and environment friendly systems like
hybrid or electric vehicles. To satisfy this demand
the development of highly complex and distributed
systems has become inevitable. These systems pose
new challenges to testing. The approach presented
in this paper is based on model based testing (Dalal
et al., 1999), and can be further categorized into us-
age model based black box testing (Beyer and Dulz,
2005). Nowadays the focus in usage oriented test-
ing based on Markov chain usage models (MCUM)
lies in testing various sampled test cases and in test-
ing that comes close to a known or estimated usage
profile (Prowell, 2004). A broad spectrum of differ-
ent types of algorithms for the generation of test cases
exists (Siegl, 2008). Only the variance in actions is
currently considered in a consistent manner, however.
Time and especially the variance in usage time, i.e.
the time between actions and the duration of actions
themselves, is not integrated coherently. However, the
timing of different actions has an important impact on
the behavior of a system and thus on the ability of
test cases to discover failures. Timing in this context
stands for the duration of the execution of stimuli and
the duration of usage states, i.e. the time between the
execution of stimuli. In this contribution we present
a temporal extension to classical MCUMs that offers
the following advantages:
A realistic, usage time considering, representation
of system usage
Integration of usage timing into computations
Integration of variance in time of usage into test
case generation
Our enhancement is based on the concept of semi-
Markov processes as they are used in the perfor-
mance analysis of systems with non-exponential tim-
202
Siegl S., Entin V., Ger man R. and Kiffe G. (2009).
MODEL DRIVEN TESTING WITH TIME AUGMENTED MARKOV CHAIN USAGE MODELS - Computations and Test Case Generation Algorithms for
Time Augmented Markov Chain Usage Models.
In Proceedings of the 4th International Conference on Software and Data Technologies, pages 202-207
DOI: 10.5220/0002255902020207
Copyright
c
SciTePress
ings (German, 2000). They are applied in the field of
system-modeling and analysis. In the context of us-
age modeling no application of this concept is known
to the authors.
The paper is structured as follows. In the next sec-
tion model driven testing based on Markov chain us-
age models is briefly introduced, followed by a pre-
sentation of the testing requirements in the automo-
tive domain. Next we present the extension, calcula-
tions that are possible with this extension and algo-
rithms for an automatic generation of test cases from
our enhanced MCUMs that we call Time Augmented
Markov chain usage models. Before the conclusion
and outlook, we present a case study that has been
conducted in the automotive domain.
2 TEST CASE GENERATION
FROM MARKOV CHAIN
USAGE MODELS
A MCUM is usually described by a directed graph
that consists of (Prowell, 2000):
A set of states S = {s
1
, . . . , s
n
}, that represent pos-
sible states of usage.
A set of arcs A, representing state transitions. An
arc from state i to state j is denoted by a
i j
, mul-
tiple arcs between s
i
and s
j
are not allowed. A
stimulus on the SUT is assigned to each arc.
The transition probability from state i to state j,
denoted by p
i, j
for an existing arc a
i j
. Otherwise
the transition probability p
i, j
= 0. The transition
probabilities obey the conditions 0 p
i, j
1 and
n
j=1
p
i, j
= 1 i = 1, . . . , n (1)
that states that the probabilities of all outgoing
arcs from a certain state s
i
must sum up to one.
Two states have special characteristics, that are s
1
,
which is the sole initial state (also: start state) and s
n
,
which is the final state (also: end state). The values
p
i, j
can be stored in a state-transition-matrix P. El-
ement describes p
i j
the probability of the transition
from state s
i
to state s
j
.
The representation of a MCUM as directed graph
is depicted in Figure 1.
Each path from the start to the final state is a valid
test case. Test cases can be generated straightforward
by random walk starting from the initial state, this
way obtaining statistical sampled test cases. Differ-
ent usage profiles, representing e.g. different types of
Figure 1: MCUM representation as directed graph.
users, can be applied to direct the statistical derivation
of test cases. Therefore, distinct user characteristics
or testing targets can be considered during test case
generation.
For a usage model based on a Markov chain many
computations can be performed that provide valuable
information for test management (cp. section 4.2).
3 TEST REQUIREMENTS AND
CONSTRAINTS IN THE
AUTOMOTIVE DOMAIN
Test requirements and constraints in the automotive
domain are composed of the
SUT test requirements
test automation
test bench
In the following, the test automation Extended Au-
tomation Method (EXAM), applied within the Volk-
swagen AG, and the test benches employed in the con-
text of this paper are briefly introduced.
EXAM Testing Process. Test automation in the
scope of EXAM means the automated generation of
platform dependent code and the execution of the
derived test suite without human interaction. The
majority of test cases is automatically executed on
Hardware-in-the-loop (HIL) systems, that are intro-
duced in the next paragraph. However, it is hardly
possible to systematically derive test suites that meet
the requirements in the automotive domain in an op-
timal manner.
HIL Testing. Hardware-in-the-loop (HIL) simula-
tion provides a platform for testing embedded systems
composed of Electronic Control Units (ECUs) under
conditions so that the ECUs feel like being in a real
car. This is achieved by including the ECUs in a sim-
ulated environment.
The main issue is currently how to use the HIL test
platform in an efficient manner, since testing time on
HIL systems is expensive.
MODEL DRIVEN TESTING WITH TIME AUGMENTED MARKOV CHAIN USAGE MODELS - Computations and
Test Case Generation Algorithms for Time Augmented Markov Chain Usage Models
203
Challenges in Automated Test Case Generation.
As test cases until now are created without systemati-
cally considerung time and timing constraints the de-
cision which test cases to create and to execute within
time constraints remained in the hands of the test de-
signer. Thus, this decision has not been done system-
atically on the basis of an unambiguous model. One
drawback of the existing procedure is that valuable
testing time may not be used in an optimal manner.
Strategies have been proposed in (Siegl, 2008) to
derive test cases from MCUMs under consideration
of time. However, the existing methods for test case
generation based on MCUMs lack the systematic in-
tegration of usage time in the MCUMs themselves,
since they are discrete time Markov chains and each
state transition corresponds to one time step on an ab-
stract time base. Until now concepts are known to in-
tegrate timing aspects provisionally (Beyer and Dulz,
2005), but not coherently and in a manner that the us-
age time is integrated by keeping the semantics of the
MCUM. Therefore, we present in this paper an ex-
tension of MCUMs that keeps the semantic and that
supports automated test case generation for embedded
systems in test environments as they are established in
the automotive industry.
Figure 2: Hardware in the loop simulation.
4 TIME AUGMENTED MARKOV
CHAIN USAGE MODELS
This section is structured as follows: First of all the
enhancement of MCUMs is described. Next Markov
Computations are introduced. These can be made be-
fore and after test case execution and provide valu-
able test management information, e.g. the estimated
number of test cases required to achieve a coverage
level. The enhancement of standard algorithms for
test case generation is described in the following para-
graph and finally the issue of coverage criteria for
Time Augmented MCUMs is presented.
4.1 Enhancement
The enhancement of MCUMs is structured as follows:
A probability density function (pdf) of the resi-
dence time is assigned to each state s
i
. We denote
it as ts
i
.
A pdf of the stimulus time ta
i, j
is assigned to each
arc a
i j
. This pdf describes the duration of the ex-
ecution of a stimulus on the SUT.
Besides, the transition probabilities p
i, j
as well as
the values ts
i
and ta
i, j
can be stored and exchanged
by means of a matrix P. The single values p
i j
are
replaced by the two elements p
i, j
and ta
i, j
. An addi-
tional row or column that extends the matrix by ele-
ments p
in+1
or p
n+1 j
is used to store the pdf ts
i
as-
signed to the usage state s
i
. This information could
also be stored in a one-dimensional vector related to a
matrix P. The extensions introduced by our approach
are presented in Figure 3.
Figure 3: MCUM extended by usage time pdfs.
The pdfs of time we used for this approach are:
Deterministic time as a step function.
Uniform distribution (discrete uniform distribu-
tion)
Gaussian distribution (binomial distribution)
Exponential distribution (geometric distribution)
In brackets the discrete approximation of the con-
tinuous functions is given.
By assigning these distributions it is possible to
describe usage that
is always exactly predictable in time.
is characterizable that it is equally likely within
time boundaries.
happens typically after a certain time. The stan-
dard deviation is known.
whose occurrence probability does not change
over time.
Therefore not only the variance of stimuli them-
selves, but also the variance of the timing, i.e. the ex-
ecution time of stimuli and the time between them can
be described by a MCUM. There is one issue that has
to be considered when creating such a model. Multi-
ple arcs a
i
j, that have their origin in the same state s
i
,
may be assigned the same stimulus. In this case the
range of values of the pdfs that describe the duration
of the arc traversal must be disjoint.
ICSOFT 2009 - 4th International Conference on Software and Data Technologies
204
4.2 Computations
Markov Computations for MCUMs are (Prowell,
2000):
Expected number of occurrences of a state in a
test case
Long-run state probabilities
Long-run arc probabilities
State occurrence probability
Arc occurrence probability
Expected length of a test case
Up to now these computations have produced ab-
stract and relative numbers with respect to the other
elements of the MCUM, i.e. describing characteris-
tics of the model. An example is the long-run state
probability, that is computed for each state in the fol-
lowing way: The expected number of occurrences of
the considered state is divided by the number of oc-
currences of all states. This is quite an abstract mea-
sure that does not represent the testing time spent in
each state. With our extension this computation be-
comes more valuable, because we can take the expec-
tation value of each ts
i
and determine in this manner
the fraction of time spent in each state during test-
ing. This result might differ considerably from the
relative occurrence rates and can thus be a better indi-
cator for the decision making which test cases should
be executed. Also, the other computations gain im-
portance, e.g. the number of occurrences of arc and
state weighted by the pdfs of time give an important
indicator for test planning. To complete the list, the
following computations are now possible with Time
Augmented MCUMs:
mean time consumed in transitions
mean time consumed by execution of each stimu-
lus
Expected state residence time in a test case
Long-run state mean residence time
Long-run arc mean execution time
4.3 Algorithms
The existing algorithms for the generation of test
cases can still be used, however, they do not make use
of the timing information (Prowell, 2004). For this
reason we propose new algorithms that incorporate
the knowledge of time for test generation strategies.
The variance in time is considered during test gener-
ation and can this way also be found in the test cases.
Furthermore, the estimated execution time for each
generated test case is automatically available, which
is an important information for the test management.
Random Walk. Random walk is the standard sam-
pling technique to derive test cases from MCUMs. In
the following algorithms it is assumed that a certain
usage profile is given from which the values t
sc
, p
c, j
,
and ta
c, j
are obtained. These values describe the du-
ration of a state t
sc
or of the execution of a stimulus
t
c j
in the concrete test case that is generated. The ex-
tended random walk for Time Augmented MCUMs is
described in Figure 4.
Data:
Time Augmented MCUM;
s
c
state under consideration;
Initialization:
s
c
s
1
;
while s
n
not reached do
Get t
sc
by sampling ts
c
;
Get a
c j
randomly from all p
c, j
;
Get t
c j
by sampling ta
c, j
;
s
c
s
j
;
end
Figure 4: Random walk for Time Augmented MCUMs.
Most Probable Test Case. Algorithms to derive
the most probable test case usually choose the most
probable arc at each state. For the timing informations
assigned to states and arcs we assume that the expec-
tation value (in the following also: mean) of the pdf
for the time, denoted as E[pd f ] represents the most
probable value for the time.
Data:
Time Augmented MCUM;
s
c
state under consideration;
Initialization:
s
c
s
1
;
while s
n
not reached do
t
sc
E[ts
c
];
a
c j
a
c j
with max p
c, j
;
t
c j
E[ta
c, j
];
s
c
s
j
;
end
Figure 5: Most probable test case from Time Augmented
MCUMs.
Note that the determination of the next arc is left
untouched, i.e. the arc with the highest probability.
The time that is determined for each arc and state is
the expectation value for the pdf that is assigned to the
arc and state respectively.
Minimal Arc Coverage. Minimal arc coverage al-
gorithms can be used without modification. However,
MODEL DRIVEN TESTING WITH TIME AUGMENTED MARKOV CHAIN USAGE MODELS - Computations and
Test Case Generation Algorithms for Time Augmented Markov Chain Usage Models
205
the timing information has to be applied depending
on the test strategy that one follows. If testing time
is short, one could take the minimal limiting value of
the pdfs.
Boundary Value Testing. Boundary value testing
is supported by the time information incorporated in
the Time Augmented MCUM. The following four
cases have to be considered:
Deterministic Distribution. In this case there
is no choice of time.
Uniform Distribution. Also in this case the de-
termination of boundary values is straightforward,
as they are given by the limits of the interval.
Gaussian Distribution. In these cases the
range of values is potentially infinite. A rea-
sonable value for boundary value testing has to
be determined. If one prefers to have a unique
definition of the boundary values the values at
σ
r
= µ[pd f ] ± 3σ[pd f ] can be taken. These val-
ues encompass 99.7% of the whole set.
Exponential Distribution. In the case of the
exponential distribution, a minimal value is given
by the point of origin. As a maximal boundary
value we suggest to use E[pd f ] = µ[pd f ].
4.4 Coverage Criteria
Graph based coverage criteria rely on the evaluation
of how the test paths belonging to the test cases cover
the graph abstraction (Hierons et al., 2008, p. 119).
This concept is hardly transferable to an infinite do-
main like time, so a coverage criterion considering
timing aspects has to be defined. These definitions
are based on the assumptions described in section 4.3.
These definitions, of course, can only give a general
idea for orientation, since the significance depends
also on the special characteristics of the system under
test (SUT). That is to say that for testing a low level
non functional property such definitions can be eas-
ier applied than for testing a high level non functional
property. To give an example hybrid vehicle operat-
ing strategies shall be stated, where beside the oper-
ating strategy (Wallentowitz and Reif, 2006) itself the
potential timing in usage of various participants has to
be considered. A general definition of coverage con-
cerning the timing aspects is hard to give and cover-
age criteria dependent on characteristics of the tested
functionality (e.g. its safety criticality) is part of our
future work. Some basic definitions shall be given:
Deterministic Distribution. In this case there
is no range so only the specified value has to be
considered for coverage under a usage point of
view.
Uniform Distribution. The minimal, mean,
and maximal value could be good choices for min-
imal coverage testing.
Gaussian Distribution. Mathematical indica-
tors, such as the included fraction of possible re-
alizations of the value domain, or requirements,
can be a sound basis.
Exponential Distribution. The minimal or ex-
pectation value E[pd f ] = µ[pd f ] can be sufficient,
strongly dependent on the functionality.
5 CASE STUDY
For the evaluation of our approach, a test issue in the
automotive domain has been chosen. It concerns an
aspect of the operation of the Electronic Stability Pro-
gram (ESP) switch in modern cars. Different func-
tionalities are invoked depending on the state of the
car and the pressing duration of the switch (AUDI
AG, 2005). Some of these functionalities are directly
desired by the user and some are assumed to represent
the reaction desired by the user.
In some cars, the ESP switch was placed in the
center console, where car passengers often deposit
their hand bag. This led to frequent misactivations
of this switch and as a consequence to undesired de-
activation and activation operations of the ESP func-
tionality. Due to this problem the handbag switching
mechanism is now integrated in the cars. This mech-
anism activates ESP irrevocable for the whole jour-
ney if the ESP Switch is pressed longer than a cer-
tain time, thus preventing the undesired deactivation
of ESP if an object is placed on top of the ESP switch.
In Figure 6 the model is presented that describes
the different activation durations of the ESP switch.
A subset of the computations in the classical way
is shown in table 1.
The probability is the same, that is 0.03844, to
stay during a test case in the start state (S9998), final
state (S9999), and in the state in which the ignition
has been turned on (S1). The probability, however,
that the test case is in the state (S234) where the car
drives at 15kmph and the ESP switch has been pressed
for less than 3 seconds is only 0.01443.
Table 1: Computations for Case Study ESP Switch.
State Stationary Visiting Expected number
ID distrib. probab. of visits
S9998 0.03844 1.00000 1.00000
S1 0.03844 1.00000 1.00000
S234 0.01443 0.22232 0.37538
S4 0.07687 1.00000 2.00000
S9999 0.03844 1.00000 1.00000
ICSOFT 2009 - 4th International Conference on Software and Data Technologies
206
Figure 6: Sub-Usage scenario for ESP push button.
Table 2: Computations for Case Study ESP Switch with
Time Augmented MCUM.
State Mean Expected number Expected
ID residence time of visits residence time
S9998 0.00000 1.00000 0.00000
S1 9.00000 1.00000 9.00000
S234 10.0000 0.37538 3.75380
S4 0.01000 2.00000 0.02000
S9999 0.00000 1.00000 0.00000
Now have a look at the computations for a Time
Augmented MCUM, depicted in Table 2. All mea-
sures for the time are given in seconds. Now we can
see that for the given usage profile we would expect
to be in state S1 9 seconds in a typical test case and
3.75 seconds in state S234. Next we see that states
S9998, S9999 and S4 have less impact on the testing
time, though they are visited once or twice in each
test case. This information is valuable for the person
engaged to decide when to test and what to test and
to assess, if the usage profile is suitable to derive test
cases that meet the testing goals within time limits.
6 FUTURE WORK
The future work will focus on computations for the
test planing, integrating coverage aspects, and test
case generation strategies. The elaboration of timing
coverage criteria for functional requirements is neces-
sary. So test case generation strategies are developed
that should optimize the usage of the test benches,
considerung functional-based timing requirements.
7 CONCLUSIONS
In this paper an extension has been presented and
evaluated that integrates usage time in MCUMs. The
case study has been conducted with an example from
the automotive domain. Substantial advantages arised
from the application of our extension, since the inte-
grated time information can be used either for the test
planing or for the test case generation. In the first
case indicators such as test case length are not any
more abstract numbers, but provides the test designer
with information about the expected duration of a test
case. Secondly this information can be used by the
test case generation algorithms for one thing to gen-
erate test cases that are also variant in time and not
only in operations. For another thing test case gener-
ation algorithms can make use of this information to
generate test suites that meet test requirements within
time constraints in an optimal manner. In this way the
whole testing process can be supported by the pre-
sented approach.
REFERENCES
AUDI AG (2005). Spezifikation ESP Anzeige- und
Warnkonzept. 85057 Ingolstadt, Germany.
Beyer, M. and Dulz, W. (2005). Scenario-based statis-
tical testing of quality of service requirements. In
Springer LNCS 3466, International Dagstuhl Work-
shop on ”Scenarios: Model, Transformations and
Tools”, pages 152–173.
Dalal, S. R., Jain, A., Karunanithi, N., Leaton, J. M., Lott,
C. M., Patton, G. C., and Horowitz, B. M. (1999).
Model-based testing in practice. In ICSE ’99: Pro-
ceedings of the 21st international conference on Soft-
ware engineering, pages 285–294, New York, NY,
USA. ACM.
German, R. (2000). Performance Analysis of Communi-
cation Systems with Non-Markovian Stochastic Petri
Nets. John Wiley & Sons, Inc., New York, NY, USA.
Hierons, R. M., Bowen, J. P., Harman, M., Hierons, R. M.,
Bowen, J. P., and Harman, M. (2008). Formal Meth-
ods and Testing: An Outcome of the FORTEST Net-
work. Revised Selected Papers (Lecture Notes in Com-
puter Science). Springer Publishing Company, Incor-
porated.
Prowell, S. J. (2000). Computations for markov chain usage
models. Technical report, Software Engineering In-
stitute, Carnegie-Mellon University, Pittsburgh, USA.
UT-CS-03-505.
Prowell, S. J. (2004). State of the art of model-based testing
with markov chain usage models. Dagstuhl Seminar
04731, Perspectives on Model Based Testing.
Siegl, S. (2008). Evaluation of Model-Driven Test Case
Generation based on Markov-Chain Usage Models in
the Automotive Domain. Master’s thesis, Depart-
ment of Computer Science, University of Erlangen-
Nuremberg, Germany.
Wallentowitz, H. and Reif, K., editors (2006). Handbuch
Kraftfahrzeugelektronik: Grundlagen, Komponenten,
Systeme, Anwendungen. Vieweg, Wiesbaden.
MODEL DRIVEN TESTING WITH TIME AUGMENTED MARKOV CHAIN USAGE MODELS - Computations and
Test Case Generation Algorithms for Time Augmented Markov Chain Usage Models
207