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

Create successful ePaper yourself

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

216 <strong>Testing</strong> Systems with Complex State<br />

steps. When that lower limit is reached, the algorithm tries to reach an accepting<br />

state without exceeding an upper limit maxSteps on the number of actions. The<br />

InvokeStepper method uses a worker thread to invoke the stepper to do the given<br />

action in the implementation. This thread calls the DoAction method in the stepper<br />

(see Figure 12.4, for example). If the invocation does not return within a time limit<br />

given by the timeout option of ct, then the test run fails.<br />

12.5.3 Classification of actions<br />

Actions are generally divided into controllable and observable ones. The option<br />

observableAction of ct is used to declare that an action symbol is observable.<br />

Moreover, controllable actions can be classified as being internal, using the<br />

internalAction option of ct. Furthermore, controllable actions can also be marked<br />

as being cleanup actions, using the cleanupAction option of ct.<br />

Controllable and observable actions. In a closed system it is generally assumed<br />

that all actions are controlled by the tester; that is, all action symbols are assumed to<br />

be controllable. Controllable action symbols are also called tester action symbols.<br />

A tester action or a controllable action is an action that has a controllable action<br />

symbol. An exception to this general rule are finish action symbols that are typically<br />

classified as being observable because they are returned by the stepper. An<br />

action with an observable action symbol is called an observable action. The general<br />

treatment of observable actions is deferred to Chapter 16.<br />

In the case of the bag example the action symbols Lookup Finish and Count<br />

Finish are observable because the corresponding actions are returned by the stepper.<br />

Notice, however, that even if the finish actions are considered as controllable<br />

actions, the algorithm in Figure 12.7 will work in exactly the same way, because<br />

the strategy cannot be in a state where SelecAction is called and a finish action is<br />

enabled, unless the stepper is faulty and returns null when a finish action should be<br />

returned.<br />

Internal actions. Tester actions are generally divided into two categories: the actions<br />

that are related to an operation that the IUT must perform, and the actions<br />

that are not related to any such operation. The latter case arises when the action is<br />

used for making internal choices in the model or scenario. Such actions are called<br />

internal. An internal action is not executed in the stepper, which can be seen in the<br />

algorithm in Figure 12.7. A typical case where internal actions arise are in selecting<br />

a test case in a test suite. Suppose, for example, that you have the following two test<br />

cases for the bag example. The first test case is to add one "b" and then delete one<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!