Skip to content

Introduce XCTSkip and related APIs for skipping tests #297

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
Feb 14, 2020

Conversation

stmontgomery
Copy link
Contributor

@stmontgomery stmontgomery commented Feb 5, 2020

  • Add the following APIs which facilitate dynamically skipping tests based on runtime conditions, with signatures matching new APIs introduced in Xcode 11.4:
    • XCTSkip struct, conforming to Error protocol.
    • XCTSkipIf and XCTSkipUnless functions.
    • skipCount and hasBeenSkipped properties on XCTestRun class.
  • Add throwing instance methods setUpWithError() and tearDownWithError(). These methods complement the existing setUp() and tearDown() APIs but allow throwing errors. Their names include 'WithError' suffixes to preserve source compatibility, since adding throws to the existing methods would be a source-breaking API change.
  • Modify internal test case execution logic to handle skipping and new setUp/tearDown error handling.
  • Add new unit tests.

Fixes rdar://problem/56671272

- Add the following APIs which facilitate dynamically skipping tests based on runtime conditions,
  with signatures matching new APIs introduced in Xcode 11.4:
  - XCTSkip struct, conforming to Error protocol.
  - `XCTSkipIf` and `XCTSkipUnless` functions.
  - `skipCount` and `hasBeenSkipped` properties on XCTestRun class.
- Add throwing instance methods `setUpWithError()` and `tearDownWithError()`. These methods
  complement the existing `setUp()` and `tearDown()` APIs but allow throwing errors. Their names
  include 'WithError' suffixes to preserve source compatibility, since adding `throws` to the
  existing methods would be a source-breaking API change.
- Modify internal test case execution logic to handle skipping and new setUp/tearDown error handling.
- Add new unit tests.

Fixes rdar://problem/56671272
@stmontgomery stmontgomery self-assigned this Feb 5, 2020
@stmontgomery
Copy link
Contributor Author

@swift-ci Please test

@stmontgomery
Copy link
Contributor Author

@swift-ci Please test

Copy link
Contributor

@briancroom briancroom left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks for the clean implementation and thorough tests.

@stmontgomery stmontgomery merged commit 5720199 into swiftlang:master Feb 14, 2020
stmontgomery added a commit to stmontgomery/swift-corelibs-xctest that referenced this pull request Feb 20, 2020
Introduce XCTSkip and related APIs for skipping tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants