adobe / adobe/aepsdk-core-android

[discussion] How can we refactor platform services classes to make them easier to test using mocking frameworks

Open
#118 0 comments 0 reactions 0 assignees View on GitHub
defer discussion
Dominant language
Kotlin
Stars
17
Forks
30
Avg merge
8h 37m
Merged PRs (30d)
5

Description

In many public service classes like NetworkService, we initialize a lot of dependencies inside the class, on different thread, which makes it difficult to mock them while writing tests. We would end up having to add dummy constructor for testing purpose only sometimes to make it testable. Can we find a more generic pattern for dependency injection like using factory classes, which provide dependencies and can be replaced with mocks during testing?

Contributor guide

Open the contributing guide

Research direction

Start by reading the public service classes mentioned in the issue, including NetworkService, and inspect where dependencies are initialized across threads. Review the existing tests and any testing-only constructors to understand the current constraints. Done means agreeing on and applying a generic dependency-injection pattern that allows those dependencies to be replaced by mocks.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile-dev, testing
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.