Grab Aug 12, 2026

Tackling UI Test Execution Time Imbalance for Xcode Parallel Testing

Article Summary

Grab's engineering team discovered that Xcode's parallel testing was secretly sabotaging their CI pipeline. Tests from the same class were forced onto the same simulator, creating massive execution time imbalances.

Grab's iOS team faced a critical bottleneck: their UI test suite was taking too long in CI, and Xcode's parallel testing wasn't helping as much as expected. The culprit? An undocumented constraint that grouped all tests from the same class onto a single simulator, leaving other simulators idle while one struggled with the workload.

Key Takeaways

Critical Insight

By manipulating test names with random tokens and swizzling XCTestSuite initialization, Grab achieved better load balancing and stabilized their test time imbalance at around 0.4 minutes.

The scheduling logs revealed exactly how Xcode was making distribution decisions, and the fix required getting creative with method swizzling.

About This Article

Problem

Grab's iOS CI infrastructure had uneven test execution times because Xcode groups all tests from the same class onto a single simulator. This prevented tests from being distributed efficiently across parallel workers.

Solution

Grab's team added random tokens to test class names when passing them via the -only-testing argument. This tricked Xcode's grouping logic. They then swizzled XCTestSuite.init(forTestCaseWithName:) to strip out the tokens and restore the original test names before the tests ran.

Impact

The test time imbalance metric dropped and settled around 0.4 minutes. This let Grab add more tests to classes without slowing down the CI pipeline.