SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 104 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"

(We do not recommend
this, it is far more convenient to use the mpv (Model Program Viewer) tool, but here
we show how it can be done, to demonstrate that a model program is just a program.)
Figure 5.6 shows an NUnit test method that executes a simulation run. To make this
work, we have to produce a version of our model program that declares its methods
public, unlike Figures 5.4 and 5.5 and contrary to our usual recommendation to
use the default private access. This version also prints progress messages from each
Systems with Finite Models 71
action method. Before calling each action method, the test method calls NUnit??™s
IsTrue assertion to check the enabling condition. These checks ensure that the run
will succeed only if it executes a sequence of actions that is allowed by the model
program. If it attempts to execute a forbidden sequence, it will fail.
The test method shown in Figure 5.6 programs a run that the model program
should be able to execute. It encodes this sequence of actions:
ShowTitles(); SortByFirst(); SortByMostRecent(); ShowText();
This run succeeds. It produces this output:
Included categories: AllowedRun
.Topics, WithText, ByMostRecent: ShowTitles
Topics, TitlesOnly, ByMostRecent: SortByFirst
Topics, TitlesOnly, ByFirst: SortByMostRecent
Topics, TitlesOnly, ByMostRecent: ShowText
Tests run: 1, Failures: 0, Not run: 0, Time: 0.


Pages:
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6