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).