what is the equivalent of the setup method in Swift Testing?
Generated on 8/2/2024
1 search
In Swift Testing, the equivalent of the setup
method in XCTest is the type's initializer. This initializer can be async
or throw
. If you need to perform logic after each test, you can include a deinitializer (deinit
). Deinitializers can only be used when the suite type is an actor or class, which is a common reason to use a reference type instead of a struct for a suite.
For more details, you can refer to the session Meet Swift Testing (20:00).
Platforms State of the Union
Discover the newest advancements on Apple platforms.
What’s new in Swift
Join us for an update on Swift. We’ll briefly go through a history of Swift over the past decade, and show you how the community has grown through workgroups, expanded the package ecosystem, and increased platform support. We’ll introduce you to a new language mode that achieves data-race safety by default, and a language subset that lets you run Swift on highly constrained systems. We’ll also explore some language updates including noncopyable types, typed throws, and improved C++ interoperability.
Meet Swift Testing
Introducing Swift Testing: a new package for testing your code using Swift. Explore the building blocks of its powerful new API, discover how it can be applied in common testing workflows, and learn how it relates to XCTest and open source Swift.