swift-async-algorithms icon indicating copy to clipboard operation
swift-async-algorithms copied to clipboard

Tools for testing Swift concurrency

Open stephencelis opened this issue 3 years ago • 3 comments

A couple of weeks ago I brought up on the forums that it's basically impossible to write reliable tests for concurrent code: https://forums.swift.org/t/reliably-testing-code-that-adopts-swift-concurrency/57304

This repo has a bunch of internal code that aids in testing isolated async code, e.g. its sequences, in predictable, reproducible, and fast ways. This includes custom clocks, executors, and more.

Tools like these would ideally be more widely available to users that want to test async code, and should be extracted from this repo. They still won't make it possible to test async code that is threaded between actors, but hopefully this issue is also on Apple's radar, and a solution is in the works.

stephencelis avatar May 25 '22 16:05 stephencelis

The first step of this is done; extracting the support into it's own package. I think the next step is to isolate more general purpose items and codify those into a maintainable general purpose testing infrastructure.

phausler avatar May 25 '22 17:05 phausler