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.

Systems with Finite <strong>Model</strong>s 125<br />

0 C()<br />

A()<br />

1<br />

B(2)<br />

C()<br />

2 C()<br />

Figure 7.9. Loop extension of model program M1.<br />

0 A()<br />

B(_) C()<br />

1<br />

A()<br />

Figure 7.10. Loop extension of model program M2.<br />

Each state in the product is a pair state formed from a state in M1 and a state in M2<br />

(Figure 7.11). Form the initial pair state (0, 0) from the initial states of M1 and M2.<br />

Generate the rest of the product by exploring from the initial pair state. Each action<br />

that is enabled in a pair state must be enabled in both corresponding states in the loop<br />

extensions of both programs. Here action A() is the only action which is enabled<br />

in the initial states of both programs; C() and B( ) are only enabled in M1 and M2,<br />

respectively. Executing action A() makes the transition to state 1 in M1 and makes a<br />

self-loop transition back to state 0 in M2, so in the product A() makes the transition<br />

to the pair state (1, 0). In this state, B(2) is enabled in M1 and B( ) is enabled in<br />

M2. These two actions match because their names are the same, and a placeholder<br />

matches any argument; here the placeholder in B( ) matches the argument in B(2).<br />

These actions make transitions to states 2 and 1 in M1 and M2 respectively, resulting<br />

in the pair state (2, 1) in the product. The action which appears in the product is B(2),<br />

not the action B( ) with the placeholder. In the pair state (2, 1), C() is enabled in both<br />

programs, making a final transition to the pair state (2, 0) in the product. In that pair<br />

state, there are no actions that are enabled in both programs, so exploration stops;<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!