Automation Testing Automation Functional Testing 2 — Questions and Answers
Question 1: Which type of locator is generally the most stable choice for identifying a web element in functional automation?
- A unique ID attribute (Correct answer)
- Absolute XPath from the root
- Element position index
- Inline CSS color value
Correct answer: A unique ID attribute
A unique ID is the fastest and least brittle locator because it is meant to be unique on the page.
Question 2: What is the primary purpose of an explicit wait in functional UI automation?
- Pause for a fixed time regardless of state
- Wait for a specific condition before proceeding (Correct answer)
- Speed up test execution
- Disable browser animations
Correct answer: Wait for a specific condition before proceeding
An explicit wait pauses only until a defined condition (like element visibility) is met.
Question 3: A test fails intermittently due to timing, passing on reruns. What is this commonly called?
- A blocker
- A flaky test (Correct answer)
- A smoke test
- A regression
Correct answer: A flaky test
Tests that pass and fail inconsistently without code changes are called flaky tests.
Question 4: Which design pattern separates page structure from test logic in functional automation?
- Singleton Pattern
- Page Object Model (Correct answer)
- Observer Pattern
- Factory Pattern
Correct answer: Page Object Model
The Page Object Model encapsulates page elements and actions, keeping tests cleaner and maintainable.
Question 5: What does a thread sleep (hard wait) most risk introducing into a test suite?
- Better reliability
- Wasted execution time and brittleness (Correct answer)
- Improved assertions
- Parallel execution
Correct answer: Wasted execution time and brittleness
Hard waits always pause the full duration, slowing suites and still failing if the element loads slower.
Question 6: In functional testing, what should an assertion primarily verify?
- The expected outcome of a behavior (Correct answer)
- The CPU usage of the browser
- The network bandwidth
- The number of test files
Correct answer: The expected outcome of a behavior
Assertions check that actual results match expected functional outcomes.
Question 7: Why is test data isolation important across automated functional tests?
- It makes reports prettier
- It prevents tests from affecting each other's results (Correct answer)
- It increases screen resolution
- It removes the need for assertions
Correct answer: It prevents tests from affecting each other's results
Isolated data ensures one test's changes do not cause another test to pass or fail unexpectedly.
Which type of locator is generally the most stable choice for identifying a web element in functional automation?