Deprecate XCTest test helpers in favor of Swift Testing - #957
Open
bkhouri wants to merge 1 commit into
Conversation
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 25, 2026 03:26
4258f6c to
ccd4ed6
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 25, 2026 03:34
ccd4ed6 to
01c0ad9
Compare
bkhouri
marked this pull request as ready for review
August 25, 2026 03:36
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 25, 2026 03:54
01c0ad9 to
2051f32
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 25, 2026 03:56
2051f32 to
d2d1b57
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 25, 2026 04:01
d2d1b57 to
c50e19e
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 25, 2026 12:29
c50e19e to
c5d9fe0
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
6 times, most recently
from
August 25, 2026 16:30
0f43db0 to
cf1b364
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 26, 2026 06:37
cf1b364 to
4045cf1
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 26, 2026 06:41
4045cf1 to
7cd528e
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
2 times, most recently
from
August 26, 2026 07:54
288ff03 to
b5e2ee4
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 26, 2026 18:18
b5e2ee4 to
f8dcf2f
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 26, 2026 19:55
f8dcf2f to
934af15
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 26, 2026 23:18
934af15 to
607fdd3
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 27, 2026 02:47
607fdd3 to
2d4464c
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 27, 2026 15:43
2d4464c to
4b93d04
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 27, 2026 15:52
4b93d04 to
c4f48ef
Compare
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
2 times, most recently
from
August 27, 2026 17:45
3768ca1 to
be95c26
Compare
Now that all test suites in the repository have been migrated from XCTest to Swift Testing, mark every XCTest-flavored public helper in `ArgumentParserTestHelpers` as `@available(*, deprecated, message: ...)` so downstream users see a compile-time nudge toward the Swift-Testing-native replacement. Deprecated helpers and their replacements: - `TestableParsableArguments` → `TestableSwiftTestingParsableArguments` - `TestableParsableCommand` → `TestableSwiftTestingParsableCommand` - `XCTestExpectation.init(singleExpectation:)` → `TestExpectation` - `AssertResultFailure` → `expectResultFailure` - `AssertErrorMessage` → `expectErrorMessage` - `AssertFullErrorMessage` → `expectFullErrorMessage` - `AssertParse` → `expectParse` - `AssertParseCommand` → `expectParseCommand` - `AssertParseCommandErrorMessage` → (no direct replacement; inline with `#expect` / `Issue.record`) - `AssertEqualStrings` → `expectEqualStrings` - `AssertExecuteCommand` → `requireExecuteCommand` - `AssertJSONEqualFromString` → `expectJSONEqualFromString` - `assertSnapshot` → `expectSnapshot` - `assertGenerateManual` → `expectGenerateManual` - `assertGeneratedReference` → `expectGeneratedReference` - `assertDumpHelp(type:)` / `assertDumpHelp(command:)` → `expectDumpHelp(type:)` / `expectDumpHelp(command:)` - `XCTest.debugURL` — no public replacement; the Swift Testing helpers derive it internally via a `Bundle`-marker class. To keep the deprecated helpers callable in-file without emitting cascading deprecation warnings, extract their shared implementation into non-deprecated `fileprivate` helpers (`_AssertExecuteCommand`, `_assertEqualStrings`, `_assertSnapshot`, `_debugBundleURL`). The public deprecated overloads forward to these. The six `expect*` helpers in `TestHelpers+SwiftTesting.swift` no longer delegate to their `Assert*` counterparts — inlining their Swift-Testing branches lets us deprecate the `Assert*` variants without warning at those call sites. `requireHelp` moves from `TestHelpers.swift` to `TestHelpers+SwiftTesting.swift` (it was already Swift-Testing-native) and now calls `expectEqualStrings` instead of `AssertEqualStrings`. Relates to #710
bkhouri
force-pushed
the
bkhouri/t/main/migrate_tests_to_swift_testing_deprecate_xct_helpers
branch
from
August 27, 2026 17:54
be95c26 to
8c2027c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that all test suites in the repository have been migrated from
XCTest to Swift Testing, mark every XCTest-flavored public helper in
ArgumentParserTestHelpersas@available(*, deprecated, message: ...)so downstream users see a compile-time nudge toward the
Swift-Testing-native replacement.
Deprecated helpers and their replacements:
TestableParsableArguments→TestableSwiftTestingParsableArgumentsTestableParsableCommand→TestableSwiftTestingParsableCommandXCTestExpectation.init(singleExpectation:)→TestExpectationAssertResultFailure→expectResultFailureAssertErrorMessage→expectErrorMessageAssertFullErrorMessage→expectFullErrorMessageAssertParse→expectParseAssertParseCommand→expectParseCommandAssertParseCommandErrorMessage→ (no direct replacement; inlinewith
#expect/Issue.record)AssertEqualStrings→expectEqualStringsAssertExecuteCommand→requireExecuteCommandAssertJSONEqualFromString→expectJSONEqualFromStringassertSnapshot→expectSnapshotassertGenerateManual→expectGenerateManualassertGeneratedReference→expectGeneratedReferenceassertDumpHelp(type:)/assertDumpHelp(command:)→expectDumpHelp(type:)/expectDumpHelp(command:)XCTest.debugURL— no public replacement; the Swift Testing helpersderive it internally via a
Bundle-marker class.To keep the deprecated helpers callable in-file without emitting
cascading deprecation warnings, extract their shared implementation
into non-deprecated
fileprivatehelpers (_AssertExecuteCommand,_assertEqualStrings,_assertSnapshot,_debugBundleURL). Thepublic deprecated overloads forward to these.
The six
expect*helpers inTestHelpers+SwiftTesting.swiftnolonger delegate to their
Assert*counterparts — inlining theirSwift-Testing branches lets us deprecate the
Assert*variantswithout warning at those call sites.
requireHelpmoves fromTestHelpers.swifttoTestHelpers+SwiftTesting.swift(it was already Swift-Testing-native)and now calls
expectEqualStringsinstead ofAssertEqualStrings.Relates to #710
Checklist
Stack created with GitHub Stacks CLI • Give Feedback 💬