Skip to content

[Microsoft.Testing.Extensions.GitHubActionsReport] Show failure details in collapsible step-summary sections #10591

Description

Summary

Enhance Microsoft.Testing.Extensions.GitHubActionsReport so the GitHub Actions step summary includes actionable details for each failed test inside collapsible <details> / <summary> sections.

The existing totals and failure list should remain compact and scannable. Each collapsible summary would display the failed test name and duration, while the expanded section would contain its failure message, exception type, stack trace, and source location when available.

Background and Motivation

The GitHub Actions reporter significantly improves the experience of investigating test runs by putting failures, skipped tests, annotations, and a clear summary directly in the workflow UI.

However, the step summary currently lists only the fully qualified name of each failed test. The annotations emitted by GitHubActionsAnnotationReporter show the failure explanation and resolved source location, but they do not include the stack trace. These annotations are also easy to miss because the step summary naturally receives most of the attention.

Additionally, the step summary already displays test durations in the “Slowest tests” section using the test name — duration format. Using the same presentation for failed tests would provide useful diagnostic context and make the summary visually consistent.

I encountered this while using xUnit v3 with Microsoft.Testing.Platform through DRN.Framework.Testing:

run: dotnet run --project DRN.Test.Unit/DRN.Test.Unit.csproj --no-build --verbosity minimal --configuration Release -- --report-gh

A compact summary is useful, but expandable failure details would make the summary sufficient for many common failures without overwhelming the page.

Real-world example and additional context from my LinkedIn post

Proposed Feature

For every failed test displayed under the Failures section, render a collapsible block similar to:

Namespace.TestClass.TestMethod — 2.40s

Exception: Xunit.Sdk.EqualException
Location: Tests/TestClass.cs:42

Expected: 42
Actual:   41

at Namespace.TestClass.TestMethod() in Tests/TestClass.cs:line 42

Suggested behavior:

  • Display the fully qualified test name and duration in <summary>.
  • Use the same test name — duration presentation and duration formatting as the existing “Slowest tests” section.
  • Include the complete failure explanation or exception message in the expanded body.
  • Include the exception type and stack trace when available.
  • Include the resolved source file and line, preferably as a repository link when it can be generated reliably.
  • HTML-encode test-provided values before placing them in <summary> or other HTML elements.
  • Preserve the existing maximum-failure and summary-size limits.
  • Clearly indicate when failures or individual failure details are truncated.
  • Keep the existing GitHub error annotations unchanged.

If control over disclosure or summary size is desirable, an option such as the following could be added:

--report-gh-failure-details on|off

It could default to on when both --report-gh and the step summary are enabled, while allowing users to retain the current compact behavior.

GitHub supports this presentation through expandable sections.

Alternative Designs

Keep details only in annotations and workflow logs

The annotations already show the failure explanation and resolved source location. However, they do not include the complete stack trace and are presented separately from the step summary, making them easy to overlook.

Display all failure details without collapsible sections

This provides the required information but makes summaries difficult to scan, particularly when several tests fail or stack traces are long.

Display only the failure name and duration

Adding duration to the existing failure list would be useful, but it would not address the primary need for the failure message, exception information, and stack trace.

Publish a TRX or HTML report

A separate report can contain richer information, but it requires another artifact or reporting step and does not provide the same immediate GitHub Actions summary experience.

Metadata

Metadata

Labels

needs/triageNeeds triage by a maintainer.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions