Skip to content

Conversation

@denischilik
Copy link
Contributor

@denischilik denischilik commented Nov 20, 2025

Background

First PR in a series establishing automated integration test infrastructure for the iOS SDK. This PR sets up WireMock-based testing framework with automated recording/verification and adds initial test coverage for core SDK functionality. Future PRs will incrementally add more test scenarios.

What Has Changed

Mappings are now stored in unescaped (readable) format

  • Previously: Mappings were stored in different files
  • Now: Mappings are stored in human-readable JSON format in a single file per test

🛠 Utility Scripts

Two new scripts for mapping management:

  1. transform_mapping_body.py - Handles escape/unescape transformations

    • Converts between human-readable and WireMock-compatible formats
    • Allows mappings to be stored in readable format in git
  2. sanitize_mapping.py - Prepares mappings for use

    • Removes dynamic fields that change between test runs
    • Ensures consistent mapping behavior

Checklist

  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have tested this locally.

Additional Notes

This is part 1 of the test coverage implementation. Subsequent PRs will add more test cases as tracked in subtask SDKE-632.

All integration tests pass successfully with 100% mapping match rate.

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

- Tests transaction events with nested dictionaries
- Covers Date objects, Numbers, and Strings in attributes
- Verifies custom flags are properly handled
- Automatically replace API keys in URLs with {API_KEY} placeholder
- Rename body files to remove API keys from filenames
- Auto-regenerate mapping files with sanitized data
- Update all references automatically

This ensures no API keys are committed to the repository.
- Tests transaction event type with MPEvent
- Covers custom attributes: string, number, date, nested dictionary
- Verifies custom flags (Not_forwarded_to_providers)
- Uses static dates for deterministic testing
- Based on ViewController.m logEvent method (lines 131-147)
- Tests screen view logging functionality
- Based on ViewController.m logScreen method (lines 149-151)
- Verifies screen name 'Home Screen' is properly tracked
- Covers screen view event type (dt: 'v') serialization
- Tests logCommerceEvent with product and transaction attributes
- Covers product attributes (name, SKU, price, brand, category, coupon)
- Covers transaction attributes (revenue, tax, shipping, affiliation, transaction ID)
- Verifies commerce event custom attributes and checkout options
- Based on ViewController.m logCommerceEvent method (lines 153-180)
- Related to SDKE-535 test coverage implementation
- Added Test 5: Rokt Select Overlay Placement
- Tests Rokt SDK integration through mParticle
- Verifies identity change when selecting placements with custom attributes
- Based on ViewController.m selectOverlayPlacement method (lines 182-192)
@denischilik denischilik requested a review from a team as a code owner November 20, 2025 19:50
}

// Test 4: Log Commerce Event with Product and Transaction
// Based on ViewController.m logCommerceEvent method (lines 153-180)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Based on ViewController.m logCommerceEvent method (lines 153-180)
// Based on ViewController.m logCommerceEvent method

Nit: Line numbers here and other comments with line numbers are highly likely to change separately to the comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks will update

@denischilik denischilik merged commit 3213048 into main Dec 1, 2025
17 of 19 checks passed
@denischilik denischilik deleted the feat/SDKE-535-Implement-Test-Coverage-for-iOS-SDK branch December 1, 2025 14:48
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