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.

146 <strong>Testing</strong> Closed Systems<br />

Compile the stepper to a library. Reference the implementation in the compilation:<br />

csc /t:library /out:Stepper.dll ˆ<br />

/r:Server.dll /r:Client.dll ˆ<br />

/r:"%DEVPATH%\N<strong>Model</strong>.dll" ˆ<br />

Stepper.cs<br />

8.4 Test execution<br />

To execute a test suite, invoke the test runner tool ct, naming the stepper and the test<br />

suite. You do not need to name the model program; all of the information needed<br />

from the model program is already represented in the test suite. This command<br />

executes the test suite generated from the contract model program (Figure 8.1). 3<br />

ct /r:Stepper.dll<br />

/iut:ClientServerImpl.Stepper.Create /testSuite:ContractTest.txt<br />

When we execute this command, all of the tests succeed:<br />

TestResult(0, Verdict("Success"), "",<br />

Trace(<br />

Test(0),<br />

ServerSocket(),<br />

... etc.<br />

ClientClose()<br />

)<br />

...<br />

... etc.<br />

...<br />

TestResult(5, Verdict("Success"), "",<br />

...<br />

)<br />

)<br />

Next we execute the test suite generated from the client/server contract model<br />

program composed with the scenario machine (Figure 8.2):<br />

ct /r:Stepper.dll /iut:ClientServerImpl.Stepper.Create ˆ<br />

/testSuite:ScenarioTest.txt<br />

3 A complete command reference for ct appears in Appendix B.3.<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!