07.01.2013 Views

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Generat<strong>in</strong>g FSMs out of ASMs<br />

14 Tools for Test Case Generation 413<br />

In the follow<strong>in</strong>g we will try to sketch the extraction process which generates an<br />

FSM out of a given ASM specification. This is the crucial step because it highly<br />

depends on user-def<strong>in</strong>ed and doma<strong>in</strong>-specific conditions to guide the extraction.<br />

The quality of these conditions determ<strong>in</strong>es whether the result<strong>in</strong>g FSM is an<br />

appropriate abstraction of the ASM and if the extraction algorithm term<strong>in</strong>ates<br />

at all.<br />

If one is not familiar with ASMs just th<strong>in</strong>k of it as a simple programm<strong>in</strong>g<br />

language with variables, functions/methods, some control structure like<br />

an if-then-else, loops, etc. Now every action of the SUT is specified as follows:<br />

if g1 then R1<br />

...<br />

if gk then Rk<br />

where the gi are boolean guards and the Ri are further <strong>in</strong>structions which are<br />

not allowed to make use of the if-then-else construct anymore (this is a k<strong>in</strong>d<br />

of normal form, one can be less strict when specify<strong>in</strong>g). As expected the <strong>in</strong>itial<br />

values of the variables determ<strong>in</strong>e the <strong>in</strong>itial state of a program run. When an<br />

action a is executed the program moves to a next state, which can be seen as a<br />

transition with label a between two program states.<br />

The ma<strong>in</strong> problem is that such an ASM has usually an <strong>in</strong>f<strong>in</strong>ite number of<br />

reachable states (unless all possible runs term<strong>in</strong>ate). Hence it is necessary to reduce<br />

the number of states by group<strong>in</strong>g them accord<strong>in</strong>g to a suitable equivalence<br />

relation. To get a satisfy<strong>in</strong>g result this relation must guarantee that firstly the<br />

number of result<strong>in</strong>g equivalence classes (also called hyperstates) is f<strong>in</strong>ite, otherwise<br />

the algorithm does not term<strong>in</strong>ate. Secondly the number should not be too<br />

small, i.e. the result does not reflect a mean<strong>in</strong>gful test purpose anymore. In fact<br />

you can consider the def<strong>in</strong>ition of the equivalence relation as a k<strong>in</strong>d of very general<br />

test purpose def<strong>in</strong>ition, respectively test selection. The result<strong>in</strong>g hyperstates<br />

basically become the states of the generated FSM.<br />

The equivalence relation is based on a set of boolean conditions {b1,...,bn}.<br />

Two states of the ASM lay <strong>in</strong> the same class iff none of the bi dist<strong>in</strong>guishes them.<br />

Therefore at most 2 n hyperstates are possibly reachable. For example take the<br />

gi of the action specifications as mentioned above as a base for the condition-set.<br />

Us<strong>in</strong>g them one can def<strong>in</strong>e that states differ (represent different hyperstates) iff<br />

their sets of executable actions differ. Other obvious selections are conceivable.<br />

Beside the potentially exponential number of result<strong>in</strong>g hyperstates the problem<br />

of comput<strong>in</strong>g the so called true-FSM, whichcoversallreachablehyperstates,is<br />

undecidable (and <strong>in</strong> a bounded version still NP-hard).<br />

The extract<strong>in</strong>g algorithm which computes the FSM does a k<strong>in</strong>d of graph<br />

reachability analysis. A pragmatic solution to the stated problems is to additionally<br />

def<strong>in</strong>e a so called relevance condition which tells the extraction algorithm if<br />

the actually encountered ASM-state is worth be<strong>in</strong>g taken <strong>in</strong>to account for fur-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!