Site icon TestingDocs.com

Basis Path Testing

Overview

Basis path testing is a white box testing technique that enables the test designer to derive a logical complexity measure and use it to define a basis set of execution paths.

Cyclomatic Complexity

The Cyclomatic Complexity metric is a software metric that provides a quantitative measure of the logical complexity of a program. The value computed for cyclomatic complexity defines the number of independent paths in the basis set of a program and provides the upper bound for the number of tests that must be conducted to guarantee that all statements have been executed at least once.

Independent path

An independent path is any path through the program that introduces at least one new statement or condition. Regarding a flow graph, an independent path must move along at least one edge that has not been traversed before.

Formula

Cyclomatic complexity is computed in one of the following ways:

The number of regions of the flow graph corresponds to the cyclomatic complexity.

Cyclomatic Complexity, V( G ), for a flow graph G is defined as:

V( G ) = E – N + 2

where

 

Cyclomatic complexity, V( G ), for a flow graph G is defined as:

V( G ) = P + 1

where

 

The value for V( G ) provides an upper bound on the number of tests that must be designed and executed to guarantee coverage of all program statements.

Basis Path Testing

Test cases derived from exercising the basis paths are guaranteed to execute every statement in the program at least once during testing.

Test cases

The basis path testing method can be applied in the following way:

Exit mobile version