Tuesday, December 16, 2008

Basis Path Testing

Basis Path Testing
Aim is to derive a logical complexity measure of a procedural design and use this as a guide for defining a basic set of execution paths.
Test cases which exercise basic set will execute every statement at least once.

a. Flow Graph Notation

Notation for representing control flow
On a flow graph:
1. Arrows called edges represent flow of control
2. Circles called nodes represent one or more actions.
3. Areas bounded by edges and nodes called regions.
4. A predicate node is a node containing a condition

Any procedural design can be translated into a flow graph.Note that compound Boolean expressions at tests generate at least two predicate node and additional arcs.

b. Cyclomatic Complexity

The cyclomatic complexity gives a quantitative measure of the logical complexity.

This value gives the number of independent paths in the basis set, and an upper bound for the number of tests to ensure that each statement is executed at least once.

An independent path is any path through a program that introduces at least one new set of processing statements or a new condition (i.e., a new edge)

Example has:

1. Cyclomatic Complexity of 4. Can be calculated as:
1. Number of regions of flow graph.
2. #Edges - #Nodes + 2
3. #Predicate Nodes + 1

2. Independent Paths:

1. 1, 8
2. 1, 2, 3, 7b, 1, 8
3. 1, 2, 4, 5, 7a, 7b, 1, 8
4. 1, 2, 4, 6, 7a, 7b, 1, 8

Cyclomatic complexity provides upper bound for number of tests required to guarantee coverage of all program statements.

c. Deriving Test Cases

1. Using the design or code, draw the corresponding flow graph.
2. Determine the cyclomatic complexity of the flow graph.
3. Determine a basis set of independent paths.
4. Prepare test cases that will force execution of each path in the basis set.

Note: some paths may only be able to be executed as part of another test.



Software Testing Training


Our Software Testing Partner
Software testing institute


corporate training software testing



For More Visit Site
http://www.qacampus.com

For discussion FORUM
http://www.qacampus.com/forum

No comments: