BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News DoorDash Used Copilot to Convert Its XCTest-Based iOS Test Suite to Swift Testing

DoorDash Used Copilot to Convert Its XCTest-Based iOS Test Suite to Swift Testing

Listen to this article -  0:00

Using Copilot along with strong reliability safeguards, DoorDash migrated their iOS XCTest-based test suite to Swift Testing, thus modernizing a large test suite quickly, safely, and with measurable performance gains, says DoorDash engineer Matheus Gois.

According to Gois, DoorDash engineers anticipated both improved performance and better failure diagnostics from the migration. Their benchmarks confirmed that Swift Testing was four to seven times faster than XCTest, largely due to its ability to run tests in parallel for both synchronous and asynchronous code. Additionally, the #expect macro delivers richer failure messages, which helps accelerate debugging.

Slow, mostly serialized XCTest runs had clogged DoorDash’s iOS continuous integration, or CI, pipelines. As our apps and shared packages grew, the CI test step stretched into double-digit minutes, consumed more CI resources, and slowed iteration for every engineer.

For the migration to scale across the company, DoorDash paired automation with clear engineering principles: each team owned the migrations of their own tests, using a common set of tools and shared guidelines; a tooling-first approach ensured a consistent, repeatable workflow common to all teams; and strict reliability gates minimized the risk of flakiness in migrated tests.

DoorDash engineers, Gois explains, built a developer-friendly environment using the AI coding assistant Cursor, SweetPad for Visual Studio Code/Xcode integration, and a custom MCP server enabling engineers to build targets and run tests before and after the migration directly within the editor:

The main tool exposed is execute_vscode_command, which takes a commandId such as sweetpad.build.build or sweetpad.build.test and runs that action. The server starts automatically when the SweetPad extension activates and stops when the editor closes.

To "teach" Cursor to migrate tests, they defined a "migration rule" that automated most of the mechanical conversion from XCTest to Swift Testing such as changing import statements, converting XCTAssert to #expect, inserting the @Test macro and handling async/await where required, and more. This allowed engineers to focus on correctness rather than syntax changes.

To ensure reliability, each migrated test had to pass ten consecutive runs, eliminating any flakiness and time sensitivity before adoption.

Midway through the migration, DoorDash engineers adopted Bazel, which required them to extend slightly their agent workflow. Specifically, they included the bazel test commands directly in the prompt, enabling the agent to run tests locally without manual intervention. This also supported an iterative loop in which the agent would run the tests and fix any errors surfaced, and repeat the process until it got a clean execution.

This keeps Bazel at the center of the reliability story. It does not matter whether the tests are triggered from a local terminal or through SweetPad and Cursor. The same targets run, the same ten-run rule applies, and every package is held to the same standard.

This process surfaced hidden issues—such as shared state, order dependencies, and timing assumptions. All of those were masked by XCTest's largely sequential execution but exposed by Swift Testing's parallel model.

Overall, migrating to Swift Testing delivered ~60% faster test execution in CI, ~40% faster overall builds, reduced infrastructure costs, and reclaimed developer time. For more details, including excerpts of the Copilot prompts used, see the original article.

About the Author

Rate this Article

Adoption
Style

BT