0% found this document useful (0 votes)
26 views

White Box Testing

White box testing involves basis path testing to test each independent path in a program's control flow graph. This involves: 1. Creating a control flow graph from the code or flowchart 2. Calculating cyclomatic complexity to determine the number of independent paths 3. Designing test cases for each independent path Control structure testing increases coverage by testing conditions, loops, and data flows. It involves condition testing to exercise logical conditions and loop testing for the validity of loop construction, including simple, concatenated, and nested loops.

Uploaded by

Karthi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

White Box Testing

White box testing involves basis path testing to test each independent path in a program's control flow graph. This involves: 1. Creating a control flow graph from the code or flowchart 2. Calculating cyclomatic complexity to determine the number of independent paths 3. Designing test cases for each independent path Control structure testing increases coverage by testing conditions, loops, and data flows. It involves condition testing to exercise logical conditions and loop testing for the validity of loop construction, including simple, concatenated, and nested loops.

Uploaded by

Karthi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

WHITE BOX TESTING

BASIS PATH TESTING

In this technique, control flow graphs are made from code or flowchart and then
Cyclomatic complexity is calculated which defines the number of independent
paths so that the minimal number of test cases can be designed for each
independent path.
Steps:
1. Make the corresponding control flow graph
2. Calculate the cyclomatic complexity
3. Find the independent paths
4. Design test cases corresponding to each independent path

Flow graph notation: It is a directed graph consisting of nodes and edges.


Each node represents a sequence of statements, or a decision point. A
predicate node is the one that represents a decision point that contains a
condition after which the graph splits. Regions are bounded by nodes and
edges. The arrows on the flow graph, called edges or links, represent flow of
con-trol. The flow graph depicts logical control flow using the notation illustrated
in Figure 18.1.
Cyclomatic Complexity: It is a measure of the logical complexity of the
software and is used to define the number of independent paths. For a graph G,
V(G) is its cyclomatic complexity.
Calculating V(G):
1. V(G) = P + 1, where P is the number of predicate nodes in the flow graph
2. V(G) = E – N + 2, where E is the number of edges and N is the total number
of nodes
3. V(G) = Number of non-overlapping regions in the graph
CONTROL STRUCTURE TESTING
Control structure testing is used to increase the coverage area by testing various control
structures present in the program. The different types of testing performed under control
structure testing are as follows-
1. Condition Testing
2. Data Flow Testing
3. Loop Testing

1. Condition testing is a test construction method that focuses on exercising the logical
conditions in a program module.

Errors in conditions can be due to:

 Boolean operator error


 Boolean variable error
 Boolean parenthesis error
 Relational operator error
 Arithmetic expression error

2. Loop Testing : Loop testing is actually a white box testing technique. It specifically focuses
on the validity of loop construction. Following are the types of loops.
1. Simple Loop – The following set of test can be applied to simple loops, where the
maximum allowable number through the loop is n.
1. Skip the entire loop.
2. Traverse the loop only once.
3. Traverse the loop two times.
4. Make p passes through the loop where p<n.
5. Traverse the loop n-1, n, n+1 times.
2. Concatenated Loops – If loops are not dependent on each other, contact loops can be
tested using the approach used in simple loops. if the loops are interdependent, the steps are
followed in nested loops.
3. Nested Loops – Loops within loops are called as nested loops. when testing nested loops,
the number of tested increases as level nesting increases. The following steps for testing
nested loops are as follows-
1. Start with inner loop. set all other loops to minimum values.
2. Conduct simple loop testing on inner loop.
3. Work outwards.
4. Continue until all loops tested.
4. Unstructured loops – This type of loops should be redesigned, whenever possible, to
reflect the use of structured programming constructs

You might also like