The test runner indicates a test failure if the finish action returned by DoAction
does not match the finish action generated by the model program (e.g., if the
implementation returns a different value than the model program computed). That
is, how the model program acts as a test oracle.
The test runner also indicates a test failure if DoAction throws an exception. For
this reason, DoAction usually does not handle exceptions thrown by the implementation.
146 Testing Closed Systems
Compile the stepper to a library. Reference the implementation in the compilation:
csc /t:library /out:Stepper.dll ?†
/r:Server.dll /r:Client.dll ?†
/r:"%DEVPATH%\NModel.dll" ?†
Stepper.cs
8.4 Test execution
To execute a test suite, invoke the test runner tool ct, naming the stepper and the test
suite. You do not need to name the model program; all of the information needed
from the model program is already represented in the test suite. This command
executes the test suite generated from the contract model program (Figure 8.1).3
ct /r:Stepper.dll
/iut:ClientServerImpl.Stepper.Create /testSuite:ContractTest.txt
When we execute this command, all of the tests succeed:
TestResult(0, Verdict("Success"), "",
Trace(
Test(0),
ServerSocket(),
... etc.
ClientClose()
)
...
... etc.
...
TestResult(5, Verdict("Success"), "",
...
)
)
Next we execute the test suite generated from the client/server contract model
program composed with the scenario machine (Figure 8.
Pages:
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214