adobe / adobe/aepsdk-core-android
[discussion] How can we refactor platform services classes to make them easier to test using mocking frameworks
- 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
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