-
Notifications
You must be signed in to change notification settings - Fork 131
Add failure summary to ConsoleOutputRecorder #1420
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
base: main
Are you sure you want to change the base?
Conversation
…failure summary using expandedDebugDescription for detailed output, with support for custom display names and parameterized tests.
|
Would it make sense to factor the new code into a dedicated |
Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift
Outdated
Show resolved
Hide resolved
Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift
Outdated
Show resolved
Hide resolved
Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift
Outdated
Show resolved
Hide resolved
Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift
Outdated
Show resolved
Hide resolved
…logic into TestRunSummary type
d533995 to
29c448f
Compare
|
@grynspan thanks for the suggestion! I discussed that with Stuart and I've refactored the failure summary logic into a dedicated |
…y is shown, with the default behavior being enabled
… message so that it uses the 'test(s) which recorded N issue(s)" terminology
…tringConvertible conformance instead of fileID:line
stmontgomery
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We met about this offline, and I made a handful of commits of my own which I've just pushed to the PR branch after discussion. Beyond that, there is one problem in how the fully-qualified name is formed for parameterized test functions, and cases within them, in the failure summary section, and @tienquocbui it sounds like you will address that (thanks!)
| // Convert Context.TestData.IssueInfo to TestRunSummary.IssueInfo | ||
| let issues = testData.issues.map { issue in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context.TestData.IssueInfo appears to be identical to TestRunSummary.IssueInfo, can we get rid of the latter and use the former in both places? You could include a typealias if it's helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've removed the duplicate TestRunSummary.IssueInfo struct and now use Context.TestData.IssueInfo directly throughout TestRunSummary.
… with proper indentation hierarchy
|
@stmontgomery I've addressed the parameterized test display issue. Here's what changed: Before: After: |
Overview
This PR implements a failure summary section for
ConsoleOutputRecorderto help users quickly locate and review test failures in large test suites.Closes: #1355
Architectural Changes Implemented
HumanReadableOutputRecorderstate with singleLocked<Context>Graphtraversal logicConsoleOutputRecorder(stateless design preserved)TestData.IssueInfostruct with:sourceLocation,description,isKnown,severityTestData.issues(each issue has its own source location)displayName,testCaseArguments) stored once per test inTestDataissueCountdictionary preserved for efficient parallel trackingheader(),formatFailedTest(),fullyQualifiedName(),formatIssue()Graphand formats them independentlyfileprivateinitializer usesHumanReadableOutputRecorder.ContexttypesgenerateFailureSummary()returnsOptional<String>(nil when no failures)expandedDescription()for normal output,expandedDebugDescription()when verboseConsoleOutputRecordercalls this atrunEndedevent with blank line spacing"Custom Display Name")value → 7))Example Output
Regular Test Failure:
Parameterized Test Failure (shows which argument failed):
Test with Custom Display Name:
Complete Test Output
Click to expand full test run output