Testing in React Native — Jest & Detox – Pillow.codes

Testing in React Native  with  Jest & Detox



#ReactJS #Jest

  • Testing can help identify bugs introduced during the development phase of the app and addressing these bugs before release means that your users will always get to use a reliable product.What kind of tests can we use?Unit tests are used to test small modular pieces of code (aka units) independently.Integration tests…
  • One of my favorite things about Jest is a feature called Snapshot testing.Snapshot tests are a very useful tool whenever you want to make sure the UI for a component or the object from an redux action or reducer does not change unexpectedly.Here’s a good explanation of what a snapshot…
  • Here’s a simple example on how to set this up.Jest tests for Pillow Pro appE2E tests: DetoxAn end-to-end test emulates a user by finding and interacting with pieces of UI in your app in a production/release environment.Detox is a gray box E2E Tests and Automation Library for Mobile Apps built by WixWe…
  • Here’s how we handle them in Detox:LoginHere’s a simple example of what a detox test for logging into the app might look like:DemoAnd finally, here’s a part of our E2E test suite in action.
  • Also, automating the tests on Bitrise CI has helped us streamline our release pipeline by preceding every release with the tests workflow.Hopefully, this post details how easy it is to test a React Native app and automate the testing process as well.

At Pillow, we release an update to our Pillow Pro app (iOS & Android) every 2 weeks or so. Most releases are over-the-air (OTA) updates that are done using CodePush, and are fully automated with…

At Pillow, we release an update to our Pillow Pro app (iOS Android) every 2 weeks or so. Most releases are over-the-air (OTA) updates that are done using CodePush, and are fully automated with Bitrise. If you would like to know more about our CodePush + Bitrise CI setup, read my previous blog post here.In this post, I’ll be talking briefly about why we need to test our app and the kinds of tests we can use. Then, I’ll jump straight into how we use Jest (unit tests) and Detox (end-to-end tests) for our Pillow Pro app. And finally, I’ll talk about running these tests on a CI such as Bitrise.Why test our mobile app?The most important reason is to ensure high product quality. Testing can help identify bugs introduced during the development phase of the app and addressing these bugs before release means that your users will always get to use a reliable product.What kind of tests can we use?Unit tests are used to test small modular pieces of code (aka units) independently.Integration tests combine related “units” together and test them as a group.End-to-end tests are comprehensive, user-level tests that ensures that the flow of the app works as intended from start to finish.Regression tests help to verify that the software that was previously developed and tested still performs the same way after a few changes.Unit tests: JestJest is a JavaScript Testing framework built by Facebook and it ships with React Native by default (starting v0.38.0).One of my favorite things about Jest…

Testing in React Native — Jest & Detox – Pillow.codes