Testing共8篇
How to write basic async tests 如何编写基本的异步测试-Stewed Noodles 资源

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...
jiulinxiri的头像-Stewed Noodles 资源烩之面大会员jiulinxiri5个月前
80
How to serialize parameterized tests with Swift Testing 如何使用 Swift Testing 序列化参数化测试-Stewed Noodles 资源

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...
jiulinxiri的头像-Stewed Noodles 资源烩之面大会员jiulinxiri5个月前
80
How to handle concurrency errors in unit tests 如何处理单元测试中的并发错误-Stewed Noodles 资源

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...
jiulinxiri的头像-Stewed Noodles 资源烩之面大会员jiulinxiri5个月前
70
How to force concurrent tests to run on a specific actor 如何强制并发测试在特定actor上运行-Stewed Noodles 资源

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 ...
jiulinxiri的头像-Stewed Noodles 资源烩之面大会员jiulinxiri5个月前
70
How to set a time limit for concurrent tests 如何为并发测试设置时间限制-Stewed Noodles 资源

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...
jiulinxiri的头像-Stewed Noodles 资源烩之面大会员jiulinxiri5个月前
60
Introduction to testing Swift concurrency Swift 并发测试简介-Stewed Noodles 资源

Introduction to testing Swift concurrency Swift 并发测试简介

Swift's full range of concurrency features work great with unit tests using both the legacy XCTest framework and the new Swift Testing framework.Swift 的全套并发功能非常适合使用旧...
jiulinxiri的头像-Stewed Noodles 资源烩之面大会员jiulinxiri5个月前
50
How to test AsyncSequence and AsyncStream 如何测试 AsyncSequence 和 AsyncStream-Stewed Noodles 资源

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...
jiulinxiri的头像-Stewed Noodles 资源烩之面大会员jiulinxiri5个月前
50
How to test completion handlers with Swift Testing and XCTest 如何使用 Swift Testing 和 XCTest 测试补全处理程序-Stewed Noodles 资源

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 ...
jiulinxiri的头像-Stewed Noodles 资源烩之面大会员jiulinxiri5个月前
10