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

0<br />

Command()<br />

1<br />

Timeout() NoHandler() Command()<br />

22<br />

Timeout()<br />

2<br />

Reset()<br />

3<br />

Command()<br />

4<br />

TimeoutMsgLost() Message("999.9") NoHandler() Command()<br />

TimeoutMsgLate() Message("99.9")<br />

52<br />

TimeoutMsgLost() Message("999.9") TimeoutMsgLate()<br />

Message("99.9")<br />

8<br />

6<br />

5<br />

7<br />

NoHandler()<br />

NoHandler()<br />

19<br />

14<br />

Command()<br />

Command()<br />

20<br />

15<br />

Command() NoHandler() CheckMessage()<br />

Message("999.9") NoHandler() Command() Message("99.9")<br />

CheckMessage()<br />

21<br />

18<br />

Message("999.9") Message("99.9")<br />

16<br />

17<br />

CheckMessage()<br />

CheckMessage()<br />

9<br />

10<br />

Command()<br />

Command()<br />

11<br />

71<br />

Timeout() Command() Calibrate()<br />

Timeout() Command() Calibrate()<br />

13<br />

113<br />

Timeout()<br />

Timeout()<br />

12<br />

72<br />

Poll()<br />

Poll()<br />

23<br />

73<br />

Command()<br />

Command()<br />

Command()<br />

Command()<br />

24<br />

74<br />

TimeoutMsgLost()<br />

TimeoutMsgLate()<br />

NoHandler() Command() TimeoutMsgLost()<br />

Timeout()<br />

TimeoutMsgLost() TimeoutMsgLate()<br />

Timeout() NoHandler() Command() TimeoutMsgLost()<br />

31<br />

120<br />

TimeoutMsgLost()<br />

TimeoutMsgLate() TimeoutMsgLost()<br />

TimeoutMsgLost()<br />

TimeoutMsgLate() TimeoutMsgLost()<br />

25<br />

28<br />

75<br />

78<br />

ReportLostMessage()<br />

Poll()<br />

ReportLostMessage()<br />

ReportLostMessage() Poll()<br />

ReportLostMessage()<br />

30<br />

51<br />

83<br />

98<br />

Command()<br />

CheckMessage()<br />

Command()<br />

CheckMessage()<br />

32<br />

99<br />

Message("99.9")<br />

TimeoutMsgLate() Command() Calibrate()<br />

Calibrate() Command()<br />

Message("999.9") TimeoutMsgLate()<br />

36<br />

103<br />

Message("999.9")<br />

Message("99.9") TimeoutMsgLate()<br />

Message("99.9") NoHandler()<br />

NoHandler()<br />

Message("999.9") TimeoutMsgLate()<br />

Message("99.9")<br />

Message("999.9")<br />

35<br />

33<br />

101<br />

100<br />

NoHandler()<br />

Message("999.9")<br />

Message("99.9")<br />

NoHandler()<br />

Message("99.9")<br />

Message("999.9")<br />

37<br />

104<br />

Timeout()<br />

CheckMessage()<br />

Timeout()<br />

CheckMessage()<br />

39<br />

106<br />

Poll()<br />

Poll()<br />

40<br />

108<br />

Message("99.9")<br />

Command()<br />

Message("999.9")<br />

CheckMessage() Message("99.9")<br />

Message("999.9")<br />

Command()<br />

CheckMessage()<br />

42<br />

109<br />

Message("99.9")<br />

TimeoutMsgLost() TimeoutMsgLate()<br />

NoHandler() Command() TimeoutMsgLost() Message("999.9") Timeout() Command()<br />

Message("99.9")<br />

Message("999.9")<br />

Message("99.9") Message("999.9")<br />

TimeoutMsgLost()<br />

TimeoutMsgLate() Timeout() TimeoutMsgLost()<br />

NoHandler() Command() Message("99.9")<br />

Message("999.9") Command()<br />

50<br />

112<br />

TimeoutMsgLost()<br />

Timeout() TimeoutMsgLate() TimeoutMsgLost()<br />

Message("999.9")<br />

Message("99.9")<br />

TimeoutMsgLost() Timeout()<br />

TimeoutMsgLate() TimeoutMsgLost()<br />

Message("99.9")<br />

Message("999.9")<br />

43<br />

44<br />

26<br />

27<br />

110<br />

111<br />

77<br />

76<br />

ReportLostMessage()<br />

Poll()<br />

ReportLostMessage()<br />

CheckMessage()<br />

ReportLostMessage() Poll()<br />

ReportLostMessage()<br />

CheckMessage()<br />

46<br />

45<br />

29<br />

116<br />

115<br />

79<br />

Command()<br />

Command()<br />

Command()<br />

Command()<br />

Command()<br />

Command()<br />

47<br />

38<br />

53<br />

117<br />

105<br />

80<br />

TimeoutMsgLate()<br />

Calibrate() Command()<br />

Message("999.9")<br />

Command() Calibrate()<br />

Timeout() NoHandler() Command()<br />

Message("99.9") Command() Calibrate() TimeoutMsgLate()<br />

Command() Calibrate()<br />

NoHandler() Command() Timeout()<br />

49<br />

41<br />

55<br />

119<br />

107<br />

114<br />

TimeoutMsgLate()<br />

Message("999.9")<br />

Timeout()<br />

Message("99.9") TimeoutMsgLate()<br />

Timeout()<br />

48<br />

34<br />

54<br />

102<br />

118<br />

81<br />

CheckMessage()<br />

Reset()<br />

CheckMessage()<br />

Reset()<br />

56<br />

82<br />

Command()<br />

Command()<br />

57<br />

84<br />

Message("99.9") TimeoutMsgLate() Command() NoHandler() Message("999.9") TimeoutMsgLost() CheckMessage()<br />

CheckMessage()<br />

Message("999.9") TimeoutMsgLost() Message("99.9") NoHandler() Command() TimeoutMsgLate()<br />

63<br />

90<br />

Message("99.9") TimeoutMsgLate() TimeoutMsgLost() Message("999.9")<br />

Message("999.9") TimeoutMsgLost() Message("99.9") TimeoutMsgLate()<br />

60<br />

58<br />

61<br />

59<br />

86<br />

88<br />

87<br />

85<br />

NoHandler()<br />

NoHandler()<br />

NoHandler()<br />

NoHandler()<br />

62<br />

64<br />

89<br />

93<br />

Command()<br />

Command()<br />

Command()<br />

Command()<br />

67<br />

65<br />

91<br />

94<br />

Message("999.9") NoHandler() Command()<br />

Command() NoHandler() Message("99.9")<br />

NoHandler() Command()<br />

Message("999.9") Message("99.9") NoHandler() Command()<br />

70<br />

66<br />

92<br />

97<br />

Message("999.9")<br />

Message("99.9")<br />

Message("999.9") Message("99.9")<br />

68<br />

69<br />

95<br />

96<br />

Figure 6.12. Reactive system: True FSM showing accepting states and dead states.<br />

links connecting outside (lower left and lower right in Figure 6.12). This indicates<br />

that, depending on the first several actions at startup, the program permanently enters<br />

one or the other of two modes. In one of these modes, all of the states are dead states<br />

(lower left in Figure 6.12). Inspecting the FSM closely (magnifying and scrolling<br />

in mpv) reveals that the program enters this mode when the first temperature sample<br />

is out-of-range. After that the program cannot escape. This is the same behavior we<br />

observed in the InitialOutOfRangeMessage run we found by experimenting with the<br />

implementation, where an out-of-range temperature sample at startup is followed by<br />

a livelock where the program resets endlessly without making progress (Chapter 3,<br />

Section 3.4). Exploring interactively, we reproduce the InitialOutOfRangeMessage<br />

run (Figure 6.13). The cycle including the Reset action appears in the lower right<br />

of the diagram. Exploration finds that all of states on the frontier at lower left in<br />

this diagram are also dead states. They offer no escape; they only lead to longer<br />

cycles.<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!