Recall & Review
beginner
What is the purpose of a base test class in Selenium Java?A base test class provides common setup and teardown methods for all test classes, reducing code duplication and improving maintainability.Click to reveal answer
beginner
Which method is commonly used in a base test class to initialize the WebDriver before tests run?A method annotated with @BeforeEach or @BeforeAll (JUnit) or @BeforeMethod (TestNG) is used to initialize the WebDriver before tests.
Click to reveal answer
intermediate
Why should locators and driver initialization be placed in the base test class?
Placing locators and driver initialization in the base class ensures all tests use the same setup, making tests consistent and easier to update.Click to reveal answer
beginner
How does the base test class pattern help when adding new test cases?New test classes can inherit from the base class and automatically get the setup and teardown, so testers only write test logic without repeating setup code.Click to reveal answer
beginner
What is a common teardown method in the base test class and what does it do?A method annotated with @AfterEach or @AfterAll (JUnit) or @AfterMethod (TestNG) closes the WebDriver to clean up resources after tests run.
Click to reveal answer
What is the main benefit of using a base test class in Selenium Java?
✗ Incorrect
A base test class helps share setup and teardown code, avoiding repetition and making tests easier to maintain.
Which annotation is typically used to run setup code before each test in JUnit?
✗ Incorrect
@BeforeEach runs setup code before every test method in JUnit.
Where should WebDriver initialization be placed when using the base test class pattern?
✗ Incorrect
WebDriver initialization belongs in the base test class setup method to be reused by all tests.
What does the teardown method in the base test class usually do?
✗ Incorrect
Teardown methods close the browser and free resources after tests finish.
If you add a new test class, how does the base test class pattern help?
✗ Incorrect
New test classes inherit setup and teardown from the base class, so you only write test logic.
Explain the role of a base test class in Selenium Java testing and how it improves test code.
Think about what all tests need before and after running.
You got /5 concepts.
Describe how you would organize WebDriver setup and cleanup using the base test class pattern.
Consider test lifecycle annotations and resource management.
You got /4 concepts.