Bird
0
0

Which of the following is the correct way to define a test suite in Python's unittest framework?

easy📝 Syntax Q12 of 15
Testing Fundamentals - Test Documentation
Which of the following is the correct way to define a test suite in Python's unittest framework?
Asuite = unittest.TestSuite([TestClass1, TestClass2])
Bsuite = unittest.TestSuite([TestClass1(), TestClass2()])
Csuite = unittest.TestSuite(TestClass1, TestClass2)
D)2ssalCtseT ,1ssalCtseT(etiuStseT.tsettinu = etius
Step-by-Step Solution
Solution:
  1. Step 1: Recall unittest TestSuite syntax

    TestSuite expects a list of test case instances, not classes.
  2. Step 2: Check each option

    suite = unittest.TestSuite([TestClass1(), TestClass2()]) correctly passes instances: TestClass1() and TestClass2() inside a list.
  3. Final Answer:

    suite = unittest.TestSuite([TestClass1(), TestClass2()]) -> Option B
  4. Quick Check:

    TestSuite needs instances in list = A [OK]
Quick Trick: Pass test case instances in a list to TestSuite [OK]
Common Mistakes:
  • Passing classes instead of instances
  • Not using a list to group tests
  • Using parentheses incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes