Skip to content

Output console message for test case ended events in verbose mode, with status and issue counts #1125

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 2 commits into from
May 23, 2025

Conversation

stmontgomery
Copy link
Contributor

@stmontgomery stmontgomery commented May 23, 2025

This outputs a console message when each test case of a parameterized test function ends, including its pass/fail status and a count of the number of issues which were recorded, when running in verbose mode (swift test --verbose).

Here's an example:

◇ Test contrivedExample(x:) started.
◇ Test case passing 1 argument x → 1 (Swift.Int) to contrivedExample(x:) started.
◇ Test case passing 1 argument x → 2 (Swift.Int) to contrivedExample(x:) started.
✔ Test case passing 1 argument x → 1 (Swift.Int) to contrivedExample(x:) passed after 0.001 seconds.
✘ Test contrivedExample(x:) recorded an issue with 1 argument x → 2 at EventRecorderTests.swift:759:3: Expectation failed: (x → 2) == 1
↳ x: Swift.Int → 2
↳ 1: Swift.Int → 1
✘ Test case passing 1 argument x → 2 (Swift.Int) to contrivedExample(x:) failed after 0.001 seconds with 1 issue.
✘ Test contrivedExample(x:) with 2 test cases failed after 0.001 seconds with 1 issue.

Note: This leverages #1000 which added more robust identification of test cases.

Fixes #1021
Fixes rdar://146863942

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

…th status and issue counts

Fixes #1021
Fixes rdar://146863942
@stmontgomery stmontgomery added this to the Swift 6.x milestone May 23, 2025
@stmontgomery stmontgomery self-assigned this May 23, 2025
@stmontgomery stmontgomery added enhancement New feature or request issue-handling Related to Issue handling within the testing library command-line experience ⌨️ enhancements to the command line interface parameterized-testing Related to parameterized testing functionality labels May 23, 2025
@grynspan
Copy link
Contributor

"Passing [...] passed after [...]"

Might want to workshop the text here.

@stmontgomery
Copy link
Contributor Author

Might want to workshop the text here.

Thanks, I was planning to review the wording again before landing. I've now refined this to the following:

Test case passing [arguments] to [function] started.

Test case passing [arguments] to [function] (passed | failed) after [duration].

@stmontgomery
Copy link
Contributor Author

@swift-ci please test

@stmontgomery
Copy link
Contributor Author

@swift-ci please test Linux

@stmontgomery stmontgomery merged commit ae71313 into main May 23, 2025
3 checks passed
@stmontgomery stmontgomery deleted the verbose-testCaseEnded-logging branch May 23, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command-line experience ⌨️ enhancements to the command line interface enhancement New feature or request issue-handling Related to Issue handling within the testing library parameterized-testing Related to parameterized testing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log test case ended events, including issue counts, when running in verbose mode
3 participants