Swift Testing

up:: Swift ⚐

File New Target Unit Testing Bundle

import Testing
 
@Test("Continents mentioned in videos", arguments: [
    "A Beach",
    "By the Lake",
    "Camping in the Woods"
])
func mentionedContinents(videoName: String) async throws {
    let videoLibrary = try await VideoLibrary()
    let video = try #require(await videoLibrary.video(named: videoName))
    #expect(video.mentionedContinents.count <= 3)
}

Compared to Vitest:

  • describe @Test
  • expect #expect