Skip to content

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

Merged
stmontgomery merged 2 commits into
mainfrom
verbose-testCaseEnded-logging
May 23, 2025
Merged

Output console message for test case ended events in verbose mode, with status and issue counts#1125
stmontgomery merged 2 commits into
mainfrom
verbose-testCaseEnded-logging

Conversation

@stmontgomery

@stmontgomery stmontgomery commented May 23, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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

Might want to workshop the text here.

@stmontgomery

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

@swift-ci please test

@stmontgomery

Copy link
Copy Markdown
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
@stmontgomery stmontgomery modified the milestones: Swift 6.x, Swift 6.2 May 24, 2025
stmontgomery added a commit that referenced this pull request Jun 26, 2025
…s in verbose mode (#1180)

This is a small fix for an oversight I made in #1125: the word `started`
is printed twice at the end of the console message for
`.testCaseStarted` events in verbose mode.

### Checklist:

- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
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

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