Performance Regression testing
What is Reassure
- Write maintainable performance tests for your React Native apps
- Extend your existing RNTL tests into performance tests easily
- Supported by React Native community and its core contributors
Importance of testing
Types of tests
- Unit tests - tests individual components in isolation
- Integration testing - test interaction between interconnected components/systems
- E2E testing - tests the whole application
- Performance Testing - testing the speed, stability, and responsiveness of app under a certain workload
- Snapshot testing - captures of 'snapshot' of UI component and compares it
- Regression Testing - Testing existing software functionalities after changes
Where does Reassure fit?
Intersection of Performance testing, Regression testing and snapshot testing
What Reassure can do?
Reassure works by measuring render characteristics – duration and count – of the testing scenario you provide and comparing that to the stable version. It repeats the scenario multiple times to reduce the impact of random variations in render times caused by the runtime environment. Then it applies statistical analysis to figure out whether the code changes are statistically significant or not. As a result, it generates a human-readable report summarizing the results and displays it on the CI or as a comment to your pull request.
Setting it up
yarn add --dev reassure
//jest.setup.ts
configure({testingLibrary: 'react-native'});
Run it with
yarn reassure
Set up initial baseline
yarn reassure --baseline
This will write baseline.perf file against which it will compare in subsequent runs
yarn reassure
Let's get into the code
Resources
- Reassure - https://callstack.github.io/reassure/
- Profiler API -https://react.dev/reference/react/Profiler
- Repo: https://github.com/vnovick/reassure-workshop-demo
Source Code
Performance Regression testing with Reassure
By Vladimir Novick
Performance Regression testing with Reassure
- 162