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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

210 <strong>Testing</strong> Systems with Complex State<br />

12.5 Advanced on-the-fly settings<br />

The command-line utility ct is used throughout the book to illustrate how to run<br />

conformance tests against an implementation under test. The utility can be configured<br />

in several different ways, depending on the testing needs and requirements. In<br />

this section we take a closer look at the main configuration options, some aspects<br />

of the internal architecture, and some of the various extension points of the tool that<br />

can be used to implement more advanced testing heuristics.<br />

The modeling library can be used as a building block of a custom tool with<br />

more advanced features than ct. In particular, the ConformanceTester class that is<br />

used by ct has additional extension points that are not exposed through the settings<br />

for ct, but can be accessed programmatically. The ct utility is implemented by<br />

the static method RunWithCommandLineArguments of the ConformanceTester class<br />

in the N<strong>Model</strong>.Conformance namespace. This method creates an instance of the<br />

ConformanceTester class for a given stepper and strategy, configures its settings,<br />

and invokes its Run method.<br />

In the rest of this section we look at the following topics related to on-the-fly<br />

testing. Most of the topics are illustrated by using various settings of ct.<br />

• Specifying the model programs.<br />

• Test execution and termination.<br />

• The role of different kinds of actions.<br />

• More on strategies.<br />

– Using sampling.<br />

– Using action weights to match operational profiles.<br />

– Using state groupings to prune the search space.<br />

12.5.1 Specifying the model programs<br />

The main input to a model based on-the-fly testing algorithm is a model. In our<br />

case a model is given by one or more model programs. A model program can be<br />

provided either through a fully qualified name of a factory method, as a finite state<br />

machines (FSM) (by using the fsm option of ct) or in the form of an offline test<br />

suite (using the testSuite option). An FSM or an offline test suite is converted into<br />

an equivalent model program. If several model programs are given, say m1, m2, and<br />

m3, then they are composed into a single model program m = m1 ∗ m2 ∗ m3.<br />

Composing several model programs together can be used for different purposes,<br />

that has been illustrated on several occasions in previous chapters, and is discussed<br />

in more detail in Chapter 14. It is always possible to provide a factory method that<br />

creates a composed model program and one can provide that factory method as<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!