27.07.2013 Views

2 Why We Need Model-Based Testing

2 Why We Need Model-Based Testing

2 Why We Need Model-Based Testing

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Systems with Complex State 217<br />

"b". The second test case is to add two "b"’s and then delete two "b"’s. This is an<br />

FSM that represents these two test cases:<br />

FSM(0,AcceptingStates(S(1,2),S(2,4)),<br />

Transitions(t(0,Test(1),S(1,0)), t(S(1,0),Add("b"),S(1,1)),<br />

t(S(1,1),Delete("b"),S(1,2)),<br />

t(0,Test(2),S(2,0)), t(S(2,0),Add("b"),S(2,1)),<br />

t(S(2,1),Add("b"),S(2,2)),<br />

t(S(2,2),Delete("b"),S(2,3)),<br />

t(S(2,3),Delete("b"),S(2,4))))<br />

In this case Test is an internal action symbol. The purpose of the Test(k) action is to<br />

select the test case that performs k add operations followed by k delete operations.<br />

The action Test(k) is itself not related to any operation that the IUT must perform.<br />

Cleanup actions. Another classification of tester actions that is commonly used in<br />

on-the-fly testing is to mark certain actions as cleanup actions. The purpose of a<br />

cleanup action is to help to drive the model program into an accepting state to finish<br />

off a test run. After the desired number of steps has been reached in a test run, but<br />

the strategy is not yet in an accepting state, then only cleanup actions are enabled.<br />

This part of the test execution algorithm has been omitted in Figure 12.7. In the bag<br />

example, Delete should be marked as a cleanup action symbol, but not Add.<br />

12.5.4 More on strategies<br />

Implementing a particular strategy is the most flexible way of creating a customized<br />

on-the-fly testing algorithm.<br />

Sampling. The technique that was illustrated in Section 12.4 uses a particular<br />

sampling algorithm. There are many different ways to implement similar algorithms<br />

that may, for example, keep more tester state and use other criteria besides rewards<br />

to select actions. One may, for example, assign penalties to certain actions or action<br />

paths in order to avoid failures that have already been discovered. This is useful if<br />

on-the-fly testing is used as a stress testing tool that may run millions of test runs.<br />

In that case it is desirable not to run into the same error over and over again.<br />

Using action weights to match operational profiles. Another technique that can<br />

be implemented with a custom strategy is the use of decrementing action weights.<br />

The idea is the following. Let us for simplicity assume that all actions are without<br />

parameters, the idea can be generalized for actions with parameters, or it can be<br />

applied to action symbols only by ignoring the parameters. Imagine that there is a<br />

more free ebooks download links at:<br />

http://www.ebook-x.com

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

Saved successfully!

Ooh no, something went wrong!