ReactTestGenie is a tool for generating unit tests for single React components in the browser. It leverages the power of a Language Model to suggest user interactions and happy paths, helping developers create comprehensive test suites for their React applications more efficiently.
ReactTestGenie is a tool for generating unit tests for single React components in the browser. It leverages the power of a Language Model to suggest user interactions and happy paths, helping developers create comprehensive test suites for their React applications more efficiently.
- Automatic Test Generation: Input your React component code and let ReactTestGenie suggest user interactions and test scenarios.
- Customizable Suggestions: Select and customize the suggested test scenarios according to your specific testing needs.
- Code Generation: Generate Jest or React Testing Library unit test code based on the selected scenarios.
- In-Browser Interface: All functionality is accessible through a user-friendly web interface, making it easy to integrate into your development workflow.
- Copy-Paste Convenience: Copy generated test code directly from the browser for seamless integration into your project.
To use ReactTestGenie, follow these steps:
- Clone this repository to your local machine.
- Open the
index.html
file in your web browser. - Input your React component code into the designated area.
- Review the suggested test scenarios and select the ones you want to include in your unit tests.
- Customize the selected scenarios as needed.
- Click the "Generate Tests" button to generate the unit test code.
- Copy the generated test code and integrate it into your React project's test suite.
Here's a quick example of how to use ReactTestGenie:
// Sample React Component
import React from 'react';
const Button = ({ onClick, children }) => (
<button onClick={onClick}>{children}</button>
);
export default Button;