White Box Testing

What is white box testing?

In white box testing, we test the internal structure of the program. Internal structure means program code, implementation, and design of the program.

Advantages of white box testing:

  1. Makes the code error free.
  2. Helps in code optimization.

Disadvantages of white box testing:

  1. A well-skilled developer is required for code testing.
  2. More time-Consuming.

Techniques of white box testing:

There are different white box testing techniques available. Some of these are as follows;

  1. Control Flow Testing
  2. Data Flow Testing
  3. Branch Coverage Testing
  4. Path Coverage Testing
  5. Statement Coverage Testing
  6. Decision Coverage Testing
  7. Condition Coverage Testing
  8. Loop Testing
  9. Path Sensitivity Testing
  10. Mutation Testing
  11. Data Flow Anomalies Testing
  12. API Testing

Control Flow Testing

It test the “Control flow” of a  program. Test cases are all control structures included in the program like loops, if statements, and switch cases to ensure that all possible control flow paths are executed at least once.

Types of Control structures

Some Control structures are mentioned below;

  1. Sequential Structure
  2. Selection Structures
    • If Statement
    • If-else Statement
    • Nested If-else Statement
  3. Switch Statement (or Case Statement)
  4. Repetition Structures
    • For Loop
    • While Loop
    • Do-while Loop
  5. Loop Control Structures
    • Break Statement
    • Continue Statement
    • Exit Statement
  6. Exception Handling
    • Try-Catch Block
    • Throw Statement

1. Sequential Structure Testing:

Normally, when a program is generating the accurate output, then the test can be considered as pass.

2. Selection Structures – If Statement Testing

Test Cases:

Test Case Input Expected Output
1 5 The number is positive.
2 -3 The number is negative.
3 0 The number is zero.

If-else Statement Testing:

Test Cases:

Test Case Input Expected Output
1 6 “6 is even.”
2 9 “9 is odd.”
3 0 “0 is even.”
4 -8 “-8 is even.”
5 347 “347 is odd.”

Nested If else statement

Test Cases:


Branch Coverage Testing


Add a Comment