Skip to content

Commit ddcb574

Browse files
authored
Update MigratingFromXCTest making it clear you must import Testing. (#158)
Update MigratingFromXCTest to make it clear one must `import Testing` ### Motivation: Other guides mention that one has to `import Testing`, e.g. `DefiningTests`, but readers will see `MigratingFromXCTest` before they see `DefiningTests`, and "following along" while reading makes code not compile (since **must** import Testing). ### Modifications: Made it clear that with XCTest one needs `import XCTest` and now with swift-testing one needs to `import Testing`. ### Result: A more clear guide, that is easier to follow along. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent 9703a55 commit ddcb574

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Sources/Testing/Testing.docc/MigratingFromXCTest.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,30 @@ Before the testing library can be used, it must be added as a dependency of your
2727
Swift package or Xcode project. For more information on how to add it, see the
2828
[Getting Started](doc:TemporaryGettingStarted) guide.
2929

30+
### Importing the testing library
31+
32+
XCTest and the testing library are available from different modules. Instead of
33+
importing the XCTest module, import the Testing module:
34+
35+
@Row {
36+
@Column {
37+
```swift
38+
// Before
39+
import XCTest
40+
```
41+
}
42+
@Column {
43+
```swift
44+
// After
45+
import Testing
46+
```
47+
}
48+
}
49+
50+
A single source file can contain tests written with XCTest as well as other
51+
tests written with the testing library. Import both XCTest and Testing if a
52+
source file contains mixed test content.
53+
3054
### Converting test classes
3155

3256
XCTest groups related sets of test methods in test classes: classes that inherit

0 commit comments

Comments
 (0)