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 265 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

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

The simplest example of a coverage function is one that
returns a bag containing just the action symbol. In other words, it is ignored
from which state the action is explored and what arguments the action takes.
Bag GetVocabularyCoverage(IState s, Action a)
{ return new Bag(a.FunctionSymbol.AsTerm); }
Annotation coverage. Suppose you want to cover different cases or code
branches inside one action method. You can annotate the model program with
explicit coverage points using the Execute.AddCoveragePoint method in order
to record what case has been taken. The following example shows how to annotate
the bag model in Figure 12.2 with two coverage points that distinguish
between the two cases when an element that is to be deleted occurs in the bag
or does not occur in the bag.
[Action]
static void Delete(string element)
{
1 A method type such as CoverageFunction is called a delegate in .NET.
Systems with Complex State 205
if (content.Contains(element))
{
Execute.AddCoveragePoint("in the bag")
content = content.Remove(element);
}
else
Execute.AddCoveragePoint("not in the bag")
}
You can define a method GetCoveragePoints in your custom strategy as
follows. (A concrete example of a custom strategy definition is shown in the
next section.) It is assumed here that the strategy has a field called model
that references a given model program.


Pages:
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6