Testing for Frontend Developers
Frontend testing is checking that UI code behaves as intended at several levels. Unit and component tests with Vitest or Jest and Testing Library check small pieces, end-to-end tests with Playwright or Cypress drive a real browser, and visual and contract tests catch layout and API mismatches.
Stage: Quality and Performance · Part of the Frontend Developer roadmap · Last reviewed 19 November 2026
What to learn in Testing
- Test a component by querying it the way a user would
- Mock a network request in a unit test
- Write an end-to-end test that logs in and completes a flow
- Reduce flaky tests by awaiting elements rather than using fixed delays
- Add a visual regression check for a key page
Testing interview questions
Why does Testing Library discourage testing implementation details?
Tests tied to state names or internal functions break on refactors even when behaviour is unchanged. Queries by role, label and text match what users perceive, so tests only fail when the visible behaviour breaks, and they push you toward accessible markup.
What is the testing pyramid for frontends?
It suggests many fast unit and component tests, fewer integration tests, and a small number of slow end-to-end tests on critical paths. This balances confidence against speed and maintenance, since end-to-end tests are the most brittle and costly to run.
Where Testing fits in the Frontend Developer roadmap
Testing belongs to the Quality and Performance stage (beginner level), which takes about 4 hours. Make it fast, accessible, secure and tested.
Other units in this stage
Back to the full Frontend Developer roadmap