Skip to content

Don't stomp on xUnit output from XCTest when running Swift Testing. #7796

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 3 commits into from
Jul 19, 2024

Conversation

grynspan
Copy link
Contributor

This PR forces Swift Testing to write its xUnit output to a different path from what the user specifies.

In the future, we should have the two testing libraries collate their XML output into a single file, but that requires the ability to parse and reformat XML output and that's a little beyond the capabilities of this feature right now. Since we expect most uses of xUnit output right now are existing ones with existing XCTest-based tests, moving Swift Testing aside seems like the right call.

(If XCTest is explicitly disabled, the exact specified path is used.)

This PR forces Swift Testing to write its xUnit output to a different path from
what the user specifies.

In the future, we should have the two testing libraries collate their XML output
into a single file, but that requires the ability to parse and reformat XML
output and that's a little beyond the capabilities of this feature right now.
Since we expect most uses of xUnit output right now are existing ones with
existing XCTest-based tests, moving Swift Testing aside seems like the right
call.

(If XCTest is explicitly disabled, the exact specified path is used.)
@grynspan grynspan added bug swift test Changes impacting `swift test` tool labels Jul 18, 2024
@grynspan grynspan self-assigned this Jul 18, 2024
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test Windows

@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test Windows

@grynspan grynspan enabled auto-merge (squash) July 18, 2024 20:35
@grynspan
Copy link
Contributor Author

@swift-ci please test Windows

@grynspan grynspan merged commit 10d2098 into main Jul 19, 2024
5 checks passed
@grynspan grynspan deleted the jgrynspan/no-stomping-xml-output branch July 19, 2024 01:30
grynspan added a commit that referenced this pull request Jul 19, 2024
…7796)

This PR forces Swift Testing to write its xUnit output to a different
path from what the user specifies.

In the future, we should have the two testing libraries collate their
XML output into a single file, but that requires the ability to parse
and reformat XML output and that's a little beyond the capabilities of
this feature right now. Since we expect most uses of xUnit output right
now are existing ones with existing XCTest-based tests, moving Swift
Testing aside seems like the right call.

(If XCTest is explicitly disabled, the exact specified path is used.)
grynspan added a commit that referenced this pull request Jul 19, 2024
…Swift Testing enabled by default.) (#7794)

**Explanation:** Refactors the previously-experimental Swift Testing
support logic so that only a single build product is produced when using
both XCTest and Swift Testing, and detection of Swift Testing usage is
no longer needed at compile time.
**Scope:** Implementation of Swift Testing/SwiftPM integration; touches
mostly `swift test` but affects `swift build` and `swift package init`
as well.
**Issue:** rdar://120864035
**Original PR:**
#7777,
#7789,
#7796
**Risk:** Moderate—refactors how we build and run tests.
**Testing:** Existing test coverage in the package as well as test
coverage in the Swift Testing package; additional integration testing
will be added once Swift Testing is in the toolchain.
**Reviewer:** @bnbarham @xedin @briancroom @dennisweissmann

---------

Co-authored-by: Pavel Yaskevich <[email protected]>
grynspan added a commit that referenced this pull request Aug 1, 2024
A previous PR, #7796, avoided Swift Testing stomping on XML output from XCTest
when both libraries were running tests. However, there's a bug in the
implementation where if you pass `--disable-xctest`, we don't end up telling
Swift Testing to write any XML at all. This PR fixes that.
grynspan added a commit that referenced this pull request Aug 1, 2024
…d. (#7849)

A previous PR, #7796, avoided Swift Testing stomping on XML output from
XCTest when both libraries were running tests. However, there's a bug in
the implementation where if you pass `--disable-xctest`, we don't end up
telling Swift Testing to write any XML at all. This PR fixes that.

Tested with:

```sh
swift build
$(pwd)/.build/debug/swift-test --package-path /Volumes/Dev/Source/swift-testing --disable-xctest --xunit-output /dev/stdout
```

To confirm that XML output was produced for Swift Testing's test target
(as an exemplar package that uses Swift Testing.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug swift test Changes impacting `swift test` tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants