Skip to content

Support for testing against Datadog instance #2778

@sampengilly

Description

@sampengilly

Feature description

I'm working on code that integrates with Datadog android APIs that I'd like to test effectively without relying on heavyweight mocks for Datadog objects and functionality.

For example, for internal use in my organisation I have a wrapper library which assists with configuring Datadog correctly across a handful of different apps. I also have an Otel LoggerProvider implementation which routes logs to the Datadog logger. I'd like to be able to write tests that can verify the correct interactions with the Datadog API such as verifying that specific features are enabled and inspecting their config, or capturing the log entries received and processed by Datadog.

At the moment many of the elements of the SDK are accessed via separate static objects and builder functions around an SdkCore instance. I haven't seen anything in the docs or code which looks like a publicly available set of testing utilities which could be used to avoid lots of mocking of the public parts of the Datadog SDK.

Proposed solution

I'd expose a testing library containing a TestRule for managing a Datadog instance during tests, along with a collection of Fakes for different features and the SDK core.

Other relevant information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions