
Testing Library
Simple and complete testing utilities that encourage good testing practices
Open source
Description
Testing Library is a family of open-source JavaScript libraries for testing user interfaces by querying the page the way users find things on it. Tests look up elements by role, label and text rather than by implementation details, which the project says keeps tests from breaking when only the internals of an app change, and gives confidence that the UI works for real users. The core library has adapters for React, Vue, Angular, Svelte, Preact, ReasonReact and React Native, and the site lists use with Cypress, Puppeteer, Testcafe and Nightwatch. Built-in selectors are designed to be accessible by default. The site includes getting started guides, examples, an API reference and a guide to choosing the right query. The project is developed on GitHub by Kent C. Dodds and contributors, with help from a Discord server and Stack Overflow.…
Preview
Highlights
- Find elements by role, label and text
- Adapters for React, Vue, Angular and Svelte
- Works with Cypress, Puppeteer and Testcafe
- Accessible-by-default selectors
- Docs, examples and API reference
Ratings & Reviews
No ratings yet
Be the first to rate Testing Library.
People also visit
Testing Library FAQ
What is Testing Library?
A set of testing utilities that query your UI the way users find it, so tests focus on behaviour rather than implementation.
Can I use it for unit and end-to-end tests?
The site says you can write unit, integration and end-to-end tests with it, as long as the tests resemble how the software is used.
What if my app is localized?
The site advises getting the default text for tests if you can. If not, it suggests data-testid attributes, which it says are not bad in themselves.
Is it free?
Yes. The project is open source and developed on GitHub.
What are the best Testing Library alternatives?
Popular alternatives to Testing Library include Puppetry, snippets.uilicious.com and Percy. See all Testing Library alternatives















