Professional Documents
Culture Documents
Testing Techniques
1. Dynamic Testing
1. Black-Box
2. White-Box
2. Static Testing
3. Validation Testing
4. Regression Testing
White-Box Testing
• It is another dynamic testing technique
• It is also called “structural” or “development” testing as it
is mainly used by developers to test the entire design,
structure and code of software. Here, the term software
structure refers to the logic of the program.
• It is also known as “glass-box testing because everything
required to implement the software is visible.
• White-box testing ensures that all the internal parts of
the software are adequately tested
– But these two test cases will not execute the THEN clause
of if statement
• So, decision / condition coverage considers all possible
outcomes of each condition at least once and all possible
outcomes of each decision at least once
• There for test cases can be designed as follows to cover both
conditions and decision
Multiple Condition Coverage
• Multiple condition coverage requires that ,
we should design sufficient test cases such
that all possible combinations of condition
outcomes in each decision and all point of
entry are invoked at least once
• • Example :
– For the decision if ( A && B ) ,the following test
cases can be designed :
White box testing techniques
1. Basis path testing
2. Data flow Testing ( Static data flow
testing & Dynamic data flow testing )
3. Mutation Testing
Basis path testing
• Basis path testing is the oldest structural testing
technique
• It is based on control structure of the program
• Basis path testing is the technique of selecting the
paths that provide a basis set of execution paths
through the program.
• A flow graph is prepared covering all possible paths
and executed during testing
• Path coverage is useful for detecting more errors
• Disadvantage of path coverage criteria is that
programs with loops may have infinite number of
possible paths, all of which are not practical to test
Basis path testing
• Guidelines for effectiveness of path testing
• Control flow Graph ( Decision-to-Decision
graph, DD Graph )
• Path Testing Terms
• Cyclomatic Complexity
• Steps ( Guidelines ) for Basis Path Testing
• Applications of Path Testing
Basis path testing
Guidelines for effectiveness of path testing :
• Path testing is based on control structure for
which flow graph is prepared
• Path testing requires complete knowledge of the
program’s structure or logic
• Path testing is closer to the developer and used by
him to test his module
• As the size of the software under test ( SUT )
increases, the effectiveness of path testing will be
reduced
• Choose enough paths to get maximum logic
coverage
Basis path testing
Control flow Graph ( Decision-to-Decision graph, DD Graph ) :
• It is a graphical representation of control structure of a program
• It is a directed graph (V,E)
• Where
• V = set of vertices and
• E = set of edges ( ordered pairs of elements of V )
• Flow graph notations
1) Node
– Numbered or labeled circles representing one or more procedural statements
2) Edges or links
–Lines with an arrow representing the flow of controls. An edge must terminate at
a node.
3) Decision node
–A node with more than on arrow leaving it is called a decision node
4) Junction node
– A node with more than one arrow entering it is called a junction node
5) Regions
– Area bounded by edges & nodes are called regions. Area outside the graph is also
considered as a region
• Flow graph Notations for different programming constructs
Basis path testing
Basis path testing
Path Testing Terms :
1) Path
– Sequence of instructions or statements that starts at an entry, junction or
decision and ends at another, or possibly the same , junction, decision or exit
2) Segment
– Paths are formed by several segments. Smallest segment is a link ( a single
process that lies between two nodes )
– Examples :
• Junction – process – junction
• Junction – process – decision
• Decision – process - junction
• Decision – process – decision
3) Path Segment
– It is a succession of consecutive links that belongs to same path
4) Length of a path
– No. of links in it. An alternative way to measure length of path is count the nodes
traversed. ( If there is entry and exit nodes, then Length = No. of nodes – 1 )
5) Independent Path
– An independent path consists of at least one new edge. The new edge or link
introduces a new set of instructions for processing
Basis path testing
Cyclomatic Complexity:
• It is a numeric measurement that shows the
logical complexity of a program defined by
McCabe
• It can be calculated by considering the control
flow graph.
• The significance of cyclomatic complexity with
basis path testing is that the complexity number
actually represents the number of independent
paths in the control structure of the program
Basis path testing
• Consider the following sample graph
• 3) Independent paths
– •A–B–F–H
– •A–B–F–G–H
– • A – B- C – E – B – F – G – H
– •A–B–C–D–F-H
• M1 & M3 are not killed by the selected test data. Therefore the test
data is incomplete. So, we need to
add a new test data TD4 = { 2, 2,1 }, this test data will kill M3.
M1 is equivalent to original program P