Bird
Raised Fist0

A tester wrote this code to check boundary values:

medium📝 Debug Q14 of Q15
Testing Fundamentals - Functional Testing Techniques
A tester wrote this code to check boundary values:
def test_boundary(x):
    if x > 0 and x < 10:
        return 'Inside'
    else:
        return 'Outside'

print(test_boundary(0))
print(test_boundary(10))

What is the problem with this test regarding boundary coverage?
AIt misses testing the exact boundary values 0 and 10 correctly.
BIt tests values outside the range only.
CIt uses incorrect syntax for the function.
DIt returns wrong strings for inputs.
Step-by-Step Solution
Solution:
  1. Step 1: Understand boundary conditions in code

    The code checks if x is strictly greater than 0 and less than 10, so 0 and 10 are excluded.
  2. Step 2: Identify test coverage issue

    Testing 0 and 10 returns 'Outside', missing the boundary values as 'Inside' cases.
  3. Final Answer:

    It misses testing the exact boundary values 0 and 10 correctly. -> Option A
  4. Quick Check:

    Boundary values excluded = coverage gap [OK]
Quick Trick: Check if boundaries are included or excluded in conditions [OK]
Common Mistakes:
MISTAKES
  • Assuming 0 and 10 are inside the range
  • Ignoring strict inequality signs
  • Thinking syntax error causes the problem

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes