Skip to content

Conversation

@grynspan
Copy link
Contributor

@grynspan grynspan commented Nov 26, 2025

This PR adds command-line experimental support for custom test libraries that don't sit on top of XCTest or Swift Testing (irony inbound). Developers can specify additional libraries to invoke using the --experimental-testing-library argument.

In a separate PR, I will teach Swift Testing how to read the --experimental-testing-library argument (forwarded as --testing-library once per, er, library.) A developer can write a small shim function that gets added to the __swift5_tests section as a special test content record and which, when called, invokes its corresponding testing library and translates output to the "language" Swift Testing speaks.

The above description is light on details because we haven't designed out the mechanisms in question. In particular, we don't have a stable configuration/input mechanism, so for the moment I'm just forwarding command-line arguments. We also need to teach some part of the stack how to collate results from multiple libraries to produce a single unified test report in various formats. This PR is just one step.

You can use the new argument like so:

swift test --experimental-testing-library xctest --experimental-testing-library pytest --experimental-testing-library junit [...]

The above command would try to run XCTest, pytest, and JUnit tests hosted in the current Swift package. As of right now, it will run XCTest and then fatalError() on pytest and JUnit (until I can plumb things through Swift Testing.)

This PR adds command-line experimental support for custom test libraries that don't sit on top of XCTest or Swift Testing (irony inbound). Developers can specify additional libraries to invoke using the `--experimental-testing-library` argument.

In a separate PR, I will teach Swift Testing how to read the `--experimental-testing-library` argument (forwarded as `--testing-library` once per, er, library.) A developer can write a small shim function that gets added to the `__swift5_tests` section as a special test content record and which, when called, invokes its corresponding testing library and translates output to the "language" Swift Testing speaks.

The above description is light on details because we haven't designed out the mechanisms in question. In particular, we don't have a stable configuration/input mechanism, so for the moment I'm just forwarding command-line arguments. We also need to teach some part of the stack how to collate results from multiple libraries to produce a single unified test report in various formats. This PR is just one step.
@grynspan grynspan self-assigned this Nov 26, 2025
@grynspan grynspan added the swift test Changes impacting `swift test` tool label Nov 26, 2025
@grynspan
Copy link
Contributor Author

@swift-ci test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

swift test Changes impacting `swift test` tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants