Skip to content

Test: Convert more tests to Swift Testing #8100

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

Conversation

bkhouri
Copy link
Contributor

@bkhouri bkhouri commented Nov 5, 2024

Convert additional suites from XCTest to Swift Testing

Motivation:

The XCTest run, by default, sequentially. Convert some suites from XCTest to Swift Testing to make use of parallel execution and, in some cases, test parameterization.

Not all Test Suite in the respective folders have been converted as some use helpers in swift-tools-core-support, which don't have a matching swift testing helper.

Modifications:

Convert XCTest to Swift Testing

Result:

Ran the equivalent of the following and ensured there were no test-related failures

for _ in $(seq 0 100);
do
    swift test --enable-swift-testing --disable-xctest
done

Blocked by #8137
Blocked by swiftlang/swift#78300
Blocked by swiftlang/swift#81217

@bkhouri bkhouri changed the title Test: Convert more tests to Swift Testing [DRAFT] Test: Convert more tests to Swift Testing Nov 5, 2024
@bkhouri bkhouri changed the title [DRAFT] Test: Convert more tests to Swift Testing Test: Convert more tests to Swift Testing Nov 7, 2024
@bkhouri bkhouri marked this pull request as ready for review November 7, 2024 13:12
@bkhouri
Copy link
Contributor Author

bkhouri commented Nov 7, 2024

Ready for review, though it may be blocked as not all pipeline builds run with Swift 6.0!

@bkhouri
Copy link
Contributor Author

bkhouri commented Nov 8, 2024

Ready for review, though it may be blocked as not all pipeline builds run with Swift 6.0!

Looks like the Selft-hosted macOS pipeline is now running the nightly build
https://ci.swift.org/job/swift-package-manager-with-xcode-self-hosted-PR-osx/4511/execution/node/49/log/

@@ -43,17 +45,19 @@ final class SigningIdentityTests: XCTestCase {
_ = SwiftSigningIdentity(certificate: certificate, privateKey: Certificate.PrivateKey(privateKey))

// Test public API
XCTAssertNoThrow(
#expect(throws: Never.self) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just throw.

@bkhouri bkhouri marked this pull request as draft November 14, 2024 17:54
@bkhouri bkhouri force-pushed the t/main/convert_more_suites_to_swift_testing branch 4 times, most recently from a3ff42c to ea6c8e8 Compare November 21, 2024 15:38
@bkhouri
Copy link
Contributor Author

bkhouri commented Nov 22, 2024

This PR is blocked by #8137

@bkhouri bkhouri force-pushed the t/main/convert_more_suites_to_swift_testing branch from ea6c8e8 to 930ee2e Compare December 3, 2024 18:04
@shahmishal
Copy link
Member

@swift-ci Please test nightly self hosted

@bkhouri bkhouri marked this pull request as ready for review December 19, 2024 01:25
@bkhouri bkhouri added the test suite improvements to SwiftPM test suite label Dec 20, 2024
@bkhouri bkhouri force-pushed the t/main/convert_more_suites_to_swift_testing branch from 930ee2e to 5a67108 Compare January 15, 2025 17:00
@bkhouri
Copy link
Contributor Author

bkhouri commented Jan 15, 2025

@swift-ci please test

bkhouri added a commit to bkhouri/swift-package-manager that referenced this pull request Jan 31, 2025
Add a canary swift testing tests to ensure we do not regress.

This test will be removed sometime after swiftlang#8092, swiftlang#8093 or swiftlang#8100 are
merged

(cherry picked from commit 257e671)
bkhouri added a commit to bkhouri/swift-package-manager that referenced this pull request Feb 6, 2025
Add a canary swift testing tests to ensure we do not regress.

This test will be removed sometime after swiftlang#8092, swiftlang#8093 or swiftlang#8100 are
merged

(cherry picked from commit 257e671)
bkhouri added a commit to bkhouri/swift-package-manager that referenced this pull request Feb 6, 2025
Add a canary swift testing tests to ensure we do not regress.

This test will be removed sometime after swiftlang#8092, swiftlang#8093 or swiftlang#8100 are
merged

(cherry picked from commit 257e671)
bkhouri added a commit that referenced this pull request Feb 10, 2025
Add a canary swift testing tests to ensure we do not regress.

This test will be removed sometime after #8092, #8093 or #8100 are
merged

(cherry picked from commit 257e671)

Re-adds #8222, after it was reverted in #8266 
Depends on swiftlang/swift#79074
bripeticca pushed a commit to bripeticca/swift-package-manager that referenced this pull request Feb 28, 2025
Add a canary swift testing tests to ensure we do not regress.

This test will be removed sometime after swiftlang#8092, swiftlang#8093 or swiftlang#8100 are
merged
bripeticca pushed a commit to bripeticca/swift-package-manager that referenced this pull request Feb 28, 2025
Add a canary swift testing tests to ensure we do not regress.

This test will be removed sometime after swiftlang#8092, swiftlang#8093 or swiftlang#8100 are
merged

(cherry picked from commit 257e671)

Re-adds swiftlang#8222, after it was reverted in swiftlang#8266 
Depends on swiftlang/swift#79074
@bkhouri bkhouri force-pushed the t/main/convert_more_suites_to_swift_testing branch from bc9ada0 to eab14bd Compare May 1, 2025 19:51
@bkhouri
Copy link
Contributor Author

bkhouri commented May 1, 2025

swiftlang/swift#81217

@swift-ci test

@bkhouri bkhouri marked this pull request as draft May 2, 2025 14:15
@bkhouri bkhouri marked this pull request as ready for review May 2, 2025 14:21
}

func testFromECKeyCertificate() throws {
@Test(
Copy link
Member

Choose a reason for hiding this comment

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

praise: I'm liking the parameterized test cases and how they make the matrix visible and explicit.

}
}

func testSwiftSigningIdentityWithRSAKey() throws {
@Test
func swiftSigningIdentityWithRSAKey() throws {
Copy link
Member

Choose a reason for hiding this comment

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

praise: This is a nice way to cut back on the test method name sizes.

bkhouri added 2 commits May 2, 2025 10:30
Convert additional test from XCTest to Swift Testing to make use of
parallel execution and, in some cases, test parameterization.
@bkhouri bkhouri force-pushed the t/main/convert_more_suites_to_swift_testing branch from eab14bd to f5fd53b Compare May 2, 2025 15:04
@bkhouri
Copy link
Contributor Author

bkhouri commented May 2, 2025

@swift-ci test

Copy link
Member

@cmcgee1024 cmcgee1024 left a comment

Choose a reason for hiding this comment

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

Overall, this looks good. I've posted a few questions, and thoughts.

@bkhouri
Copy link
Contributor Author

bkhouri commented May 2, 2025

@swift-ci test windows

@bkhouri bkhouri merged commit a9e09ef into swiftlang:main May 3, 2025
6 checks passed
@bkhouri bkhouri deleted the t/main/convert_more_suites_to_swift_testing branch May 3, 2025 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test suite improvements to SwiftPM test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants