Skip to content

Commit 050a19f

Browse files
authored
Update README for Swift Testing (#967)
* Update README for Swift Testing * Update README.md
1 parent 3f8d058 commit 050a19f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

README.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ Once [installed](#installation), _no additional configuration is required_. You
1414

1515
``` swift
1616
import SnapshotTesting
17-
import XCTest
17+
import Testing
1818

19-
class MyViewControllerTests: XCTestCase {
20-
func testMyViewController() {
19+
@MainActor
20+
struct MyViewControllerTests {
21+
@Test func myViewController() {
2122
let vc = MyViewController()
2223

2324
assertSnapshot(of: vc, as: .image)
@@ -52,10 +53,14 @@ withSnapshotTesting(record: .all) {
5253
assertSnapshot(of: vc3, as: .image)
5354
}
5455

55-
// Record all snapshots in an XCTestCase subclass:
56+
// Record all snapshot failures in a Swift Testing suite:
57+
@Suite(.snapshots(record: .failed))
58+
struct FeatureTests {}
59+
60+
// Record all snapshot failures in an 'XCTestCase' subclass:
5661
class FeatureTests: XCTestCase {
5762
override func invokeTest() {
58-
withSnapshotTesting(record: .all) {
63+
withSnapshotTesting(record: .failed) {
5964
super.invokeTest()
6065
}
6166
}

0 commit comments

Comments
 (0)