Skip to main content

The Entain Native Apps Testing Stack

In the native apps project we use a number of testing libraries and packages to accomplish our goal of testing our apps. Being React Native, many of them are common web and React testing tools, or at least have very similar APIs. They are:

  • Jest (test runner) https://jestjs.io/
    • Jest is a Javascript testing framework that allows us to write and run our tests. It takes our test files and executes them in a Node environment, displaying the results in a convenient format.
  • React Native Testing Library https://callstack.github.io/react-native-testing-library/
    • RNTL is a library that provides a set of utilities that make testing React Native components easier, particularly in a way user's would interact with the app. It also helps by encouraging best testing practices by focusing on component behaviour rather than implementation details.
  • React Hooks Testing Library (for testing hooks) https://github.com/testing-library/react-hooks-testing-library
    • React Hooks Testing library is more or less the same thing as RNTL, but for React hooks. It gives us the tools we need to easily test the behaviour of our custom hooks.
  • MSW (for API mocking) https://mswjs.io/
    • MSW allows us to intercept API calls made by our code. This means we can override responses to execute our code under different conditions, as well as avoid having to make real network calls as part of our tests.
  • Detox (E2E tests) https://wix.github.io/Detox/
    • Detox is a grey box E2E testing framework for React Native. It connects to a running app and allows us to execute tests against it, interacting with the app as a user would.

Depending on what tests you are writing you will use one or more of these tools. While these docs will cover the basics of each, it's important for you to give the docs for each individual tool a read to get a better understanding of how they work and the API they expose to you.