ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP4125White Box Testing Tech…
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP4125

    Software Testing & Quality Assurance

    Progress0 / 9 done
    Topics9
    1Testing techniques2Black Box testing techniques3White Box testing techniques4Grey Box testing techniques5Quality Assurance planning and execution
    6constructing a framework7Scripting techniques for automated testing8Generating test data9Generating test reports
    4 min read
    Topic 3 of 9
    Topic Study Note Illustration
    03

    White Box testing techniques

    Definition: White Box Testing is a technique where the tester has full knowledge of the internal code, structure, and logic of the program.

    πŸ“˜ WHITE BOX TESTING TECHNIQUES

    βœ… 1. What is White Box Testing?

    Definition: White Box Testing is a technique where the tester has full knowledge of the internal code, structure, and logic of the program.

    πŸ‘‰ Simple meaning: You test how the program works internally (code logic).


    🎯 Key Features

    • Requires programming knowledge

    • Tests internal structure

    • Also called:

      • Structural Testing
      • Glass Box Testing
      • Clear Box Testing

    πŸ“¦ Basic Working

    Input β†’ Code Logic β†’ Output
             ↑
         Tested here
    

    πŸ‘‰ Focus is on code execution paths


    πŸ”‘ MAIN WHITE BOX TESTING TECHNIQUES


    πŸ”΅ 1. STATEMENT COVERAGE

    πŸ“Œ Definition:

    Ensures that every line (statement) of code is executed at least once.


    πŸͺœ Steps:

    1. Identify all statements in code
    2. Design test cases to execute each statement
    3. Measure coverage

    πŸ“Š Example:

    if (x > 0)
       print("Positive");
    

    πŸ‘‰ Test case:

    • x = 5 β†’ executes the statement

    πŸ“ Formula:

    Statement Coverage = (Executed Statements / Total Statements) Γ— 100%
    

    🎯 Key Point:

    • Minimum level of testing
    • Does NOT guarantee full logic testing

    🟒 2. BRANCH COVERAGE (Decision Coverage)

    πŸ“Œ Definition:

    Ensures that each decision (true/false branch) is executed.


    πŸ“Š Example:

    if (x > 0)
       print("Positive");
    else
       print("Negative");
    

    πŸ‘‰ Test cases:

    • x = 5 β†’ TRUE branch
    • x = -2 β†’ FALSE branch

    πŸ“ Formula:

    Branch Coverage = (Executed Branches / Total Branches) Γ— 100%
    

    🎯 Key Point:

    • More powerful than statement coverage
    • Covers all decision outcomes

    πŸ‘‰ πŸ”₯ Frequently asked!


    🟑 3. PATH COVERAGE

    πŸ“Œ Definition:

    Ensures that all possible execution paths in the program are tested.


    πŸ“Š Example:

    if (x > 0)
       print("Positive");
    if (y > 0)
       print("Y Positive");
    

    πŸ‘‰ Possible paths:

    1. x>0, y>0
    2. x>0, y≀0
    3. x≀0, y>0
    4. x≀0, y≀0

    🎯 Key Point:

    • Provides maximum coverage
    • Difficult for large programs

    πŸ‘‰ πŸ”₯ Very important for exams!


    🟣 4. LOOP TESTING

    πŸ“Œ Definition:

    Tests the correctness of loops (for, while, do-while).


    πŸͺœ Test Cases for Loop:

    • 0 iterations
    • 1 iteration
    • 2 iterations
    • Maximum iterations

    πŸ“Š Example:

    for(i=0; i<n; i++)
       print(i);
    

    πŸ‘‰ Test with:

    • n = 0
    • n = 1
    • n = many

    🎯 Key Point:

    • Helps detect infinite loops
    • Ensures loop correctness

    🟠 5. DATA FLOW TESTING

    πŸ“Œ Definition:

    Focuses on how variables are defined, used, and modified in the program.


    πŸ” Key Concepts:

    • Definition (value assigned)
    • Use (value used)
    • Kill (value removed)

    πŸ“Š Example:

    int x = 5;   // define
    print(x);    // use
    

    🎯 Key Point:

    • Finds errors like:

      • Unused variables
      • Undefined variables

    πŸ”΄ 6. CONDITION COVERAGE

    πŸ“Œ Definition:

    Tests each individual condition in a decision.


    πŸ“Š Example:

    if (x > 0 && y > 0)
    

    πŸ‘‰ Conditions:

    • x > 0
    • y > 0

    Test cases:

    • Both true
    • One false
    • Both false

    🎯 Key Point:

    • More detailed than branch coverage

    🧠 COVERAGE HIERARCHY (Important!)

    Statement < Branch < Condition < Path
    

    πŸ‘‰ Path coverage is strongest.


    βš–οΈ ADVANTAGES & DISADVANTAGES

    βœ… Advantages:

    • Finds hidden errors
    • Improves code quality
    • Ensures logic correctness

    ❌ Disadvantages:

    • Requires programming knowledge
    • Time-consuming
    • Not suitable for large systems fully

    πŸ”₯ FREQUENTLY ASKED EXAM POINTS

    βœ” Define White Box Testing βœ” Statement vs Branch Coverage βœ” Path Coverage explanation βœ” Loop testing cases βœ” Coverage formulas βœ” Coverage hierarchy


    πŸ“Š QUICK REVISION TABLE

    Technique What it Tests Key Idea
    Statement Coverage All lines Each statement executed
    Branch Coverage Decisions True/False paths
    Path Coverage All paths Complete execution
    Loop Testing Loops Iterations
    Data Flow Testing Variables Define & use
    Condition Coverage Conditions Each condition

    🎯 FINAL SUMMARY

    • White Box Testing focuses on internal code logic

    • Requires programming knowledge

    • Key techniques:

      • Statement Coverage
      • Branch Coverage
      • Path Coverage
      • Loop Testing
      • Data Flow Testing
      • Condition Coverage
    • Branch & Path coverage are most important for exams


    ← Previous topic 2
    Black Box testing techniques
    Next topic 4 β†’
    Grey Box testing techniques

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    4mremaining
    603words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Software Testing & Quality Assurance