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.

52 <strong>Why</strong> <strong>We</strong> <strong>Need</strong> <strong>Model</strong>-<strong>Based</strong> Analysis<br />

This FSM expresses all possible behaviors of the controller, so the analysis here<br />

is complete and conclusive. This is possible because our control program has only<br />

a few variables, each with just a few values, so it can be explored exhaustively<br />

(completely). Our techniques can also be applied to systems that cannot be explored<br />

exhaustively. <strong>We</strong> can configure exploration to achieve a degree of coverage that,<br />

although incomplete, is still capable of revealing many defects (Chapter 11).<br />

3.8 Exercises<br />

1. Write down another run that could be executed by the controller code, which<br />

violates the safety requirement given at the beginning of Section 3.1. Your run<br />

must be different from both the run OutOfRangeMessageWhenIdle in Section 3.4<br />

and the shortest path run found by the tool in Section 3.7. Confirm your run by<br />

writing a unit test or by executing it in the simulator.<br />

2. Write down a run that causes the controller to crash (throw an unhandled exception).<br />

Confirm your run by writing a unit test or by executing it in the simulator.<br />

Hint: see CheckMessage.<br />

3. Show how to revise Controller.cs so the controller satisfies the safety and<br />

liveness requirements given at the end of Section 3.1. Show each difference<br />

(the contents and location of each statement that must be added, removed, or<br />

changed). Hint: use the design rules given in Section 3.6.<br />

Keep your revised program to use with exercises in chapters to come.<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!