The test suite in Figure 8.1 describes many similar runs because it was generated
from the true FSM of the contract model program, without using any scenario
control. It is likely that a smaller test suite would be as effective in detecting defects,
for the reasons explained in Chapter 7, Section 7.1.
We can generate a smaller test suite by using scenario control. Let us generate a
test suite from the client/server contract model program composed with the scenario
machine developed in Chapter 7, Section 7.3.3. The FSM of the composition is
shown in Figure 7.15. This command generates the test suite.
otg /r:ClientServer.dll ClientServer.Factory.Create ?†
/fsm:Scenario.txt ?†
/file:ScenarioTest.txt
Figure 8.2 shows the generated test suite. There is just a single run, because all
the states and transitions in the FSM of the composition can be visited by traversing
a single path from the initial state to the accepting state, including each of the loops
in the middle of the FSM (Figure 7.15 in Chapter 7).
Other traversal algorithms are possible. In addition to the postman tour, modelbased
offline test generators sometimes provide random traversals, traversals that
cover the shortest path to an accepting state (or some other interesting state), or
traversals that achieve transition coverage but with an upper limit on the length of
each test case (which generates more runs, but shorter runs, than does the postman
tour).
Pages:
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205