How to write basic async tests 如何编写基本的异步测试
Both Swift Testing and XCTest allow us to test asynchronous code built with Swift concurrency by marking tests as async. This means we can wait for concurrent code to complete...
How to handle concurrency errors in unit tests 如何处理单元测试中的并发错误
Both Swift Testing and XCTest give us three main options for handling errors in tests: we can consider them immediate failures, we can handle them internally and make our own asser...
How to test completion handlers with Swift Testing and XCTest 如何使用 Swift Testing 和 XCTest 测试补全处理程序
When you're dealing with older concurrency code that relies on callback functions that get run when some work completes rather than using Swift concurrency's async/await ...
How to test AsyncSequence and AsyncStream 如何测试 AsyncSequence 和 AsyncStream
Concurrent Swift code often streams values over time rather than returning them all at once, so it's important to be able to write tests to check an AsyncStream, AsyncSeq...
How to set a time limit for concurrent tests 如何为并发测试设置时间限制
Both Swift Testing and XCTest have simple mechanisms for controlling how long tests should be allowed to run before being considered a failure. This is critically important for con...
How to force concurrent tests to run on a specific actor 如何强制并发测试在特定actor上运行
Swift Testing and XCTest behave differently when it comes to running tests in parallel: unless you say otherwise, Swift Testing will run both synchronous and asynchronous tests on ...
How to serialize parameterized tests with Swift Testing 如何使用 Swift Testing 序列化参数化测试
Swift Testing's parameterized tests allow us to send multiple values into a single test, and they'll be run in parallel for maximum performance. If you don't want this – if you wa...
How to download JSON from the internet and decode it into any Codable type 如何从 Internet 下载 JSON 并将其解码为任何 Codable 类型
Fetching JSON from the network and using Codable to convert it into native Swift objects is probably the most common task for any Swift developer, usually followed by dis...
Release checklist 版本清单
Sure, all your tests pass, but how can you make sure your app functions properly? Most large projects have a solution called a release checklist, and here I want to share mine wit...
LiveScribe
We're going to build a macOS app that lets users write Markdown and see exactly how it looks as they type. More importantly, we're going to do so using test-driven development, so ...