[CI] Generate simple test summary#9223
Conversation
|
@radical can you translate this to a C# project under a tools folder? We don't need this to be in powershell 😄 (and it'll let us all vibe code a bit better on it) |
This is essentially a stopgap till @RussKie and @joperezr have the other test reporter back again. But we could do this as our own thing in C# too. Copilot seems to be good with powershell too btw. That's what I am using right now lol. |
pick your AI, you'll find one that can easily translate that to C# |
|
You can stop gap in c# |
|
Actually thinking about it -- if psh is on all the test machines, isn't it the best tool for the job? No compilation and easy to read/modify (even debug).. but idc |
|
|
|
Can you inline the logs for the failed test under a nested collapsible section? Like Detailsin markdown |
|
Have you explored the MTP extensibility model or chatted with the Test team? The MTP supports custom plugins that can be invoked at specific points in the test execution workflow. On a heel of #8811 (comment), I had a chat with @Youssef1313, here's some details from that convo:
@nohwnd also had a presentation for an AzDO reporting plugin during the latest .NET Showcase. Jakub also told me that a GHA reported was something on the team's backlog. Last, but not least @jeffhandley has built an awesome reporting for https://github.com/dotnet/issue-labeler (dotnet/issue-labeler#104) using GitHub.Actions.Core (which is built by our own @IEvangelist).
With the above, I'm not entirely convinced this change may be going the right direction; we'll definitely need the data analysis and the reporting capabilities, but the overall strategy is worth reconsidering. |
Thank you, that's useful information! I'm aware that you have great ideas around this and are going to possibly work on it. But that might take some time, so my effort here is a just a quick solution to act as a stop-gap till your proper solution is merged. |
|
Yea, lets do that in a follow up PR. We just need something better than what we have now at the moment. |
|
test run - https://github.com/dotnet/aspire/actions/runs/14963668924?pr=9223 Just cleaning up the PR now. |
|
Super nice. Small nit, delete the Program class and static void Main. Top level statements are made for these micro level programs 😄 |
|
@radical can we see inline console logs for the test that failed? Where is that? |
That should be captured in the |
|
OK some suggestions, add a link to the TRX file and logs per test failure. That will make it trivial to find and download the logs instead of showing them inline. |
Added link to the artifacts for the test assembly, which includes the trx, log file etc.
I retained this one though, good for a quick look at the error. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new tool for generating test summary reports from trx files, including both combined and single reports, and integrates it into the CI workflows.
- Introduces a new project, GenerateTestSummary, with logic for reading trx files and creating markdown reports.
- Updates GitHub workflows to use the new tool for generating test result summaries.
- Integrates the new project into the solution.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/GenerateTestSummary/TrxReader.cs | Adds functionality to deserialize and process trx files into test results. |
| tools/GenerateTestSummary/TestSummaryGenerator.cs | Implements report generation logic for both combined and single test summaries. |
| tools/GenerateTestSummary/Program.cs | Provides command-line entry point to run the test summary generation. |
| tools/GenerateTestSummary/GenerateTestSummary.csproj | New project file setup for the test summary tool. |
| Aspire.sln | Integrates the new project into the solution. |
| .github/workflows/tests.yml | Updates CI steps to use the new test summary tool with absolute paths. |
| .github/workflows/run-tests.yml | Adds a step to generate test summaries and pass URLs for logs. |
| errorMsgBuilder.AppendLine(test.Output?.ErrorInfo?.InnerText ?? string.Empty); | ||
| errorMsgBuilder.AppendLine(test.Output?.StdOut ?? string.Empty); | ||
|
|
||
| var errorMsgTruncated = TruncateTheStart(errorMsgBuilder.ToString(), 50_000); // Truncate long error messages for readability |
There was a problem hiding this comment.
[nitpick] Consider refactoring the magic number 50_000 into a named constant to clarify its purpose and improve maintainability.
|
@radical this PR is good, extra credit for a follow up PR that posts a GitHub comment with the direct link to the summary 😄 (and updates that same comment as re-runs happen) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
I was trying to add the reports on the PS: I have a different tool that I am working on which would add a github app and we could post from that. |
|
github app seems over engineered what what we need. Actions can use the token to post comments like our backport bot. Anyhow, approved. |
I'll check that out 👍 |
|
@radical include the OS in the test name. It looks like there are duplicate runs in the summary |
| // Generate a summary report from trx files. | ||
| // And write to $GITHUB_STEP_SUMMARY if running in GitHub Actions. | ||
|
|
||
| var dirPathOrTrxFilePathArgument = new Argument<string>("dirPathOrTrxFilePath"); |
There was a problem hiding this comment.
I'm struggling to understand all use-cases for this argument; more comments would be really helpful.
I understand when this points to a folder where *.trx files are, but what does it mean when it is a file? Why would I pass a file?
What does the following combination means?
-- D:\a\aspire\aspire/testresults -u https://github.com/dotnet/aspire/actions/runs/14966104757/artifacts/3103892024





Usage: dotnet tools run GenerateTestSummary --dirPathOrTrxFilePath <path> [--output <output>] [--combined]Generates a summary report from trx files.
This can generate individual summary for a test assembly showing details of the test failures.
And a combined report for multiple test assemblies with the total counters shown.