-
Notifications
You must be signed in to change notification settings - Fork 134
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
|
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
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 |
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!)
Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift
Outdated
Show resolved
Hide resolved
|
@stmontgomery I've addressed the parameterized test display issue. Here's what changed: Before: After: |
…failure summary using expandedDebugDescription for detailed output, with support for custom display names and parameterized tests.
…logic into TestRunSummary type
…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
… with proper indentation hierarchy
44e71d4 to
dd6105b
Compare
Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift
Outdated
Show resolved
Hide resolved
Sources/Testing/Events/Recorder/Event.ConsoleOutputRecorder.swift
Outdated
Show resolved
Hide resolved
a3ddbc0 to
a371a1e
Compare
| // Build fully qualified name | ||
| let fullyQualifiedName = fullyQualifiedName(for: failedTest) | ||
|
|
||
| result += "\(symbol) Test \(fullyQualifiedName)\n" |
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.
This could potentially be a suite, for example if the issue was recorded by a TestScoping trait applied to a suite, so ideally we would conditionalize the word "Test" to use "Suite" instead in that scenario
Overview
This PR implements a failure summary section for
ConsoleOutputRecorderto help users quickly locate and review test failures in large test suites.Fixes #1355
Fixes rdar://168698184
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