3

Wondering if others have come into this problem space as well and what their findings were.

We have a react native + react native web application that shares the same code and would like to add functional testing that also shares the same test code much as possible with low false-positive functional tests.

From my research, it seems like there isn't a solution that gives me the best of both world(shared test code between web and native and non-flaky, low false-positive test).

From my research, I've found few contenders as described below:

Native: Detox, Appium, Cavy
Web: Cypress, TestCafe, Nightwatch, Selenium, Appium
Both: Appium

Appium seems to support both, but is based on web-drivers which has mixed reviews due to web-drivers flakiness and false-positives. Also, just how much test code would actually be shared ::thinking.

And now, the other alternative is to use the proper tools available for the environment. Detox seems to be a good solution for native. It supports IOS and mostly android and runs fast and isn't flakey due to its gray-box nature. And for web, testcafe or cypress seems to be a good solution.

Unfortunately, there doesn't seem to be a solution that gives the best of both worlds. Wondering if anyone else had experience in this space, trying to manage testing for multiple platforms?

Would appreciate some comments or even confirmations of my findings.

dchhetri
  • 6,926
  • 4
  • 43
  • 56

1 Answers1

1

I have had success testing my react-native-web project's shared api calls, reducers and components with the following tools: Jest, Enzyme, redux-mock-store, fetch-mock & jest-localstorage-mock

Important note on file structure: A react-native project cannot find symlinked folders outside of src, but a React project can. For this reason I put all of my shared code including all tests in myApp/native/src/shared and myApp/web/src/shared is just a symlink to the shared folder in the native dir. Putting shared outside of web and native, which is what I wanted initially, does not work.

Nunchucks
  • 1,182
  • 10
  • 14
  • Thanks for your suggestion. That setup would help in unit-testing, but for functional end to end testing, wouldn't help because it will the suggested technology doesn't have the same capabilities needed for functional testing. – dchhetri Jul 02 '19 at 19:57
  • Yeah, I doubt there's a single reliable tool you can use to run end to end tests on all three platforms. It looks like you already did the research on that before asking the question :). If you do find one though, post an update here! I would be interested to try it myself. – Nunchucks Feb 09 '21 at 00:05