Bird
0
0

A tester wrote this test script snippet:

medium📝 Debug Q14 of 15
Testing Fundamentals - Why Software Testing Matters
A tester wrote this test script snippet:
def test_divide():
    result = 10 / 0
    assert result == 0

What is the main problem with this test?
ATest function name is incorrect
BAssertion should check for 10, not 0
CMissing print statement
DDivision by zero causes runtime error
Step-by-Step Solution
Solution:
  1. Step 1: Identify the operation causing error

    Dividing 10 by 0 causes a ZeroDivisionError at runtime.
  2. Step 2: Understand impact on test execution

    Because of the error, assertion is never reached and test fails with exception.
  3. Final Answer:

    Division by zero causes runtime error -> Option D
  4. Quick Check:

    Division by zero = runtime error [OK]
Quick Trick: Division by zero always causes error [OK]
Common Mistakes:
  • Ignoring runtime error and focusing on assertion
  • Thinking assertion is wrong instead
  • Assuming print statement needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes