07.12.2012 Views

Structured Testing - McCabe and Associates

Structured Testing - McCabe and Associates

Structured Testing - McCabe and Associates

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6 The Baseline Method<br />

The baseline method, described in this section, is a technique for identifying a set of control<br />

paths to satisfy the structured testing criterion. The technique results in a basis set of test<br />

paths through the module being tested, equal in number to the cyclomatic complexity of the<br />

module. As discussed in section 2, the paths in a basis are independent <strong>and</strong> generate all paths<br />

via linear combinations. Note that “the baseline method” is different from “basis path testing.”<br />

Basis path testing, another name for structured testing, is the requirement that a basis set<br />

of paths should be tested. The baseline method is one way to derive a basis set of paths. The<br />

word “baseline” comes from the first path, which is typically selected by the tester to represent<br />

the “baseline” functionality of the module. The baseline method provides support for<br />

structured testing, since it gives a specific technique to identify an adequate test set rather than<br />

resorting to trial <strong>and</strong> error until the criterion is satisfied.<br />

6.1 Generating a basis set of paths<br />

The idea is to start with a baseline path, then vary exactly one decision outcome to generate<br />

each successive path until all decision outcomes have been varied, at which time a basis will<br />

have been generated. To underst<strong>and</strong> the mathematics behind the technique, a simplified version<br />

of the method will be presented <strong>and</strong> prove that it generates a basis [WATSON5]. Then,<br />

the general technique that gives more freedom to the tester when selecting paths will be<br />

described. Poole describes <strong>and</strong> analyzes an independently derived variant in [NIST5737].<br />

6.2 The simplified baseline method<br />

To facilitate the proof of correctness, the method will be described in mathematical terms.<br />

Readers not interested in theory may prefer to skip to section 6.3 where a more practical presentation<br />

of the technique is given.<br />

In addition to a basis set of paths, which is a basis for the rows of the path/edge matrix if all<br />

possible paths were represented, it is possible to also consider a basis set of edges, which is a<br />

basis for the columns of the same matrix. Since row rank equals column rank, the cyclomatic<br />

complexity is also the number of edges in every edge basis. The overall approach of this section<br />

is to first select a basis set of edges, then use that set in the algorithm to generate each<br />

successive path, <strong>and</strong> finally use the resulting path/edge matrix restricted to basis columns to<br />

show that the set of generated paths is a basis.<br />

41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!