Skip to content

Update MigratingFromXCTest making it clear you must import Testing. #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Sources/Testing/Testing.docc/MigratingFromXCTest.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@ Before the testing library can be used, it must be added as a dependency of your
Swift package or Xcode project. For more information on how to add it, see the
[Getting Started](doc:TemporaryGettingStarted) guide.

### Importing the testing library

XCTest and the testing library are available from different modules. Instead of
importing the XCTest module, import the Testing module:

@Row {
@Column {
```swift
// Before
import XCTest
```
}
@Column {
```swift
// After
import Testing
```
}
}

A single source file can contain tests written with XCTest as well as other

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be re-phrased so it's more concise:

Using the two frameworks in a single file is supported. To do so, import both XCTest and Testing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swift-testing is a package though, not a framework. So that may be confusing.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace framework with library. Since there are a lot of situations where those terms are used interchangeably in day-to-day work, that casualness slipped into my suggestion. Aside from that one word, I think that sentence is a better explanation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I change to:

Using the two libraries in a single file is supported. To do so, import both XCTest and Testing.

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what we've got here is fine as-is. @SeanROlszewski how strongly do you feel about it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! @Sajjon If you're ready to merge, let me know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grynspan good to merge IMO.

What do I need to do? Update source branch with head? Rebase or merge main into source?

Looks like there are no conflicts so GitHub ought to be able to merge it as is (I m on GitHub iOS app currently so not as "glanceable")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge for you since you can't click the big green button yourself. :)

tests written with the testing library. Import both XCTest and Testing if a
source file contains mixed test content.

### Converting test classes

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