The SDET Playbook

← All questions

What should an SDET look for when reviewing a developer's pull request for testability?

Asked Sep 28, 2026Viewed 0 times

1 Answer

Sign in to answer and to vote.

  • 0
    The SDET PlaybookSep 28, 2026

    Look for the seams a test needs, and ask for them while the change is still cheap to adjust:

    • Dependencies passed in, not created inside. A class that constructs its own HTTP client, clock or database connection cannot be tested without the real thing. Constructor or parameter injection lets a test pass a fake or point at a local server.
    • Time and randomness under control. Code that calls Date.now(), new Date() or Math.random() directly produces results a test cannot predict. Ask for an injected clock or seed, or make sure the test framework can fake them.
    • Observable async work. Background work should return a promise, emit an event or set a visible state (a spinner that disappears, a status field) that a test can wait for, instead of finishing silently after an unknown delay.
    • Stable hooks for the UI. Prefer accessible roles and names, which help users and tests alike, and add a data-testid only where no meaningful accessible name exists. Don't add an aria-label just to give tests a hook: it changes what screen-reader users hear.
    • Tests in the same pull request. New behavior should arrive with unit or API tests at the lowest level that can catch a regression, and changed behavior should change the tests that describe it.
    • Clear errors and logs. An error that says what failed and with which input makes a failing test, and a production incident, much faster to diagnose.

    Sources: Fowler: dependency injection, Playwright locators, MDN: aria-label, Fowler