react-native-testing-library vs @testing-library/react-native vs detox

Created on 20 Feb 2020  路  1Comment  路  Source: callstack/react-native-testing-library

This issue is more React Native Testing related that specific to react-native-testing-library.
And hope discussion will help others to understand React Native Testing approach.


A long time ago I wrote some tests with enzyme, but did like the experience and ignored tests on components.

Now I want to start again. Heard about react-native-testing-library in a podcast. Researching how to test react-native I found @testing-library/react-native and detox.

While react-native-testing-library/@testing-library/react-native are component base testing the detox is e2e testing.

So I have several questions:

  1. Is there a major difference between react-native-testing-library and @testing-library/react-native or it is a preference choice?
  2. Do I really need detox if I am using react-native-testing-library or @testing-library/react-native?
  3. Do I really need react-native-testing-library or @testing-library/react-native if I am using detox?
  4. If I may use detox together with react-native-testing-library or @testing-library/react-native, what should I test with react-native-testing-library and what with detox?
question

Most helpful comment

  1. Slight differences, mostly a preference
  2. No, detox runs on simulator/emulator, RNTL runs in Node.js environment
  3. No, they're independent. Detox is e2e testing library, RNTL is "unit/integration" testing library
  4. Use detox to cover user flows from screen to screen and vital functionalities like payments. Use RNTL for everything else, like testing components or single screens (but nothing prevents you from testing user flows as well, might be tricky to set up at first)

>All comments

  1. Slight differences, mostly a preference
  2. No, detox runs on simulator/emulator, RNTL runs in Node.js environment
  3. No, they're independent. Detox is e2e testing library, RNTL is "unit/integration" testing library
  4. Use detox to cover user flows from screen to screen and vital functionalities like payments. Use RNTL for everything else, like testing components or single screens (but nothing prevents you from testing user flows as well, might be tricky to set up at first)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ptrckhjnl picture ptrckhjnl  路  6Comments

maitriyogin picture maitriyogin  路  7Comments

Andarius picture Andarius  路  9Comments

deepakaggarwal7 picture deepakaggarwal7  路  3Comments

bitttttten picture bitttttten  路  9Comments