Automation Testing Test Automation Frameworks 1 — Questions and Answers
Question 1: Which test automation framework is based on keyword-driven testing and is commonly used in the US enterprise environment?
- Robot Framework (Correct answer)
- Mocha
- Jasmine
- Cucumber
Correct answer: Robot Framework
Robot Framework uses keyword-driven testing, making tests readable and maintainable for non-programmers.
Question 2: What is the primary advantage of a data-driven testing framework?
- It separates test logic from test data, allowing multiple data sets to run the same test (Correct answer)
- It auto-generates test cases
- It requires no programming skills
- It only works with web applications
Correct answer: It separates test logic from test data, allowing multiple data sets to run the same test
Data-driven frameworks separate test logic from data, enabling the same test script to run with multiple input/output combinations.
Question 3: In a Page Object Model (POM), where are web element locators stored?
- In a separate page class file (Correct answer)
- Directly inside the test method
- In the test runner configuration
- In a global constants file
Correct answer: In a separate page class file
POM stores element locators and interactions within dedicated page class files, separating UI details from test logic.
Question 4: Which JUnit 5 annotation marks a method to run before each test in a class?
- @BeforeEach (Correct answer)
- @Before
- @Setup
- @Init
Correct answer: @BeforeEach
@BeforeEach in JUnit 5 replaces the @Before annotation from JUnit 4 and runs before every test method.
Question 5: What does the TestNG @DataProvider annotation do?
- Supplies test data to parameterized test methods (Correct answer)
- Runs tests in parallel
- Configures the browser driver
- Sets test priority
Correct answer: Supplies test data to parameterized test methods
@DataProvider feeds multiple sets of data to a test method, enabling data-driven execution within TestNG.
Question 6: Which pattern ensures that only one instance of the WebDriver is created and shared across all tests in a session?
- Singleton pattern (Correct answer)
- Factory pattern
- Observer pattern
- Decorator pattern
Correct answer: Singleton pattern
The Singleton pattern restricts WebDriver instantiation to a single object, preventing duplicate browser instances across tests.
Which test automation framework is based on keyword-driven testing and is commonly used in the US enterprise environment?