Skip to content

Conversation

@denischilik
Copy link
Contributor

This is the 3 PR in the series aimed at improving the test coverage of mParticle.m. The first PR is #407

Summary

  • add more tests

Testing Plan

  • Was this tested locally? If not, explain why.
  • {explain how this has been tested, and what, if any, additional testing should be done}

Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)

denischilik and others added 13 commits August 21, 2025 14:15
* - extract method setOptOutCompletion
- create tests for setOptOutCompletion method

* - extract callback into method identifyNoDispatchCallback

* - add tests for identifyNoDispatchCallback method

* - extract configuration logic into configureWithOptions method

* - add test to check default configuration when method was called configureWithOptions

* - address PR review comments.
- sut was renamed to mparticle
- rename test methods
* - add settings provider

* - add test to check default configuration

* - add SettingsProviderMock

* - cover scenarios what were configuration not nill and we need update settings

* - add MPUserDefaultsProtocol to  replace MPUserDefaults in swift code with mock
- extract callback code into startWithKeyCallback method
- write test to cover uncovered scenarios of startWithKeyCallback
* - extract callback logic into beginTimedEventCompletionHandler method
- enable gather coverage in schema

* - add test for beginTimedEventCompletionHandlerData method

* - move mocks in Mock folder

* - rewrite SettingsProviderMock in Swift

* - add MPDataPlanFilterProtocol
- add mock for this protocol

* - add test to increase test coverage

* - extract callback to method logEventCallback

* - cover logEventCallback with tests

* - extract logScreen callback into logScreenCallback method

* - cover logScreenCallback with tests

* - check_script.sh can be launched without creating venv
* - extract callback into leaveBreadcrumb

* - cover leaveBreadcrumbCallback with tests

* - extract callback into logErrorCallback

* - cover logErrorCallback with tests

* - extract callback into logExceptionCallback

* - cover logExceptionCallback with tests

* - test logCrashCallback

* - test logCommerceEventCallback

* - test logLTVIncreaseCallback

* - test logNetworkPerformanceCallback
* - add MPListenerControllerProtocol
- initialize listenerController property
- create mock MPListenerControllerMock
- replace singelton usage in mparticle.m
- cover listener controller usage with test

* - location related test where excluded from testing when MPARTICLE_LOCATION_DISABLE not set

* - tvos and location related tests should be executed within correct configuration
* - generalize property type to protocol for testability/mocking

* - create script to verify usage of [MParticle sharedInstance] in methods
- create mock to use in swift tests

* - add StateMachineProtocol

* - exclude tests not related to MPARTICLE_LOCATION_DISABLE and tvos

* - add MPStateMachineMock

* - mock should have location related fields

* - beginTimedEvent fully covered with tests

* - add test to check setOptOutMethod and to check how mock works

* - method should be available for ios

* - CoreLocation should be imported into mock

* - ignore warning
- remove russian from script

* message

* reorder
* - use kitContainer protocol instead of kitContainer_PRIVATE

* - make property available fro protocol

* - add setter to keep _kitContainer_PRIVATE and _kitContainer properties the same
- access kitsInitialized property through protocol

* - add MPKitContainerMock

* - create two tests to check that MPKitContainerMock works as expected
* - create protocol for MPPersistenceController_PRIVATE

* - add test to check MPPersistenceControllerMock
* fix: Update Hashed Email Logic with Unassigned
- macroses usage were removed from mparticle.m file
- make MPLog methods accessible from objc code
- use MPLog methods instead macroses
- increase timeout for flaky test
* - extract executor code to call it from mParticle file, old code still available because it is used from different places

* - use executor instead dispatch_async

* - move executor in separate files
* - add executor mock
* - update nullability
* - add tests
@denischilik denischilik requested a review from a team as a code owner September 15, 2025 13:26
@denischilik
Copy link
Contributor Author

Wrong target branch

@denischilik denischilik deleted the feat/SDKE-64-improve-MParticle-m-Test-Coverage-in-Swift-3 branch September 17, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants