Skip to content

Conversation

@denischilik
Copy link
Contributor

Summary

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

Details

  • Began migrating Objective-C code into Swift. The migration process followed these steps:
    1. Created all required tests for the target method.
    2. Verified that the tests worked as expected.
    3. Migrated the implementation into Swift.
    4. Re-ran and validated all tests.
  • Added a few setters to allow initializing the mParticle class with mocks for testing purposes.
  • Exposed some classes via the umbrella header to ensure they are accessible from Swift code.

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 denischilik requested a review from a team as a code owner September 10, 2025 11:56
@denischilik denischilik force-pushed the feat/SDKE-64-improve-MParticle-m-Test-Coverage-in-Swift-2 branch from 059d922 to fc60e9e Compare September 10, 2025 13:50
Copy link
Contributor

@nickolas-dimitrakas nickolas-dimitrakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@BrandonStalnaker BrandonStalnaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think I can see the issues that are forcing you to make some of these decisions. I'm just worried that this PR is in essence starting the refactor, with the risks that has, but it's only doing it halfway which forces you to make a bunch of compromises.

I thought the point of this work was to increase find ways to increase testing before we started the refactor. Is that right @rmi22186 ?

@denischilik
Copy link
Contributor Author

So I think I can see the issues that are forcing you to make some of these decisions. I'm just worried that this PR is in essence starting the refactor, with the risks that has, but it's only doing it halfway which forces you to make a bunch of compromises.

I thought the point of this work was to increase find ways to increase testing before we started the refactor. Is that right @rmi22186 ?

I see your point — thanks for raising it. The reason I approached it this way is that after making the code testable and covering those parts with tests, I realized we could already migrate them to Swift safely. My goal here was to demonstrate one possible approach: add test coverage first and then immediately migrate the code, so we don’t have to revisit the same parts later. I thought this would be a good opportunity to share and discuss this approach with the team.

If we decide not to convert to Swift right away, I’m happy to keep just the tests without any code changes.

@rmi22186
Copy link
Member

@denischilik - yup I was thinking about what @BrandonStalnaker was raising here. Let's keep it to test coverage only. We had discussed creating some sort of E2E framework with a simulator app or something that fires off X events, X identity calls, and we have a test suite to ensure any network requests adhere to an expected payload. That way, we are more confident about the payload never changing and any behavior relative to the swift migration.

@denischilik denischilik force-pushed the feat/SDKE-64-improve-MParticle-m-Test-Coverage-in-Swift-2 branch from 172fae3 to 016c67d Compare September 11, 2025 20:14
@denischilik denischilik force-pushed the feat/SDKE-64-improve-MParticle-m-Test-Coverage-in-Swift-2 branch from 016c67d to e98436f Compare September 11, 2025 20:17
@denischilik
Copy link
Contributor Author

@denischilik - yup I was thinking about what @BrandonStalnaker was raising here. Let's keep it to test coverage only. We had discussed creating some sort of E2E framework with a simulator app or something that fires off X events, X identity calls, and we have a test suite to ensure any network requests adhere to an expected payload. That way, we are more confident about the payload never changing and any behavior relative to the swift migration.

Removed changes related to swift migration CC: @rmi22186 @BrandonStalnaker @nickolas-dimitrakas

Copy link
Contributor

@nickolas-dimitrakas nickolas-dimitrakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@BrandonStalnaker BrandonStalnaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By and large this looks good. I have a suggestion for a test that may or may not work but I'll leave whether it goes in up to you.

Edit: Oh! but please make sure all tests have past successfully on the PR before merging.

@denischilik denischilik merged commit b8d67ec into development Sep 12, 2025
19 of 28 checks passed
@denischilik denischilik deleted the feat/SDKE-64-improve-MParticle-m-Test-Coverage-in-Swift-2 branch September 12, 2025 16:06
mparticle-automation added a commit that referenced this pull request Sep 18, 2025
# [8.39.0](v8.38.0...v8.39.0) (2025-09-18)

### Bug Fixes

* Update Hashed Email Logic With Unassigned ([#401](#401)) ([c50b101](c50b101))

### Features

* SDKE-119 Create protocols for testability ([#402](#402)) ([12b636e](12b636e))
* SDKE-119 Create protocols for testability. Part 2 ([#403](#403)) ([6401e0c](6401e0c))
* SDKE-119 Create protocols for testability. Part 3 ([#404](#404)) ([9032458](9032458))
* SDKE-61 Extract and test callback logic. Part 1 ([#395](#395)) ([c3a7da9](c3a7da9))
* SDKE-61 Extract and test callback logic. Part 2 ([#396](#396)) ([2fb2490](2fb2490))
* SDKE-61 Extract and test callback logic. Part 3 ([#397](#397)) ([b6cd236](b6cd236))
* SDKE-61 Extract and test callback logic. Part 4 ([#398](#398)) ([3cf3c88](3cf3c88))
* SDKE-62 Refactor MPListenerController for Testability ([#400](#400)) ([cc843a5](cc843a5))
* SDKE-63-replace-logging-macros-with-swift-helpers ([#405](#405)) ([0ca4964](0ca4964))
* SDKE-64 Improve mParticle.m test coverage in swift ([#406](#406)) ([d4ef623](d4ef623))
* SDKE-64 Improve mParticle.m test coverage in swift 2 ([#407](#407)) ([b8d67ec](b8d67ec))
* SDKE-64 Improve mParticle.m test coverage in swift 3 ([#410](#410)) ([72a111c](72a111c))
@mparticle-automation
Copy link
Contributor

🎉 This PR is included in version 8.39.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants