2 Why We Need Model-Based Testing
2 Why We Need Model-Based Testing
2 Why We Need Model-Based Testing
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
48 <strong>Why</strong> <strong>We</strong> <strong>Need</strong> <strong>Model</strong>-<strong>Based</strong> Analysis<br />
TimeoutMsgLate()<br />
Message("99.9")<br />
CheckMessage()<br />
Message("99.9")<br />
TimeoutMsgLost()<br />
TimeoutMsgLate()<br />
TimeoutMsgLost()<br />
43<br />
ReportLostMessage() Poll()<br />
46<br />
Command()<br />
47<br />
Calibrate() Command()<br />
49<br />
TimeoutMsgLate()<br />
Message("999.9")<br />
48<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 />
Message("999.9") NoHandler() Command() TimeoutMsgLost() TimeoutMsgLate() Message("99.9")<br />
52<br />
Message("999.9")TimeoutMsgLost() TimeoutMsgLate() Message("99.9")<br />
6<br />
8<br />
5<br />
7<br />
NoHandler()<br />
NoHandler()<br />
19<br />
14<br />
Command()<br />
Command()<br />
20<br />
15<br />
CheckMessage()<br />
NoHandler() Command()<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() NoHandler() Command() TimeoutMsgLost()<br />
Timeout()<br />
TimeoutMsgLost()<br />
TimeoutMsgLate()<br />
NoHandler() Command()<br />
TimeoutMsgLost() Timeout()<br />
31<br />
120<br />
TimeoutMsgLost()<br />
TimeoutMsgLate() TimeoutMsgLost()<br />
TimeoutMsgLost()<br />
TimeoutMsgLate() TimeoutMsgLost()<br />
25<br />
28<br />
75<br />
78<br />
Poll()<br />
ReportLostMessage()<br />
ReportLostMessage()<br />
Poll()<br />
ReportLostMessage()<br />
ReportLostMessage()<br />
30<br />
51<br />
83<br />
98<br />
Command()<br />
Command()<br />
32<br />
99<br />
Message("99.9") TimeoutMsgLate() Calibrate() Command()<br />
TimeoutMsgLate() Calibrate() Command() Message("999.9")<br />
CheckMessage()<br />
36<br />
103<br />
Message("999.9")<br />
Message("99.9") TimeoutMsgLate()<br />
Message("99.9")<br />
NoHandler()<br />
TimeoutMsgLate() Message("999.9")<br />
35<br />
33<br />
100<br />
101<br />
NoHandler()<br />
Message("999.9") Message("99.9")<br />
NoHandler()<br />
NoHandler()<br />
Message("99.9")<br />
Message("999.9")<br />
37<br />
104<br />
Timeout()<br />
CheckMessage()<br />
Command()<br />
Message("99.9") Message("999.9")<br />
39<br />
105<br />
Poll()<br />
Command() Calibrate() Timeout()<br />
CheckMessage()<br />
40<br />
107<br />
Command()<br />
Message("999.9")<br />
CheckMessage()<br />
Timeout()<br />
42<br />
106<br />
Message("999.9")<br />
NoHandler() Command()<br />
TimeoutMsgLost() Timeout() Message("99.9") Command() Message("999.9")<br />
Message("99.9")<br />
Message("999.9")<br />
Poll()<br />
CheckMessage()<br />
50<br />
108<br />
TimeoutMsgLate() Message("999.9") Timeout() TimeoutMsgLost()<br />
Message("99.9")<br />
Message("99.9") Message("999.9") Command()<br />
Command()<br />
26<br />
44<br />
27<br />
109<br />
ReportLostMessage()<br />
CheckMessage()<br />
Timeout() TimeoutMsgLost()<br />
TimeoutMsgLost() TimeoutMsgLate() Command() NoHandler()<br />
Message("99.9")<br />
Message("999.9")<br />
45<br />
29<br />
112<br />
Command()<br />
Command()<br />
TimeoutMsgLost() TimeoutMsgLate() TimeoutMsgLost()<br />
Message("99.9")<br />
Message("999.9")<br />
38<br />
53<br />
111<br />
110<br />
77<br />
76<br />
Message("999.9")<br />
Calibrate() Command()<br />
Command() NoHandler() Timeout()<br />
ReportLostMessage() ReportLostMessage()<br />
Poll()<br />
CheckMessage()<br />
41<br />
55<br />
115<br />
116<br />
79<br />
Timeout()<br />
Command()<br />
Command()<br />
34<br />
54<br />
117<br />
80<br />
Reset()<br />
CheckMessage()<br />
Message("99.9")<br />
Command() Calibrate()<br />
TimeoutMsgLate()<br />
Command() NoHandler() Timeout()<br />
56<br />
119<br />
114<br />
Command()<br />
Message("99.9")<br />
TimeoutMsgLate()<br />
Timeout()<br />
57<br />
102<br />
118<br />
81<br />
CheckMessage()<br />
TimeoutMsgLost() TimeoutMsgLate() Command() NoHandler() Message("99.9") Message("999.9")<br />
CheckMessage()<br />
Reset()<br />
63<br />
82<br />
TimeoutMsgLost() TimeoutMsgLate() Message("99.9")<br />
Message("999.9")<br />
Command()<br />
61<br />
58<br />
60<br />
59<br />
84<br />
NoHandler()<br />
NoHandler()<br />
CheckMessage()<br />
Message("999.9") Command() NoHandler() TimeoutMsgLate() Message("99.9") TimeoutMsgLost()<br />
64<br />
62<br />
90<br />
Command()<br />
Command()<br />
Message("999.9") TimeoutMsgLate() Message("99.9") TimeoutMsgLost()<br />
65<br />
67<br />
86<br />
85<br />
87<br />
88<br />
NoHandler() Command()<br />
Message("99.9") Message("999.9") NoHandler() Command()<br />
NoHandler()<br />
NoHandler()<br />
66<br />
70<br />
93<br />
89<br />
Message("99.9") Message("999.9")<br />
Command()<br />
Command()<br />
69<br />
68<br />
94<br />
91<br />
Message("999.9") Message("99.9") NoHandler() Command()<br />
NoHandler() Command()<br />
97<br />
92<br />
Message("999.9") Message("99.9")<br />
95<br />
96<br />
Figure 3.8. Controller FSM showing unsafe states.<br />
Figure 3.8 shows the entire FSM of our model program. Figures 3.9–3.11 display<br />
portions of the FSM that show paths to interesting states. Each path through the<br />
FSM is a possible run of the system. The FSM represents all possible runs of this<br />
system. There are 121 states and 239 transitions between states. The model program<br />
has to have some additional methods and variables (which do not appear in the<br />
implementation) that represent the environment where the controller runs, including<br />
the timer and sensor. Therefore, the actions in the diagrams include some that do not<br />
appear in the controller implementation. For example, our implementation’s Timeout<br />
event must be represented here by Timeout, TimeoutMsgLate, and TimeoutMsgLost.<br />
<strong>We</strong> also need a NoHandler action here to represent what happens when no handler<br />
is enabled.<br />
For safety analysis, the mpv tool searches for unsafe states where the controller<br />
attempts to calculate the calibration factor when the temperature sample is<br />
more free ebooks download links at:<br />
http://www.ebook-x.com