Skip to content
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

[New Output] Swift Testing Results #313

Closed
tonyarnold opened this issue Aug 28, 2024 · 8 comments
Closed

[New Output] Swift Testing Results #313

tonyarnold opened this issue Aug 28, 2024 · 8 comments

Comments

@tonyarnold
Copy link

tonyarnold commented Aug 28, 2024

What's the uncaptured output?

✔ Test run with 16 tests passed after 0.004 seconds.
◇ Test run started.
↳ Testing Library Version: 94 (arm64-apple-ios13.0-simulator)
◇ Suite UUIDRFC4122Tests started.
◇ Test "Test that a directly initialized UUID outputs in lowercase" started.
◇ Test "Test that a UUID initialized with an uppercase UUID string outputs in lowercase" started.
✔ Test "Test that a directly initialized UUID outputs in lowercase" passed after 0.008 seconds.
✔ Test "Test that a UUID initialized with an uppercase UUID string outputs in lowercase" passed after 0.008 seconds.
✔ Suite UUIDRFC4122Tests passed after 0.011 seconds.
✔ Test run with 30 tests passed after 0.012 seconds.

Suggested Regex

No response

Suggested Output

No response

Additional Context

I haven't captured the test failure, timeout and other states here in this output.

@piercifani
Copy link

We've had to remove XCBeautify from our CI pipeline after migrating to Swift Testing because of this, interested in giving a hand if needed

@clausjoergensen
Copy link

I can confirm we're seeing the same:

without xcbeautify:

Testing started
Test Suite 'Selected tests' started at 2024-09-23 11:26:17.705.
Test Suite 'MyUnitTests.xctest' started at 2024-09-23 11:26:17.706.
Test Suite 'MyUnitTests.xctest' passed at 2024-09-23 11:26:17.706.
	 Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'Selected tests' passed at 2024-09-23 11:26:17.706.
	 Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
◇ Test run started.
↳ Testing Library Version: 94 (arm64-apple-ios13.0-simulator)
◇ Iteration 1 started.
◇ Suite MyViewModelTests started.
✔ Suite MyViewModelTests passed after 0.001 seconds.
◇ Iteration 1 ended after 0.001 seconds.
✔ Test run with 0 tests passed after 0.001 seconds.

vs. with xcbeautify

Selected tests
MyUnitTests.xctest
Test Succeeded

@dagostini
Copy link

@cpisciotta I can take this one on, since we need it fixed for our own CI/CD, but I can't commit more than 6h per week to it.

@cpisciotta
Copy link
Owner

Hi everyone! Thank you for your patience, and sorry for the delay! @ajkolean recently opened a PR to address this issue, and I will work with him to get this merged ASAP.

@tonyarnold
Copy link
Author

No need to apologise, @cpisciotta! This is a great tool, and I'm more than happy to wait when I don't have time to directly contribute. Thank you!

cpisciotta pushed a commit that referenced this issue Oct 15, 2024
### Description:

This PR addresses issue 
[#313](#313) by adding
support for parsing and formatting Swift testing output in `xcbeautify`.
It introduces new capture groups and associated formatting functions for
various Swift testing events, such as test runs, test suites, individual
tests, and test issues. The changes enhance the parsing capabilities,
enabling better output formatting for Swift-based test results.

### Key Changes:
1. **New Capture Groups for Swift Testing:**
- Added capture groups for various Swift testing events, including:
- `SwiftTestingRunStartedCaptureGroup`
- `SwiftTestingRunCompletionCaptureGroup`
- `SwiftTestingRunFailedCaptureGroup`
- `SwiftTestingSuiteStartedCaptureGroup`
- `SwiftTestingSuitePassedCaptureGroup`
- `SwiftTestingSuiteFailedCaptureGroup`
- `SwiftTestingTestStartedCaptureGroup`
- `SwiftTestingTestPassedCaptureGroup`
- `SwiftTestingTestFailedCaptureGroup`
- `SwiftTestingTestSkippedCaptureGroup`
- `SwiftTestingTestSkippedReasonCaptureGroup`
- `SwiftTestingIssueCaptureGroup`
- `SwiftTestingIssueArgumentCaptureGroup`
- `SwiftTestingPassingArgumentCaptureGroup`
- `SwiftTestingPassingArgumentMultipleCaptureGroup`
- `SwiftTestingAttributeCaptureGroup`

2. **Updated Output Handling:**
- Added support for the newly introduced capture groups in
`Parser.swift` and `Formatter.swift`.
- Extended `OutputRendering` to handle formatting for each new capture
group.
- Adjusted the handling of output types to include `OutputType.issue`
for better categorization of issues.

3. **Terminal Renderer Improvements:**
- Added functions in `TerminalRendererTests.swift` to validate the
formatted output for the newly introduced capture groups.
- Ensured colorized and non-colorized outputs are correctly formatted,
with proper handling of time and issue details.

4. **Test Suite Enhancements:**
- Added new unit tests in `ParserTests.swift` to verify the parsing of
different Swift testing outputs.
- Updated `ParsingTests.swift` to include a new test log file
(`swift_test_log.txt`) for comprehensive testing of Swift testing
events.

5. **Constants Update:**
- Added a new `OutputType.issue` to classify test-related issues.
@pepicrft
Copy link
Collaborator

Thank you folks for addressing this one 🙏🏼

@cpisciotta
Copy link
Owner

Hey everyone! Thank you again to @ajkolean for his contribution! This should be available starting in 2.12.0, but that is now several versions back from the latest. I will close this issue, but please re-open this or a new issue if you continue to see areas of improvement.

@tonyarnold
Copy link
Author

Thanks @ajkolean and @cpisciotta 🫶

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

No branches or pull requests

6 participants