customerio / customerio-android

This is the official Customer.io SDK for Android.
MIT License
11 stars 9 forks source link

refactor: common-test base test classes #374

Closed mrehan27 closed 1 day ago

mrehan27 commented 2 days ago

part of MBL-394

Background

Previously, common-test reduced a lot of boilerplate code for tests by providing base test classes. However, since we have now decoupled our modules from tracking and made several updates, base classes needed to be updated so they can be leveraged in all modules. This PR addresses these updates to ensure common-test can benefit all modules in the codebase today. The goals include:

Changes

Example Usages

Providing Test Configuration

testConfigurationDefault {
    diGraph {
        sdk { overrideDependency<Logger>(UnitTestLogger()) }
        android { overrideDependency<Application>(TestApplication()) }
    }
}

Combining Test Configurations

override fun setup(testConfig: TestConfig) {
    super.setup(defaultTestConfiguration + testConfig)
}

Overriding Dependencies

diGraph.overrideDependency<Logger>(UnitTestLogger())

Verifying Mock Calls

assertCalledOnce { mock.methodName() }
assertCalledNever { mock.methodName() }
assertNoInteractions { mock }

Notes

See parent PR for more details and context.

github-actions[bot] commented 2 days ago
# Sample app builds šŸ“± Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request. --- * java_layout: `rehan/mbl-394-commontest (1719995444)` * kotlin_compose: `rehan/mbl-394-commontest (1719995447)`
github-actions[bot] commented 2 days ago

Build available to test Version: rehan-mbl-394-commontest-SNAPSHOT Repository: https://s01.oss.sonatype.org/content/repositories/snapshots/

github-actions[bot] commented 2 days ago

šŸ“ SDK Binary Size Comparison Report

No changes detected in SDK binary size āœ…

codecov[bot] commented 2 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.90%. Comparing base (63d88a8) to head (f0eda0f).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## rehan/mbl-394-refactor-base #374 +/- ## ================================================================== + Coverage 18.92% 90.90% +71.98% ================================================================== Files 39 1 -38 Lines 1157 11 -1146 Branches 175 2 -173 ================================================================== - Hits 219 10 -209 + Misses 914 1 -913 + Partials 24 0 -24 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.