Selenium WebDriver Quality Control & Assurance 3 — Questions and Answers
Question 1: In Selenium automation quality, what does the 'test pyramid' concept recommend regarding UI tests?
- UI tests should form the largest layer
- UI tests should be the fewest, sitting at the top of the pyramid (Correct answer)
- UI tests should replace unit tests
- UI tests should run on every commit
Correct answer: UI tests should be the fewest, sitting at the top of the pyramid
The test pyramid advises keeping UI/end-to-end tests minimal because they are slow and costly to maintain compared to unit tests.
Question 2: Which Selenium technique helps prevent test failures caused by elements not yet visible in the DOM?
- Thread.sleep() with a fixed duration
- Explicit waits with ExpectedConditions (Correct answer)
- Disabling JavaScript in the browser
- Using findElements instead of findElement
Correct answer: Explicit waits with ExpectedConditions
Explicit waits poll for a specific condition like element visibility, making tests resilient without arbitrary sleep delays.
Question 3: In a QA pipeline, what is the role of a Selenium smoke test suite?
- To test all edge cases in the application
- To verify that the most critical paths work after a new deployment (Correct answer)
- To measure application performance under load
- To check database integrity
Correct answer: To verify that the most critical paths work after a new deployment
Smoke tests quickly validate core functionality, confirming a build is stable enough for more thorough testing.
Question 4: What is the main quality benefit of using parameterized tests in a Selenium framework?
- They reduce WebDriver startup time
- They allow a single test to run with multiple data sets, improving coverage (Correct answer)
- They automatically retry failed tests
- They generate HTML reports
Correct answer: They allow a single test to run with multiple data sets, improving coverage
Parameterization lets one test method validate multiple input scenarios, increasing breadth without duplicating test code.
Question 5: Which practice ensures Selenium tests remain independent and do not affect each other's outcomes?
- Running all tests in a single browser session
- Sharing WebDriver instances between tests
- Setting up and tearing down state for each test individually (Correct answer)
- Disabling parallel execution
Correct answer: Setting up and tearing down state for each test individually
Test isolation via @BeforeEach/@AfterEach setup and teardown prevents state leakage between tests, ensuring reliable results.
Question 6: In Selenium QA, what does a visual regression test detect?
- JavaScript errors in the browser console
- Unintended visual changes in the UI compared to a baseline screenshot (Correct answer)
- Broken API endpoints
- Database query performance issues
Correct answer: Unintended visual changes in the UI compared to a baseline screenshot
Visual regression tools like Applitools or Percy compare screenshots pixel-by-pixel to catch unintended layout or style changes.
Question 7: Which logging practice is most valuable for diagnosing Selenium test failures in a CI environment?
- Logging only passed tests
- Capturing browser console logs, screenshots, and step-level logs on failure (Correct answer)
- Logging only the final assertion result
- Disabling logging to improve performance
Correct answer: Capturing browser console logs, screenshots, and step-level logs on failure
Rich failure artifacts—console logs, screenshots, and detailed step logs—enable engineers to diagnose remote CI failures without reproducing them locally.
In Selenium automation quality, what does the 'test pyramid' concept recommend regarding UI tests?