WHITE BOX
TESTING
1
CONTENTS
 What is white box testing?
 White box testing techniques
 Path testing
 Statement coverage testing
 Branch coverage testing
 Loop testing
 Advantages of white box testing
 Disadvantages of white box testing
2
WHAT IS WHITE BOX
TESTING?
 It is also know as:
 Glass based testing.
 Structural testing.
 White box testing is performed based on the knowledge of how the
system is implemented. It requires access to source code.
 The objective of white box testing is to validate whether code
implementation follows intended design in order to check implemented
security functionality and uncover exploitable vulnerabilities.
3
WHITE BOX TESTING
TECHNIQUES
Path testing
Statement Coverage Testing
Branch Coverage Testing
Loop Testing
4
PATH TESTING
 The objective of path testing is to define a set of linear independent
path, called basis set, that can be used to construct any path through
program flow graph.
 A path represents floe of execution from start of a method to its exit.
5
STATEMENT COVERAGE
TESTING
 Statement coverage testing identifies the statements in the method or class that have
been executed.
 The objective of statement coverage testing is to ensure that every statement in the
program is executed for at least one time.
 𝑆𝑡𝑎𝑡𝑒𝑚𝑒𝑛𝑡 𝑐𝑜𝑣𝑒𝑟𝑎𝑔𝑒 =
𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑛𝑜𝑑𝑒𝑠 𝑐𝑜𝑣𝑒𝑟𝑒𝑑
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑛𝑜𝑑𝑒𝑠
∗100
6
BRANCH COVERAGE
TESTING
 A branch is the outcome of a decision, and branch coverage simply identifies the
decision outcomes that have been tested.
 Branch coverage takes in depth view of the source code that simple statement
coverage.
 Branch coverage aims to design test cases in such a way that each decision has a
true or false outcome at least once.
7
LOOP TESTING
 Loop testing is white box testing technique that focuses on loop constructed.
 There are following types of loops:
Simple loops
Nested loops
Concatenated loops
Unstructured loops
8
ADVANTAGES OF WHITE
BOX TESTING
 Helps in checking code standards and optimizing code.
 Extra code resulting in hidden defects can be removed.
 Reason of failure can be determined.
 Identifying test data is easy due to the knowledge of internal
implementation.
9
DISADVANTAGES OF
WHITE BOX TESTING
Testing should be highly skilled.
Cost of performing white box testing is high.
High complexity.
Impossible to look each piece of code to find the bug.
Exhaustive testing is not feasible.
10
THANK
YOU
11

White Box Testing

  • 1.
  • 2.
    CONTENTS  What iswhite box testing?  White box testing techniques  Path testing  Statement coverage testing  Branch coverage testing  Loop testing  Advantages of white box testing  Disadvantages of white box testing 2
  • 3.
    WHAT IS WHITEBOX TESTING?  It is also know as:  Glass based testing.  Structural testing.  White box testing is performed based on the knowledge of how the system is implemented. It requires access to source code.  The objective of white box testing is to validate whether code implementation follows intended design in order to check implemented security functionality and uncover exploitable vulnerabilities. 3
  • 4.
    WHITE BOX TESTING TECHNIQUES Pathtesting Statement Coverage Testing Branch Coverage Testing Loop Testing 4
  • 5.
    PATH TESTING  Theobjective of path testing is to define a set of linear independent path, called basis set, that can be used to construct any path through program flow graph.  A path represents floe of execution from start of a method to its exit. 5
  • 6.
    STATEMENT COVERAGE TESTING  Statementcoverage testing identifies the statements in the method or class that have been executed.  The objective of statement coverage testing is to ensure that every statement in the program is executed for at least one time.  𝑆𝑡𝑎𝑡𝑒𝑚𝑒𝑛𝑡 𝑐𝑜𝑣𝑒𝑟𝑎𝑔𝑒 = 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑛𝑜𝑑𝑒𝑠 𝑐𝑜𝑣𝑒𝑟𝑒𝑑 𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑛𝑜𝑑𝑒𝑠 ∗100 6
  • 7.
    BRANCH COVERAGE TESTING  Abranch is the outcome of a decision, and branch coverage simply identifies the decision outcomes that have been tested.  Branch coverage takes in depth view of the source code that simple statement coverage.  Branch coverage aims to design test cases in such a way that each decision has a true or false outcome at least once. 7
  • 8.
    LOOP TESTING  Looptesting is white box testing technique that focuses on loop constructed.  There are following types of loops: Simple loops Nested loops Concatenated loops Unstructured loops 8
  • 9.
    ADVANTAGES OF WHITE BOXTESTING  Helps in checking code standards and optimizing code.  Extra code resulting in hidden defects can be removed.  Reason of failure can be determined.  Identifying test data is easy due to the knowledge of internal implementation. 9
  • 10.
    DISADVANTAGES OF WHITE BOXTESTING Testing should be highly skilled. Cost of performing white box testing is high. High complexity. Impossible to look each piece of code to find the bug. Exhaustive testing is not feasible. 10
  • 11.