-
Notifications
You must be signed in to change notification settings - Fork 114
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
Update MigratingFromXCTest making it clear you must import Testing. #158
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look at this! We should strive to avoid redundant content in the code snippets that may make it harder to see the difference between the two libraries. The code snippets aren't meant to represent complete Swift files, but simply examples of how various features are used.
Rather than including the import
statements in each snippet, how about adding a short section after "Adding the testing library as a dependency" but before "Converting test classes" that explains the change in imported libraries?
I would also take the time to mention in that section that a single test file can contain tests written with either library (i.e. it is okay to continue importing XCTest if not all tests in a file are ready to be converted to swift-testing.) If you can think of other relevant information, feel free to add it too.
@grynspan Perhaps like this? |
@swift-ci please test |
} | ||
} | ||
|
||
A single source file can contain tests written with XCTest as well as other |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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")
There was a problem hiding this comment.
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. :)
Thanks for the contribution, @Sajjon! I like this. |
I am on vacation through the end of the year, so the rest of the team can assist you with landing this PR. Thanks again! |
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 seeMigratingFromXCTest
before they seeDefiningTests
, 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 toimport Testing
.Result:
A more clear guide, that is easier to follow along.
Checklist: