Challenge - 5 Problems
White-Box Testing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Purpose of White-Box Testing
Why does white-box testing focus on examining the internal code structure?
Attempts:
2 left
💡 Hint
Think about what 'white-box' means compared to 'black-box' testing.
✗ Incorrect
White-box testing involves looking inside the code to test its logic and paths directly. This helps find errors that are hidden inside the code structure.
🧠 Conceptual
intermediate2:00remaining
White-Box Testing Benefits
Which benefit is unique to white-box testing compared to black-box testing?
Attempts:
2 left
💡 Hint
Consider what white-box testing can do that black-box testing cannot.
✗ Incorrect
White-box testing allows testers to look inside the code and test all branches and conditions, which helps find hidden errors that black-box testing might miss.
❓ Predict Output
advanced2:00remaining
Output of White-Box Test Coverage Code
What is the output of this white-box test coverage code snippet?
Testing Fundamentals
def test_function(x): if x > 0: return 'Positive' elif x == 0: return 'Zero' else: return 'Negative' results = [test_function(i) for i in [-1, 0, 1]] print(results)
Attempts:
2 left
💡 Hint
Trace the function calls for each input in the list [-1, 0, 1].
✗ Incorrect
The function returns 'Negative' for -1, 'Zero' for 0, and 'Positive' for 1, so the output list matches option B.
❓ assertion
advanced2:00remaining
Correct Assertion for White-Box Test
Which assertion correctly verifies that a function covers all branches in white-box testing?
Testing Fundamentals
def classify_number(n): if n > 0: return 'pos' elif n == 0: return 'zero' else: return 'neg'
Attempts:
2 left
💡 Hint
All branches must be tested and verified correctly.
✗ Incorrect
Option C checks all three branches with correct expected outputs, ensuring full branch coverage.
🔧 Debug
expert2:00remaining
Debugging White-Box Test Failure
A white-box test fails because a branch is never executed. What is the most likely cause?
Attempts:
2 left
💡 Hint
Think about what white-box testing requires to cover all branches.
✗ Incorrect
White-box testing requires inputs that execute every branch. If a branch is never executed, the test inputs are incomplete.