Why do we group individual test cases into a test suite?
Think about how grouping helps in managing and running tests.
Test suites help organize related tests so they can be run together easily and results are clearer.
Given this test suite code, what is the order of test case execution?
def test_alpha(): print('alpha') def test_beta(): print('beta') def test_gamma(): print('gamma') # Test suite runs tests in order of definition
Tests run in the order they are defined in the suite.
Tests are executed in the order they appear in the suite, so alpha runs first, then beta, then gamma.
Which assertion correctly checks that a list of tests in a suite contains exactly 3 tests?
test_suite = ['test_login', 'test_logout', 'test_signup']
Remember how to get the length of a list in Python.
len() returns the number of items in a list. Other options are invalid syntax or wrong method.
What is wrong with this test suite setup code?
class TestSuite: def __init__(self): self.tests = [] def add_test(self, test): self.tests.append(test) def run(self): for test in self.tests: test() suite = TestSuite() suite.add_test('test_login') suite.run()
Check what type of objects are added and what run() expects.
The run method calls each test as a function, but strings are not callable, causing a TypeError.
In a large automation framework, what is the best way to organize test suites for maintainability and scalability?
Think about how grouping helps manage many tests and running subsets.
Grouping tests by feature and using tags allows easy maintenance and selective running of tests.