Bird
Raised Fist0

You have a test suite that should run three tests, but only two run. The suite code is:

medium📝 Debug Q14 of Q15
Testing Fundamentals - Test Documentation
You have a test suite that should run three tests, but only two run. The suite code is:
suite = unittest.TestSuite()
suite.addTest(TestClass('test_one'))
suite.addTest(TestClass('test_two'))
runner.run(suite)

What is the likely reason the third test test_three is not running?
AThe test runner does not support more than two tests
BThe test method name <code>test_three</code> is invalid
CThe test class does not inherit from unittest.TestCase
DThe third test was not added to the test suite
Step-by-Step Solution
Solution:
  1. Step 1: Review test suite additions

    The suite only adds test_one and test_two. test_three is missing.
  2. Step 2: Check other options

    Method name test_three is valid if it starts with 'test'. Runner supports many tests. Class inheritance assumed correct.
  3. Final Answer:

    The third test was not added to the test suite -> Option D
  4. Quick Check:

    Missing addTest call = C [OK]
Quick Trick: Add all tests explicitly to suite to run them [OK]
Common Mistakes:
MISTAKES
  • Assuming test runner limits tests
  • Thinking method names cause skipping
  • Ignoring suite.addTest calls

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes