Simple and complete React Native testing utilities that encourage good testing practices.
The React Native Testing Library (RNTL) is a lightweight solution designed for testing React Native components. It provides utility functions on top of react-test-renderer, emphasizing best testing practices to create maintainable tests that focus on confidence in the functionality of components. Inspired by React Testing Library, RNTL aims to align tests closely with how the software is used for increased confidence.
To install the React Native Testing Library in your project, follow these steps:
# Using yarn
yarn add @testing-library/react-native
# Using npm
npm install @testing-library/react-native
Make sure to match the react-test-renderer version with your React version as this library has peerDependencies listed for it.
The React Native Testing Library offers a lightweight and effective solution for testing React Native components with a focus on maintainability and confidence in test results. By aligning tests with software usage, providing essential methods, and supporting additional Jest matchers, RNTL aims to streamline the testing process for React Native applications. With migration guides and a troubleshooting resource available, developers can easily adopt and utilize this library for testing their projects.