Condition Coverage measures whether each individual condition in a decision has been tested with both true and false outcomes at least once.
Click to reveal answer
beginner
Why is Condition Coverage important?
It helps find errors in complex decisions by ensuring every condition is tested independently, improving test thoroughness.
Click to reveal answer
intermediate
How does Condition Coverage differ from Decision Coverage?
Decision Coverage checks if each decision (like an if statement) is true or false, while Condition Coverage checks each part inside the decision separately.
Click to reveal answer
intermediate
Example: For the decision if (A && B), what must tests cover for full Condition Coverage?
Tests must make A true and false, and B true and false, regardless of the overall decision outcome.
Click to reveal answer
beginner
Can Condition Coverage guarantee all bugs are found?
No, it improves testing but does not guarantee all bugs are found because it tests conditions independently, not all combinations.
Click to reveal answer
What does Condition Coverage ensure in testing?
AEach condition in a decision is tested as true and false
BEach decision is tested as true and false
CAll possible combinations of conditions are tested
DOnly the true outcomes of conditions are tested
✗ Incorrect
Condition Coverage requires each condition to be tested with both true and false values.
Which of the following is an example of a condition in if (X || Y)?
AX || Y
BX
Cif statement
DY && X
✗ Incorrect
X and Y are single conditions inside the decision.
Condition Coverage is a type of:
APerformance testing
BFunctional testing
CUsability testing
DStructural testing
✗ Incorrect
Condition Coverage is structural because it tests the code's internal logic.
If a decision has two conditions, how many condition outcomes must be tested for full Condition Coverage?
A4
B2
C1
D3
✗ Incorrect
Each condition must be tested true and false, so 2 conditions × 2 outcomes = 4.
Which coverage type tests all possible combinations of conditions?
ACondition Coverage
BDecision Coverage
CMultiple Condition Coverage
DStatement Coverage
✗ Incorrect
Multiple Condition Coverage tests all combinations of condition outcomes.
Explain what Condition Coverage is and why it is useful in software testing.
Think about testing each part inside an if statement separately.
You got /3 concepts.
Describe the difference between Condition Coverage and Decision Coverage with an example.
Focus on testing individual conditions vs whole decisions.
You got /4 concepts.
Practice
(1/5)
1. What does condition coverage ensure in software testing?
easy
A. All possible input values are tested
B. Only the overall decision outcome is tested once
C. Each part of a decision is tested for both true and false outcomes
D. Only syntax errors are detected
Solution
Step 1: Understand condition coverage definition
Condition coverage requires testing each atomic condition in a decision for both true and false values.
Step 2: Compare options with definition
Each part of a decision is tested for both true and false outcomes matches this definition exactly, while others describe different testing scopes.
Final Answer:
Each part of a decision is tested for both true and false outcomes -> Option C
Quick Check:
Condition coverage = test each condition true/false [OK]
Hint: Test each condition true and false separately [OK]
Common Mistakes:
Confusing condition coverage with decision coverage
Thinking only overall decision outcome matters
Assuming all inputs must be tested
2. Which of the following is the correct syntax to represent a condition in a test case for condition coverage?
easy
A. if a and b then ...
B. if a && b { ... }
C. if (a & b) { ... }
D. if (a && b) { ... }
Solution
Step 1: Identify correct syntax for logical AND in common languages
In languages like JavaScript, Java, and C, logical AND is written as && inside parentheses.
Step 2: Evaluate each option
if (a && b) { ... } uses correct syntax with parentheses and &&. if a and b then ... uses incorrect syntax (no parentheses, wrong keywords). if (a & b) { ... } uses bitwise AND &, not logical AND. if a && b { ... } misses parentheses.
Final Answer:
if (a && b) { ... } -> Option D
Quick Check:
Logical AND syntax = && with parentheses [OK]
Hint: Use parentheses and && for logical AND [OK]
Common Mistakes:
Using single & instead of && for logical AND
Omitting parentheses around conditions
Using incorrect keywords like 'then'
3. Consider the decision: if (x > 0 && y == 5). Which test inputs achieve full condition coverage?
medium
A. x=1, y=5 and x=-1, y=4
B. x=1, y=5 and x=1, y=4
C. x=0, y=5 and x=1, y=5
D. x=1, y=5 and x=-1, y=5
Solution
Step 1: Identify conditions and their true/false values
Conditions: (x > 0) and (y == 5). To cover both true and false for each, we need inputs where x > 0 is true and false, and y == 5 is true and false.
Step 2: Check each option for condition coverage
x=1, y=5 and x=-1, y=4: x=1,y=5 (x>0 true, y==5 true), x=-1,y=4 (x>0 false, y==5 false) covers all true/false for both conditions. Others miss some false cases.
Final Answer:
x=1, y=5 and x=-1, y=4 -> Option A
Quick Check:
Test each condition true and false separately [OK]
Hint: Test each condition true and false independently [OK]
Common Mistakes:
Testing only overall decision true/false
Missing false case for one condition
Assuming one test covers all conditions
4. Given the code snippet:
if (a || b) {
// do something
}
Which test set achieves condition coverage?
medium
A. a=true, b=false and a=false, b=true
B. a=true, b=false and a=false, b=false
C. a=true, b=true only
D. a=false, b=false only
Solution
Step 1: Understand condition coverage for OR operator
For a || b, condition coverage requires testing a and b each as true and false separately.
Step 2: Evaluate test sets
a=true, b=false and a=false, b=true tests a=true,b=false (a true, b false) and a=false,b=true (a false, b true), covering both true and false for each condition. Others miss some cases.
Final Answer:
a=true, b=false and a=false, b=true -> Option A
Quick Check:
Test each condition true and false separately [OK]
Hint: Test each condition true and false separately for OR [OK]
Common Mistakes:
Confusing with decision coverage
Assuming one test covers both conditions
Ignoring condition coverage for OR
5. You have the decision: if ((p && q) || r). Which minimal test set achieves full condition coverage?
hard
A. p=true, q=true, r=false; p=false, q=true, r=false; p=false, q=false, r=false
B. p=true, q=false, r=false; p=false, q=true, r=false; p=false, q=false, r=true
C. p=true, q=true, r=false; p=false, q=false, r=false
D. p=true, q=false, r=true; p=false, q=false, r=false
Solution
Step 1: Identify atomic conditions and their true/false needs
Conditions: p, q, r. Condition coverage requires each to be true and false at least once.
Step 2: Check each test set for coverage
p=true, q=false, r=false; p=false, q=true, r=false; p=false, q=false, r=true tests p=true,q=false,r=false (p true, q false, r false), p=false,q=true,r=false (p false, q true, r false), and p=false,q=false,r=true (p false, q false, r true). This covers true and false for all conditions minimally.