0% found this document useful (0 votes)
2 views

Unit 2 white box and types

White Box Testing is a test case design strategy that focuses on the internal structure and logic of software to identify execution flows and logic errors. Key techniques include Statement Coverage, Branch Coverage, Condition Coverage, Multiple Condition Coverage, Path Coverage, and Loop Testing, each with specific goals and limitations. This approach is crucial for ensuring code completeness and is typically executed by developers or experienced testers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Unit 2 white box and types

White Box Testing is a test case design strategy that focuses on the internal structure and logic of software to identify execution flows and logic errors. Key techniques include Statement Coverage, Branch Coverage, Condition Coverage, Multiple Condition Coverage, Path Coverage, and Loop Testing, each with specific goals and limitations. This approach is crucial for ensuring code completeness and is typically executed by developers or experienced testers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Unit 2 white box

Test Case Design Strategies for White Box Approach

White Box Testing is a test case design approach that requires knowledge of the internal structure,
code, and logic of the software. It helps in verifying the flow of execution, logic errors, and internal
paths of the program.

White Box Testing Techniques

1. Statement Coverage

• Ensures that every statement in the program is executed at least once.

• Test Case Goal: Cover all lines of code.

• Limitation: Might not test logical paths efficiently.

Example:
If the code has an if-else condition, statement coverage ensures both the if block and else block are
executed at least once.

2. Branch Coverage (Decision Coverage)

• Ensures that each decision point (if, switch, loops) has been executed in both true and false
conditions.

• Test Case Goal: Cover all possible branches in decision-making statements.

• Limitation: Does not check all logical combinations of conditions.

Example:
For an if-else statement, both outcomes (true & false) must be tested:

CopyEdit

if (x > 5)

print("Greater");

else

print("Smaller");

Test Cases:

1. x = 6 (True condition)

2. x = 3 (False condition)

3. Condition Coverage
• Ensures that each Boolean condition inside a decision statement is tested for both true and
false values.

• Test Case Goal: Test all conditions separately.

• Limitation: Does not check the combinations of conditions.

Example:
For a condition if (A && B), test cases must cover:

1. A = True, B = False

2. A = False, B = True

3. A = True, B = True

4. A = False, B = False

4. Multiple Condition Coverage

• Tests all possible combinations of conditions inside a decision statement.

• Test Case Goal: Covers every possible outcome of conditions.

• Limitation: Number of test cases increases exponentially.

Example:
For if (A || B), test cases should cover:

1. A = True, B = False

2. A = False, B = True

3. A = True, B = True

4. A = False, B = False

5. Path Coverage

• Ensures that every independent execution path is tested at least once.

• Test Case Goal: Cover all loops, functions, and conditions.

• Limitation: Not feasible for complex programs with multiple paths.

Example:
If a function has three possible paths, test cases must cover all three execution flows.

6. Loop Testing

• Focuses on testing loops (for, while, do-while).

• Test Case Goal: Check loop behavior with different input values.
• Test Cases Should Include:

o Zero iterations (loop not executed)

o One iteration

o Multiple iterations

o Maximum limit

o Exceeding limit

Example:
For a loop:

CopyEdit

for (i = 1; i <= 10; i++)

print(i);

Test Cases:

1. i = 0 (Loop does not execute)

2. i = 1 (Single iteration)

3. i = 5 (Multiple iterations)

4. i = 10 (Max iterations)

5. i = 11 (Beyond limit)

Mnemonic to Remember White Box Testing Strategies

Use "SBC-MLP" (Smart Bugs Can Make Loops Perfect)

S – Statement Coverage
B – Branch Coverage
C – Condition Coverage
M – Multiple Condition Coverage
L – Loop Testing
P – Path Coverage

Conclusion

White Box Testing is an essential test case design approach for detecting hidden logical errors and
ensuring code completeness. It requires deep knowledge of the code structure and is usually
performed by developers or experienced testers.

You might also like