How do I write maintainable tests that don't break with every UI change?
Asked by The SDET Playbook
Asked Sep 28, 2026Viewed 0 times
How do I write maintainable tests that don't break with every UI change?
Asked by The SDET Playbook
Sign in to answer and to vote.
Test observable behavior, not implementation details, so refactoring does not break tests. Isolate UI knowledge in page or component objects, keep one condition per test, and use descriptive names, accepting a little duplication where it helps readability. Push checks down to the lowest level that can catch them, and delete high-level tests that lower-level ones already cover. Kent C. Dodds' guiding rule is that the more a test resembles real usage, the more confidence it gives, which favors user-facing queries over brittle internals.
Sources: Fowler, Selenium docs, Kent C. Dodds