@xstate/test
and React Workshop
Model-Based Testing with Welcome to the workshop! To get started, follow these instructions:
- Make sure you have Node and NPM installed.
- Run
npm install
oryarn install
to install all dependencies.- This is a React project bootstrapped with Create React App.
- Run
npm start
to start the app.
Goal
The goal of this workshop is to demonstrate how to use @xstate/test
with React to automate the generation of integration and end-to-end (E2E) tests of an example application.
Running the Tests
To run the integration tests, run npm test
. This will run the tests found in ./src/App.test.js
.
To run the E2E tests, run npm run e2e
. This will run the tests found in ./src/App.e2e.js
.
Resources
- Github:
@xstate/test
- Slides: Write Less Tests! From Automation to Autogeneration (React Rally 2019)
- Article: Model-Based Testing in React with State Machines (CSS-Tricks)