Selenium Testing Framework Research & Evidence-Based Practice 5 — Questions and Answers
Question 1: Which research-validated Selenium practice reduces test maintenance when the application's navigation structure changes frequently?
- Duplicating locators in each test method
- Centralizing navigation actions in a base page class or navigation helper (Correct answer)
- Using browser history buttons for navigation
- Recording and replaying browser sessions
Correct answer: Centralizing navigation actions in a base page class or navigation helper
Centralizing navigation in reusable base classes means that structural changes require updates in one place only, dramatically reducing maintenance burden.
Question 2: Studies on browser driver management recommend using WebDriverManager or similar tools in Selenium projects primarily to solve what problem?
- Reduce browser startup time
- Automatically download and configure the correct driver binary version for the installed browser (Correct answer)
- Enable remote Grid connections without configuration
- Suppress browser security warnings in tests
Correct answer: Automatically download and configure the correct driver binary version for the installed browser
WebDriverManager resolves version mismatch between browser and driver binary automatically, eliminating a common source of environment-specific test failures.
Question 3: According to evidence-based load testing research, Selenium is generally NOT recommended for performance/load testing because of what limitation?
- Selenium cannot interact with forms
- Each Selenium session spawns a full browser, making it resource-intensive and unsuitable for simulating thousands of concurrent users (Correct answer)
- Selenium lacks HTTP request recording
- Selenium tests cannot measure response time
Correct answer: Each Selenium session spawns a full browser, making it resource-intensive and unsuitable for simulating thousands of concurrent users
Full browser instances consume far more memory and CPU than lightweight HTTP clients like JMeter or Gatling, making Selenium impractical for high-concurrency load testing.
Question 4: Research on Selenium test suite design recommends the Arrange-Act-Assert (AAA) pattern primarily because it does what?
- Forces tests to run in parallel automatically
- Clearly separates setup, action, and verification phases for readability and maintainability (Correct answer)
- Ensures tests always clean up after themselves
- Reduces the number of WebDriver commands issued
Correct answer: Clearly separates setup, action, and verification phases for readability and maintainability
The AAA pattern enforces a clear three-phase structure — setup preconditions, perform the action under test, then verify the outcome — making tests self-documenting and easier to maintain.
Question 5: Evidence from automated regression testing studies shows that the optimal Selenium test suite composition (the testing pyramid) places UI tests at what level?
- The foundation — most tests should be UI tests
- The middle layer, balanced equally with unit tests
- The top, as a small percentage of all tests (Correct answer)
- UI tests should replace unit tests entirely
Correct answer: The top, as a small percentage of all tests
The test pyramid research model places slow, expensive UI/Selenium tests at the top as a thin layer, with the majority of coverage handled by faster unit and integration tests.
Question 6: Which evidence-based technique is recommended to prevent Selenium tests from depending on execution order when sharing a database?
- Run tests sequentially in a fixed order always
- Use database transactions that roll back after each test, or reset state via API calls before each test (Correct answer)
- Delete the entire database between test classes only
- Allow tests to inherit state from previous tests to reflect real user flows
Correct answer: Use database transactions that roll back after each test, or reset state via API calls before each test
Rolling back database transactions or resetting state via API before each test ensures each test starts from a known, clean state regardless of execution order.
Question 7: Research on cross-browser testing with Selenium recommends which approach to maximize coverage without proportionally increasing execution time?
- Run the full test suite on every browser
- Run smoke tests on all browsers and the full regression suite only on the primary browser (Correct answer)
- Test only on Chrome since it has the highest market share
- Use a single headless browser for all cross-browser coverage
Correct answer: Run smoke tests on all browsers and the full regression suite only on the primary browser
Evidence-based cross-browser strategy runs a focused smoke layer across all browsers to catch major regressions, reserving deep regression runs for the primary browser to control execution time.
Which research-validated Selenium practice reduces test maintenance when the application's navigation structure changes frequently?