Full-Stack Development Quality Control & Assurance 5 — Questions and Answers
Question 1: Which Playwright method waits for a network request to complete before proceeding in a test?
- page.pause()
- page.waitForResponse() (Correct answer)
- page.timeout()
- page.idle()
Correct answer: page.waitForResponse()
`page.waitForResponse()` resolves when a matching network response is received, avoiding hard-coded sleeps in E2E tests.
Question 2: What is the purpose of a 'test fixture' in automated testing?
- A hardware device used for hardware-in-the-loop testing
- A fixed, known state of data and environment set up before tests run (Correct answer)
- A type of performance benchmark tool
- A CI/CD configuration template
Correct answer: A fixed, known state of data and environment set up before tests run
A test fixture establishes a repeatable, known precondition (database state, files, mock services) so tests run deterministically.
Question 3: Which metric measures the average time it takes to restore service after a production failure?
- MTTF (Mean Time To Failure)
- MTTR (Mean Time To Recovery) (Correct answer)
- Deployment frequency
- Change failure rate
Correct answer: MTTR (Mean Time To Recovery)
MTTR measures average recovery time from incidents and is a key DORA metric reflecting the effectiveness of incident response and rollback processes.
Question 4: In accessibility testing, what does WCAG 2.1 Level AA compliance require for color contrast?
- 3:1 ratio for all text
- 4.5:1 ratio for normal text and 3:1 for large text (Correct answer)
- 7:1 ratio for all text
- Any color is acceptable if the font is large enough
Correct answer: 4.5:1 ratio for normal text and 3:1 for large text
WCAG 2.1 AA requires a 4.5:1 contrast ratio for normal text and 3:1 for large text (18pt or 14pt bold) to ensure readability.
Question 5: What does a 'load test' specifically measure compared to a 'stress test'?
- Load tests find breaking points; stress tests measure expected-traffic performance
- Load tests measure system behavior under expected traffic; stress tests push beyond capacity to find breaking points (Correct answer)
- They are identical tests with different names
- Load tests measure frontend performance; stress tests measure backend performance
Correct answer: Load tests measure system behavior under expected traffic; stress tests push beyond capacity to find breaking points
Load testing validates performance under anticipated production traffic, while stress testing intentionally exceeds capacity to find failure modes and recovery behavior.
Question 6: What is the key advantage of snapshot testing in React component testing?
- It validates runtime performance of components
- It detects unintended UI changes by comparing rendered output to a saved snapshot (Correct answer)
- It replaces unit tests for business logic
- It runs tests inside a real browser automatically
Correct answer: It detects unintended UI changes by comparing rendered output to a saved snapshot
Snapshot tests serialize a component's rendered output and fail if the output changes unexpectedly, catching accidental UI regressions.
Question 7: When applying the Arrange-Act-Assert (AAA) pattern, what happens in the 'Arrange' phase?
- The code under test is executed
- Test preconditions, inputs, and dependencies are set up (Correct answer)
- Expected outcomes are verified with assertions
- Test results are reported to the CI system
Correct answer: Test preconditions, inputs, and dependencies are set up
The Arrange phase sets up all necessary state, test data, and dependencies before invoking the code under test in the Act phase.
Which Playwright method waits for a network request to complete before proceeding in a test?