We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
The Art of Humble Views: Testing React Native Apps the Smart Way - Mo Khazali, TestJS Summit 2023
Learn how to test React Native apps the smart way by separating business logic from presentation, using hooks as single points of truth, and focusing on core business logic.
- Separate business logic from presentation layer: Keep the business logic independent of the presentation layer to make testing easier.
- Use a hook as a single point of truth: Use a hook to encapsulate the business logic, and test the hook instead of the entire component.
- Avoid large, complex components: Break down complex components into smaller, independent hooks to make them easier to test.
- Test the critical components of your app: Focus on testing the core business logic, rather than the entire component.
- Use a testing library: Use a testing library to test the core business logic, rather than trying to test the entire component.
- Mock dependencies: Mock dependencies to isolate the component being tested and make testing easier.
- Test with a focus on business logic: Test with a focus on the business logic, rather than trying to test everything.
- Simplify testing by using a presenter layer: Use a presenter layer to simplify testing by making it easier to test the business logic.
- Use the humble object model: Use the humble object model to encapsulate the business logic and make it easier to test.
- Focus on the core of your app: Focus on the core business logic of your app, rather than trying to test everything.
- Use separation of concerns: Use separation of concerns to keep the business logic independent of the presentation layer.
- Test once, reuse everywhere: Use a hook as a single point of truth to test once and reuse everywhere.
- Avoid testing everything: Focus on testing the critical components of your app, rather than trying to test everything.