Repository navigation
Annotate failing tests and write a short job summary on GitHub Actions - #4826
Merged
Merged
Conversation
… summary The `GitHubActionsReport` extension adds an annotation on the failing test's line and writes a job summary only when a test fails. The test step passes its flags on GitHub Actions and always turns off TUnit's own summary, which would repeat the same results for every project. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4826/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A failing unit or integration test now gets an annotation on its line and a short job summary, and a green run writes no summary at all.
Affects: Automation
Prompt summary: Investigate which MTP and TUnit reporters give useful GitHub annotations and summaries for the test run, then land the best setup with the environment variable set in the build target.
Why
The test step prints TUnit's console output and TUnit's own step summary: one section per test project, 18 of them, each with a tip line, and no annotations. A failure shows only in the log, and the passing projects bury it.
What
Report extension
Microsoft.Testing.Extensions.GitHubActionsReport2.5.2, the same version asMicrosoft.Testing.Platform, is a package reference intests/andtests-integration/. On GitHub Actions it writes a::erroror::warningannotation with the file and line, and one collapsible log group per test assembly.Test step flags
When
GITHUB_ACTIONSis set, theunit-test,integrateandtesttargets pass--report-gh --report-gh-step-summary on-failure --report-gh-step-summary-sections test-results. Only a failing project writes a summary section, with the exception, thefile:lineand a trimmed stack, and the slowest-tests lists are left out. WithoutGITHUB_ACTIONSthe extension does nothing, so local runs are unchanged.TUnit's reporter off
The target always sets
TUNIT_DISABLE_GITHUB_REPORTER=truefordotnet test, so TUnit's own summary does not repeat the results.Out of scope: two tests that are skipped today (
Elastic.Documentation.Build.TestsApiSitemapParityTestsandElastic.ApiExplorer.TestsOpenApiDocumentExporterTests) now produce a::warningannotation on every run. The extension turns failed and skipped annotations on or off together.Risk: the annotation and summary rendering on a real runner is unchecked. Locally I simulated
GITHUB_ACTIONSandGITHUB_STEP_SUMMARY. Whether the annotation lands on the PR's Files changed tab, and the Windows and macOS paths, are untested until CI runs.Verify
With a test that fails, the same command exits 1 and prints one
::error file=…,line=…line, and the summary holds one section for the failing project.