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 63<br />

conditions, which allow the sequence of method calls to be chosen at run time by<br />

the tool that executes the model program, or by the environment where the model<br />

program runs.<br />

5.3.4 Select the actions<br />

It is often easier to select the actions first, because we can identify them by simply<br />

observing the behavior. Recall that we choose a high level of behavioral abstraction<br />

where each action is the selection of an option that causes a new screen to appear.<br />

<strong>We</strong> select these actions:<br />

The SelectMessages and SelectTopics actions select those pages; these are the<br />

actions that occur when users click on a topic title or the group name, respectively.<br />

ShowTitles and ShowText select the details shown on the topics page. SortByFirst<br />

and SortByMostRecent select the sort order for the topics page when the titles only<br />

are shown.<br />

The name of an action is called an action symbol. The entire collection of action<br />

symbols used by a model program is called its action vocabulary or just its<br />

vocabulary.<br />

5.3.5 Write sample traces<br />

Now that we have identified the actions, we can describe the behavior. Drawing on<br />

our observations and understanding of how the system is supposed to behave, we<br />

write down some traces that the system can execute and that the model program<br />

must also be able to execute. Each trace is simply a sequence of (some of) the actions<br />

from the vocabulary we identified. Here is a sample trace:<br />

ShowTitles(); SortByFirst(); SortByMostRecent(); ShowText();<br />

Not all sequences are allowed, because not all actions are available or enabled in<br />

each state. It is also useful to write down some traces that the model program must<br />

not be able to execute. For example:<br />

ShowTitles(); SortByFirst(); SortByFirst(); ShowText();<br />

The system cannot execute this trace because there are two SortByFirst actions in<br />

succession. After the first, this action is no longer enabled.<br />

It is helpful to refer to these sample traces as we continue the preliminary analysis<br />

and then code the model program. It can also be helpful at this stage to make a table<br />

or a diagram that summarizes many traces, as we show in Chapter 6.<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!