Professional Documents
Culture Documents
White Box Testing, Experience Based Techniques
White Box Testing, Experience Based Techniques
White Box Testing, Experience Based Techniques
Experience Based
Techniques
--PROF RUCHI S, NMIMS
2. Experience-based Techniques
During white-box testing, the program under test is executed, same as in black
box testing. Both make up dynamic testing.
Theory states that all parts of a program should be executed at least
once during testing.
The rate of coverage of the program is measured using tools (e.g. coverage
analysers):
Code instrumentation is performed in order to count execution
paths, i.e. counters are inserted into the program code of the test object
These counters are initialized holding the value of zero, each
execution path increments the respective counter.
Counters that remain zero after testing indicate program parts that
have not been executed.
White-box techniques need the support of tools in many areas, there are:
Test case specification
Automatically generating a control flow graph from program source
code
Test execution
Tools to monitor and control the program flow inside the test objects
Tool support ensures the quality of the tests and increases efficiency
Because of the complexity of the necessary measures for white box
testing, manual test execution is
Time consuming, resource consuming
Difficult to implement and prone to errors
if(i>0) {
j=f(i);
if(j>10){
while(k>10){
…
}
}
}
Both methods relate to the paths through the control flow graph
They differ in the amount of test cases necessary to achieve 100%
coverage
This method aims at finding defects resulting from the implementation of multiple
conditions(combined conditions)
Multiple conditions are made up of atomic conditions which are combined
using logical operators like OR, AND, XOR, etc. Example: ((a>2)OR(b<6))
Atomic conditions do not contain logical operators but only relational
operators and the NOT-operator (=, >, <, etc.)
All combinations that can be created using permutation of the atomic sub
conditions must be part of the tests.
• This example is used to explain
condition coverage, using a multiple
condition expression.
Example 2
• With four test cases, the multiple
condition coverage can be achieved
Consider the following condition:
• All possible combinations of true
a >0 OR b<6 and false were created.
Test cases for multiple condition coverage could be for • All possible results of the multiple
example: conditions were achieved.
a=3 (true) b=7(false) a>2 OR b<6 (true)
• The number of test cases increases
exponentially:
a=3 (true) b=5 (true) a>2 OR b<6 (true)
• n =number of atomic conditions
a=1 (false) b=5 (true) a>2 OR b<6 (true) • 2n =number of test cases
a=1 (false) b=7 (false) a>2 OR b<6 (false)
All combinations that can be created using the logical results of the sub-
conditions must be part of the test, only if the change of the outcome of one
sub-condition changes the result of the combined condition
• This example is used to explain condition
coverage, using a multiple condition
Example 2 expression.
Consider the following condition:
• For three out of the four test cases the
change of a sub-condition changes the
a >0 OR b<6
overall result
Test cases for multiple condition coverage could be for
• Only for case no. 2 (true OR true
example: =true) the change of a sub-condition
a=3 (true) b=7(false) a>2 OR b<6 (true) will not result in a change of the
a=3 (true) b=5 (true) a>2 OR b<6 (true)
overall condition. This test case can
be omitted!
a=1 (false) b=5 (true) a>2 OR b<6 (true)
• The number of test cases can be reduced
a=1 (false) b=7 (false) a>2 OR b<6 (false) to a value between n+1 and 2n
FACULTY:PROF RUCHI S,NMIMS,MUMBAI
STRUCTURE-BASED OR WHITE-BOX
TECHNIQUES
100% path coverage can only be achieved for very simple programs
A single loop can lead to a test case explosion every possible
number of loop execution constitutes a new test case
Theoretically an indefinite of paths is possible
Path coverage is much more comprehensive that statement or
decision coverage
Every possible path through the program is executed
100% path coverage includes 100% decisions coverage, which again
contains 100% statement coverage
Using a control flow graph (part 1) and pseudo code (part 2) the minimum
number of test cases has to be determined to achieve 100% coverage of:
Statements
Branches/decisions
Paths
2. Experience-based Techniques
✔
Equivalence partitioning
black box
Boundary value analysis
• Practice of creating test cases State transition testing
without a clear methodical Decision tables
approach based on the
dynamic
Use case based testing
✔
intuition and experience of
Analytical QA
experience-based techniques
the tester. Statement coverage
• Test cases are based on
white box
Branch coverage
intuition and experience Condition coverage
• Where have errors
✔
Path coverage
accumulated in the past?
• Where does software Reviews / walkthroughs
static
often fail? Control flow analysis
2. Experience-based Techniques