react-testing-library logo

react-testing-library

A lightweight solution for testing React components
272
155
+ 1
4

What is react-testing-library?

It is a simple and complete React DOM testing utility that encourage good testing practices. It provides light utility functions on top of react-dom and react-dom/test-utils, in a way that encourages better testing practices.
react-testing-library is a tool in the Testing Frameworks category of a tech stack.
react-testing-library is an open source tool with GitHub stars and GitHub forks. Here’s a link to react-testing-library's open source repository on GitHub

Who uses react-testing-library?

Companies
87 companies reportedly use react-testing-library in their tech stacks, including Graphy, Zé Delivery, and OmniPlatform.

Developers
167 developers on StackShare have stated that they use react-testing-library.

react-testing-library Integrations

Pros of react-testing-library
3
We can test behavior
1
Good documentation
Decisions about react-testing-library

Here are some stack decisions, common use cases and reviews by companies and developers who chose react-testing-library in their tech stack.

Shared insights
at

I'm working as one of the engineering leads in RunaHR. As our platform is a Saas, we thought It'd be good to have an API (We chose Ruby and Rails for this) and a SPA (built with React and Redux ) connected. We started the SPA with Create React App since It's pretty easy to start.

We use Jest as the testing framework and react-testing-library to test React components. In Rails we make tests using RSpec.

Our main database is PostgreSQL, but we also use MongoDB to store some type of data. We started to use Redis  for cache and other time sensitive operations.

We have a couple of extra projects: One is an Employee app built with React Native and the other is an internal back office dashboard built with Next.js for the client and Python in the backend side.

Since we have different frontend apps we have found useful to have Bit to document visual components and utils in JavaScript.

See more
Needs advice
on
CypressCypressSelenideSelenide
and
WebdriverIOWebdriverIO

Hi, I am starting out to test an application that is currently being developed - FE: React. BE: Node JS. I want the framework to be able to test all UI scenarios (from simple to complex) and also have the capability to test APIs. I also need to run tests across all OSs and Browsers (Windows, Mac, Android, iOS). I have also looked into react-testing-library and @TestProject.io. Any advice you can give as to which framework would be best and why would be so much appreciated! Thank you!!

See more

react-testing-library's Features

  • light-weight solution for testing
  • React DOM testing utilities
  • works with any environment that provides DOM APIs

react-testing-library Alternatives & Comparisons

What are some alternatives to react-testing-library?
Enzyme
Enzyme is a JavaScript Testing utility for React that makes it easier to assert, manipulate, and traverse your React Components' output.
Cypress
Cypress is a front end automated testing application created for the modern web. Cypress is built on a new architecture and runs in the same run-loop as the application being tested. As a result Cypress provides better, faster, and more reliable testing for anything that runs in a browser. Cypress works on any front-end framework or website.
Jest
Jest provides you with multiple layers on top of Jasmine.
Git
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
GitHub
GitHub is the best place to share code with friends, co-workers, classmates, and complete strangers. Over three million people use GitHub to build amazing things together.
See all alternatives

react-testing-library's Followers
155 developers follow react-testing-library to keep up with related blogs and decisions.