dd-sdk-flutter
dd-sdk-flutter copied to clipboard
Make datadog sdk mock-able for unit tests
Are you requesting automatic instrumentation for a framework or library? Please describe.
- Framework or library name : [
datadog_flutter_plugin
] - Library version: [1.6.0]
Is your feature request related to a problem? Please describe.
I was trying to verify logging and rum calls, which the datadog SDK is making i.e. DatadogSdk.instance.rum?.addError()
or DatadogSdk.instance.logs?.debug()
, in unit tests.
Turns out there is no simple way of achieving that. There is the initializeForTesting
method, which is more for E2E tests as it will assign NoOp
instances. However, for unit tests I need to mock all of these instances to verify their calls, and since not all classes are being exposed from the package, I couldn't do that.
I might have missed something, but what is the best way of testing this?
Describe the solution you'd like
Allow for mocking for package specific classes.
Describe alternatives you've considered N/A
Additional context N/A