· AI dev tools
Depop migrates 10,000 XCTest unit tests to Swift Testing, cutting CI runtime
A substantial boost to CI runtime was achieved by Depop after migrating around 10,000 unit tests from XCTest to Swift Testing, a process that incorporated some help from coding agents to modernize…
A substantial boost to CI runtime was achieved by Depop after migrating around 10,000 unit tests from XCTest to Swift Testing, a process that incorporated some help from coding agents to modernize their testing setup.
According to Anastasia Petrova, an engineer at Depop, the decision to undertake this migration stemmed from several recognized advantages. These included the understanding that "Swift Testing is where Apple Development is going," the improved capability for running tests in parallel, its seamless integration with Swift Concurrency, and the availability of sophisticated features such as nested suites, test traits, and parameterized tests. Furthermore, another goal was to establish a consistent standard for Swift Testing usage throughout the entire codebase, given that the existing tests lacked any unified convention.
A major advantage realized from the transition was the ability to parallelize tests, which resulted in a considerable decrease in the time required on the CI runner. Because Swift Testing executes tests in-process utilizing Swift Concurrency’s cooperative thread pool, when one test pauses using `await`, another test can utilize that same thread. This architecture proves to be a much better fit for a small VM environment, and early performance measurements indicated about an 80% improvement in runtime when comparing XCTest without parallelization against Swift Testing with it.
It is worth noting that artificial intelligence agents only played a supplementary role in Depop's migration. The team favored a manual method rooted in syntax, relying on `swift-testing-revolutionary`, an open-source tool built on SwiftSyntax that enforces Apple's guidance for migration. The team chose not to depend solely on AI for several reasons; even when given very precise instructions, the AI often made subtle alterations to the tests that went beyond mere mechanical mapping. In certain instances, the resulting conversion appeared less like a syntactic change and more like a "rewrite" or a slight refactoring of the tests. While this method would still function adequately in general, and perhaps yield slightly superior tests, it would significantly complicate the code review procedure.
However, an agent was employed to manage the entire workflow, from initiating the conversion script and running the tests to submitting a pull request. If the test execution remained error-free and stable across 100 repetitions, and the PR contained no actual changes to the codebase, it was automatically approved. Conversely, when test execution failed, the agent was programmed to correct the test and flag the PR for human examination.
Petrova elaborated that the migration encountered a few unforeseen complications, including issues related to data races, scenarios where tests passed locally but failed on the CI, limitations within the converter, and the necessary time spent on PR review. Most of the data races were successfully resolved by either assigning each test its own dedicated instance or by temporarily enforcing serialization using `@Suite(.serialized)`. Failures occurring exclusively on CI were mostly tied to UI tests running on secondary threads, a problem solved by mandating that all UI-related tests be isolated to `@MainActor`. Lastly, the automatic conversion process did not automatically incorporate advanced Swift Testing features like parameterized tests, nested suites, and test traits, necessitating a subsequent manual refactoring effort.
Although Depop utilized AI mainly as an orchestrator for its migration, other organizations have explored deeper levels of AI involvement. For instance, Ibrahim Oktay, an engineer at Sixt, recounted rewriting 7,000 unit tests using AI, finishing the entire task in a single afternoon at an AI expenditure of only $106. Oktay stated that the success of this undertaking hinged upon creating a bespoke conversion agent that incorporated approximately 1200 migration rules specific to their application’s architecture.
Why it matters
For developers focused on tooling, this case study shows a practical path to modernizing testing infrastructure using Apple's latest frameworks. The trade-offs between full automation versus manual refinement are crucial considerations when adopting new testing standards.




