sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Add tests for the Native Bridges

Open philipphofmann opened this issue 4 years ago • 5 comments

RNSentry.m has no tests. We could add a layer of abstraction, unit tests in Swift and run them in CI to validate its functionality.

philipphofmann avatar Nov 05 '21 12:11 philipphofmann

also for Android, so I made it more generic, thanks.

marandaneto avatar Nov 05 '21 12:11 marandaneto

I wouldn't mind having two issues and / or two PRs so they get merged faster.

philipphofmann avatar Nov 05 '21 12:11 philipphofmann

I don't disagree with the issue but worth mentioning that unit testing this has limited value as compared to an integration test. That's because this type is called by React Native (RCT_EXPORT_METHOD) and the type marshaling plays a role here too. Additionally, there's very little logic.

bruno-garcia avatar Nov 05 '21 12:11 bruno-garcia

I believe some pieces could be unit tested but indeed, integration/e2e would play a bigger role.

marandaneto avatar Nov 05 '21 13:11 marandaneto

Integration tests make more sense because even if the unit tests are green the functionality could be broken because the underlying functionality changed.

philipphofmann avatar Jan 05 '22 14:01 philipphofmann

  • iOS native tests added in https://github.com/getsentry/sentry-react-native/pull/2707
  • Android native tests added in https://github.com/getsentry/sentry-react-native/pull/3170

krystofwoldrich avatar Apr 30 '24 08:04 krystofwoldrich