White Box Testing

Black-box testing is concerned with functionality rather than implementation of the
program. White-box testing, on the other hand, is concerned with testing the
implementation of the program.
· The intent of white-box testing is not to exercise all the different input or output
conditions but to exercise the different programming structures and data structures used
in the program. White-box testing is also called structural testing

White-box testing method: Basis Path Testing (M. IMP)
Basis path testing is a white-box testing technique where the test cases derived to exercise the basis set are guaranteed to execute every statement in the program at least one time during testing.
The basis path method uses a simple notation for the representation of control flow, called a flow graph (or program graph). The flow graph depicts logical control flow using the notation illustrated in Figure below.Untitled
Step 1: Using the code, draw a corresponding flow graph.
Step 2: Calculate Cyclomatic Complexity of the resultant flow graph.
Cyclomatic complexity is software metric that provides a quantitative measure of the
logical complexity of a program.
When used in the terms of the basis path testing method, the value computed for
cyclomatic complexity defines the number of independent paths in the basis set of a
program and provides us with an upper bound for the number of tests that must be
conducted to ensure that all statements have been executed at least once.
Complexity is computed in one of two ways:
1. Cyclomatic complexity, V(G), for a flow graph, G, is defined as V(G) = E – N + 2
where E is the number of flow graph edges, N is the number of flow graph nodes.
2. Cyclomatic complexity, V(G), for a flow graph, G, is also defined as V(G) = P + 1
where P is the number of predicate nodes contained in the flow graph G.
Step 3: Determine a basis set of independent paths.
Step 4: Prepare test cases that will force execution of each path in the basis set.

White-box testing method: Statement coverage
The statement coverage strategy aims to design test cases so that every statement in a program is executed at least once. The principal idea governing the statement coverage strategy is that unless a statement is executed, it is very hard to determine if an error exists in that statement.
White-box testing method: Condition coverage
In this structural testing, test cases are designed to make each component of a composite
conditional expression to assume both true and false values. For example, in the conditionalexpression ((c1 AND c2)) OR c3) the components c1, c2 and c3 are each made to assume bothtrue and false values.
White-box testing method: Branch coverage
In the branch coverage-based testing strategy, test cases are designed to make each branch condition to assume true and false values in turn. Branch testing is also known as edge testing.

Leave a comment