Customize tests with Traits
mainTraits allow you to describe runtime conditions or execution constraints for tests or test suites. You can use traits to:
- Enable or disable tests based on conditions (e.g.,
.enabled(if: ...)). - Specify execution time limits.
- Define requirements for specific operating systems or devices.
@Test(.enabled(if: AppFeatures.isCommentingEnabled))
func videoCommenting() async throws {
let video = try #require(await videoLibrary.video(named: "A Beach"))
#expect(video.comments.contains("So picturesque!"))
}