From aed02f37c7a3783665607512df7ad10d5bff97bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 24 Aug 2026 16:18:35 +0200 Subject: [PATCH] Add GitHub summary section selection Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/glossary.md | 2 +- .../GitHubActionsCommandLineOptions.cs | 120 ++++++++++ .../GitHubActionsCommandLineProvider.cs | 8 + .../GitHubActionsSummaryReporter.Markdown.cs | 207 ++++++++++-------- .../GitHubActionsSummaryReporter.cs | 10 +- .../InternalAPI/InternalAPI.Unshipped.txt | 16 ++ .../PACKAGE.md | 3 +- .../Resources/GitHubActionsResources.resx | 12 + .../xlf/GitHubActionsResources.cs.xlf | 15 ++ .../xlf/GitHubActionsResources.de.xlf | 15 ++ .../xlf/GitHubActionsResources.es.xlf | 15 ++ .../xlf/GitHubActionsResources.fr.xlf | 15 ++ .../xlf/GitHubActionsResources.it.xlf | 15 ++ .../xlf/GitHubActionsResources.ja.xlf | 15 ++ .../xlf/GitHubActionsResources.ko.xlf | 15 ++ .../xlf/GitHubActionsResources.pl.xlf | 15 ++ .../xlf/GitHubActionsResources.pt-BR.xlf | 15 ++ .../xlf/GitHubActionsResources.ru.xlf | 15 ++ .../xlf/GitHubActionsResources.tr.xlf | 15 ++ .../xlf/GitHubActionsResources.zh-Hans.xlf | 15 ++ .../xlf/GitHubActionsResources.zh-Hant.xlf | 15 ++ .../CiRunSummaryAggregation.cs | 3 + .../HelpInfoAllExtensionsTests.cs | 6 + .../CiRunSummaryAggregationTests.cs | 91 ++++++++ .../GitHubActionsCommandLineProviderTests.cs | 99 +++++++++ .../GitHubActionsSlowTestReporterTests.cs | 18 ++ .../GitHubActionsSummaryReporterTests.cs | 145 +++++++++++- 27 files changed, 838 insertions(+), 97 deletions(-) diff --git a/docs/glossary.md b/docs/glossary.md index b328650f850..612a09d4a19 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -158,7 +158,7 @@ An MTP extension (`Microsoft.Testing.Extensions.GitHubActionsReport`) that emits - **Per-assembly log groups** (`--report-gh-groups`): emits `::group::`/`::endgroup::` workflow commands so each test assembly's output is collapsed by default in the runner UI. - **Failure and skip annotations** (`--report-gh-annotations`): emits a `::error` workflow command for each failing test and a `::warning` workflow command for each skipped test; both surface in the workflow **Annotations** tab. The `file:line` location is taken from the failure's exception stack trace when a frame resolves inside the workspace, and otherwise from the test's own `TestFileLocationProperty` (the only location available for a skipped test), so annotations also appear on the PR "Files changed" diff gutter. `TestFileLocationProperty` is populated by the MSTest adapter and by the [VSTestBridge](#vstestbridge), which covers xUnit/NUnit and other bridged frameworks that report source information. -- **Job summary** (`--report-gh-step-summary`): writes a markdown roll-up (totals, failures, slowest tests) to the file pointed to by `GITHUB_STEP_SUMMARY`, which GitHub renders on the workflow run summary page. A capable SDK aggregates multi-module `dotnet test` runs into one authoritative overall section with per-assembly detail through artifact post-processing; older SDKs retain direct per-assembly sections. +- **Job summary** (`--report-gh-step-summary`): writes a markdown roll-up to the file pointed to by `GITHUB_STEP_SUMMARY`, which GitHub renders on the workflow run summary page. `--report-gh-step-summary-sections` independently selects `test-results`, `slow-tests`, or both (`all`, the default); values may be repeated, space-separated, or comma-separated. A capable SDK aggregates multi-module `dotnet test` runs into one authoritative overall section with per-assembly detail through artifact post-processing; mixed module selections are combined so the aggregate includes every requested section, and older fragments retain full output. - **Slow-test notices** (`--report-gh-slow-test-notices`): emits a `::notice` workflow command for any test running past a configured threshold (default 60 seconds; set with `--report-gh-slow-test-threshold`). When using [MSTest.Sdk](#mstestsdk), opt in with `true`; the extension is enabled automatically when `TestingExtensionsProfile` is set to `AllMicrosoft`. It is not supported in NativeAOT mode (MSTest.Sdk emits a build warning) or VSTest mode. Introduced in [PR #9541](https://github.com/microsoft/testfx/pull/9541); skipped-test `::warning` annotations were added in [PR #9641](https://github.com/microsoft/testfx/pull/9641). diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsCommandLineOptions.cs b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsCommandLineOptions.cs index 3bab57e7f23..cc199dfee9f 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsCommandLineOptions.cs +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsCommandLineOptions.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using Microsoft.Testing.Platform.CommandLine; + namespace Microsoft.Testing.Extensions.GitHubActionsReport; internal static class GitHubActionsCommandLineOptions @@ -9,8 +11,126 @@ internal static class GitHubActionsCommandLineOptions public const string GitHubActionsGroups = "report-gh-groups"; public const string GitHubActionsAnnotations = "report-gh-annotations"; public const string GitHubActionsStepSummary = "report-gh-step-summary"; + public const string GitHubActionsStepSummarySections = "report-gh-step-summary-sections"; public const string GitHubActionsSlowTestNotices = "report-gh-slow-test-notices"; public const string GitHubActionsSlowTestThreshold = "report-gh-slow-test-threshold"; public const int SlowTestThresholdDefaultSeconds = 60; } + +[Flags] +internal enum GitHubActionsStepSummarySections +{ + None = 0, + TestResults = 1, + SlowTests = 2, + All = TestResults | SlowTests, +} + +internal static class GitHubActionsStepSummarySectionsParser +{ + internal const string AllSectionName = "all"; + internal const string SlowTestsSectionName = "slow-tests"; + internal const string TestResultsSectionName = "test-results"; + + public static GitHubActionsStepSummarySections GetSections(ICommandLineOptions commandLineOptions) + => !commandLineOptions.TryGetOptionArgumentList( + GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections, + out string[]? arguments) + ? GitHubActionsStepSummarySections.All + : TryParse(arguments, out GitHubActionsStepSummarySections sections, out _, out _) + ? sections + : throw new InvalidOperationException("The GitHub Actions step-summary sections were not validated."); + + public static bool TryParse( + IReadOnlyList arguments, + out GitHubActionsStepSummarySections sections, + out string? invalidValue, + out bool hasEmptyValue) + { + sections = GitHubActionsStepSummarySections.None; + invalidValue = null; + hasEmptyValue = false; + + foreach (string argument in arguments) + { + string[] values = argument.Split(','); + foreach (string value in values) + { + string normalizedValue = value.Trim(); + if (normalizedValue.Length == 0) + { + hasEmptyValue = true; + return false; + } + + switch (normalizedValue.ToLowerInvariant()) + { + case TestResultsSectionName: + sections |= GitHubActionsStepSummarySections.TestResults; + break; + case SlowTestsSectionName: + sections |= GitHubActionsStepSummarySections.SlowTests; + break; + case AllSectionName: + sections = GitHubActionsStepSummarySections.All; + break; + default: + invalidValue = normalizedValue; + return false; + } + } + } + + if (sections == GitHubActionsStepSummarySections.None) + { + hasEmptyValue = true; + return false; + } + + return true; + } + + public static string[] ToPersistedValues(GitHubActionsStepSummarySections sections) + { + var values = new List(2); + if ((sections & GitHubActionsStepSummarySections.TestResults) != 0) + { + values.Add(TestResultsSectionName); + } + + if ((sections & GitHubActionsStepSummarySections.SlowTests) != 0) + { + values.Add(SlowTestsSectionName); + } + + return [.. values]; + } + + public static GitHubActionsStepSummarySections GetAggregateSections(IReadOnlyList modules) + { + if (modules.Count == 0) + { + return GitHubActionsStepSummarySections.All; + } + + GitHubActionsStepSummarySections sections = GitHubActionsStepSummarySections.None; + foreach (CiRunSummaryModule module in modules) + { + string[]? persistedValues = module.GitHubActionsStepSummarySections; + if (persistedValues is null + || !TryParse(persistedValues, out GitHubActionsStepSummarySections moduleSections, out _, out _)) + { + return GitHubActionsStepSummarySections.All; + } + + sections |= moduleSections; + if (sections == GitHubActionsStepSummarySections.All) + { + return sections; + } + } + + return sections; + } +} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsCommandLineProvider.cs index 6e230bea8dc..77e75b342fe 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsCommandLineProvider.cs @@ -22,6 +22,7 @@ public GitHubActionsCommandLineProvider() new CommandLineOption(GitHubActionsCommandLineOptions.GitHubActionsGroups, GitHubActionsResources.GroupsOptionDescription, ArgumentArity.ExactlyOne, false), new CommandLineOption(GitHubActionsCommandLineOptions.GitHubActionsAnnotations, GitHubActionsResources.AnnotationsOptionDescription, ArgumentArity.ExactlyOne, false), new CommandLineOption(GitHubActionsCommandLineOptions.GitHubActionsStepSummary, GitHubActionsResources.StepSummaryOptionDescription, ArgumentArity.ExactlyOne, false), + new CommandLineOption(GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections, GitHubActionsResources.StepSummarySectionsOptionDescription, ArgumentArity.OneOrMore, false), new CommandLineOption(GitHubActionsCommandLineOptions.GitHubActionsSlowTestNotices, GitHubActionsResources.SlowTestNoticesOptionDescription, ArgumentArity.ExactlyOne, false), new CommandLineOption(GitHubActionsCommandLineOptions.GitHubActionsSlowTestThreshold, GitHubActionsResources.SlowTestThresholdOptionDescription, ArgumentArity.ExactlyOne, false), new CommandLineOption(GitHubActionsCommandLineOptions.GitHubActionsOptionName, GitHubActionsResources.OptionDescription, ArgumentArity.Zero, false), @@ -38,6 +39,12 @@ GitHubActionsCommandLineOptions.GitHubActionsGroups or GitHubActionsCommandLineO GitHubActionsCommandLineOptions.GitHubActionsSlowTestThreshold when !(TimeSpanParser.TryParse(arguments[0], TimeSpanDefaultUnit.Seconds, out TimeSpan threshold) && threshold > TimeSpan.Zero) => ValidationResult.InvalidTask(string.Format(CultureInfo.InvariantCulture, GitHubActionsResources.InvalidSlowTestThreshold, arguments[0])), + GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections + when !GitHubActionsStepSummarySectionsParser.TryParse(arguments, out _, out string? invalidValue, out bool hasEmptyValue) + => ValidationResult.InvalidTask( + hasEmptyValue + ? GitHubActionsResources.EmptyStepSummarySections + : string.Format(CultureInfo.InvariantCulture, GitHubActionsResources.InvalidStepSummarySection, invalidValue)), _ => ValidationResult.ValidTask, }; @@ -48,6 +55,7 @@ public override Task ValidateCommandLineOptionsAsync(ICommandL GitHubActionsCommandLineOptions.GitHubActionsGroups, GitHubActionsCommandLineOptions.GitHubActionsAnnotations, GitHubActionsCommandLineOptions.GitHubActionsStepSummary, + GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections, GitHubActionsCommandLineOptions.GitHubActionsSlowTestNotices, GitHubActionsCommandLineOptions.GitHubActionsSlowTestThreshold, ], diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsSummaryReporter.Markdown.cs b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsSummaryReporter.Markdown.cs index a678c71431b..ee2bc47ce81 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsSummaryReporter.Markdown.cs +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsSummaryReporter.Markdown.cs @@ -8,7 +8,12 @@ namespace Microsoft.Testing.Extensions.GitHubActionsReport; internal sealed partial class GitHubActionsSummaryReporter { - internal static /* for testing */ string BuildMarkdown(IReadOnlyList records, string assemblyName, string targetFrameworkMoniker, int exitCode) + internal static /* for testing */ string BuildMarkdown( + IReadOnlyList records, + string assemblyName, + string targetFrameworkMoniker, + int exitCode, + GitHubActionsStepSummarySections sections = GitHubActionsStepSummarySections.All) { int total = records.Count; int passed = 0; @@ -46,60 +51,66 @@ internal sealed partial class GitHubActionsSummaryReporter var builder = new StringBuilder(); builder.Append("## ").Append(statusIcon).Append(" Test Run Summary — ").Append(assemblyName).Append(" (").Append(targetFrameworkMoniker).Append(")\n\n"); - builder.Append("| Total | Passed | Failed | Skipped | Duration |\n"); - builder.Append("|---:|---:|---:|---:|---:|\n"); - builder.Append("| ").Append(total.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(passed.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(failed.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(skipped.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(FormatDuration(totalDuration)).Append(" |\n\n"); - - // Surface a non-test-result failure that this reporter can observe once the session has finished - // (zero tests, --minimum-expected-tests, --maximum-failed-tests, test-adapter session failure) as a - // GitHub alert callout. Plain pass / at-least-one-failed outcomes are already conveyed by the totals - // table and the failures section, so no callout is added for them. - if (!GitHubActionsExitCode.IsTestResultOutcome(exitCode)) + if ((sections & GitHubActionsStepSummarySections.TestResults) != 0) { - string calloutText = string.Format( - CultureInfo.InvariantCulture, - GitHubActionsResources.ExitCodeCallout, - exitCode.ToString(CultureInfo.InvariantCulture), - GitHubActionsExitCode.GetName(exitCode), - GitHubActionsExitCode.GetReason(exitCode)); - builder.Append("> [!WARNING]\n> ").Append(EscapeInlineCode(calloutText)).Append("\n\n"); - } - - if (failures.Count > 0) - { - builder.Append("### ❌ Failures (").Append(failed.ToString(CultureInfo.InvariantCulture)).Append(")\n\n"); - foreach (TestRecord failure in failures) + builder.Append("| Total | Passed | Failed | Skipped | Duration |\n"); + builder.Append("|---:|---:|---:|---:|---:|\n"); + builder.Append("| ").Append(total.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(passed.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(failed.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(skipped.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(FormatDuration(totalDuration)).Append(" |\n\n"); + + // Surface a non-test-result failure that this reporter can observe once the session has finished + // (zero tests, --minimum-expected-tests, --maximum-failed-tests, test-adapter session failure) as a + // GitHub alert callout. Plain pass / at-least-one-failed outcomes are already conveyed by the totals + // table and the failures section, so no callout is added for them. + if (!GitHubActionsExitCode.IsTestResultOutcome(exitCode)) { - builder.Append("- `").Append(EscapeInlineCode(failure.FullyQualifiedName)).Append("`\n"); + string calloutText = string.Format( + CultureInfo.InvariantCulture, + GitHubActionsResources.ExitCodeCallout, + exitCode.ToString(CultureInfo.InvariantCulture), + GitHubActionsExitCode.GetName(exitCode), + GitHubActionsExitCode.GetReason(exitCode)); + builder.Append("> [!WARNING]\n> ").Append(EscapeInlineCode(calloutText)).Append("\n\n"); } - builder.Append('\n'); - } + if (failures.Count > 0) + { + builder.Append("### ❌ Failures (").Append(failed.ToString(CultureInfo.InvariantCulture)).Append(")\n\n"); + foreach (TestRecord failure in failures) + { + builder.Append("- `").Append(EscapeInlineCode(failure.FullyQualifiedName)).Append("`\n"); + } - IEnumerable slowest = records - .Where(static r => r.Duration > TimeSpan.Zero) - .OrderByDescending(static r => r.Duration) - .Take(MaxSlowestTests); + builder.Append('\n'); + } + } - bool slowestEmitted = false; - foreach (TestRecord record in slowest) + if ((sections & GitHubActionsStepSummarySections.SlowTests) != 0) { - if (!slowestEmitted) + IEnumerable slowest = records + .Where(static r => r.Duration > TimeSpan.Zero) + .OrderByDescending(static r => r.Duration) + .Take(MaxSlowestTests); + + bool slowestEmitted = false; + foreach (TestRecord record in slowest) { - builder.Append("### ⏱ Slowest tests\n\n"); - slowestEmitted = true; - } + if (!slowestEmitted) + { + builder.Append("### ⏱ Slowest tests\n\n"); + slowestEmitted = true; + } - builder.Append("- `").Append(EscapeInlineCode(record.FullyQualifiedName)).Append("` — ").Append(FormatDuration(record.Duration)).Append('\n'); - } + builder.Append("- `").Append(EscapeInlineCode(record.FullyQualifiedName)).Append("` — ").Append(FormatDuration(record.Duration)).Append('\n'); + } - if (slowestEmitted) - { - builder.Append('\n'); + if (slowestEmitted) + { + builder.Append('\n'); + } } return builder.ToString(); @@ -107,6 +118,7 @@ internal sealed partial class GitHubActionsSummaryReporter internal static string BuildAggregateMarkdown(CiRunSummaryAggregate aggregate) { + GitHubActionsStepSummarySections sections = GitHubActionsStepSummarySectionsParser.GetAggregateSections(aggregate.Modules); bool failed = aggregate.ExitCode is int exitCode ? GitHubActionsExitCode.IndicatesFailure(exitCode) : aggregate.FailedTests > 0; @@ -119,33 +131,36 @@ internal static string BuildAggregateMarkdown(CiRunSummaryAggregate aggregate) var builder = new StringBuilder(); builder.Append("## ").Append(statusIcon).Append(" Overall Test Run Summary\n\n"); - builder.Append("| Total | Passed | Failed | Skipped | Duration |\n"); - builder.Append("|---:|---:|---:|---:|---:|\n"); - builder.Append("| ").Append(aggregate.TotalTests.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(aggregate.PassedTests.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(aggregate.FailedTests.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(aggregate.SkippedTests.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(duration).Append(" |\n\n"); - - if (aggregate.IsPartial) + if ((sections & GitHubActionsStepSummarySections.TestResults) != 0) { - builder.Append("> [!WARNING]\n> This summary is partial because the test run was truncated.\n\n"); - } - else if (!aggregate.HasAuthoritativeRunSummary) - { - builder.Append("> [!NOTE]\n> Counts reflect the observed module fragments. The outer `dotnet test` duration and exit verdict were not supplied by the SDK.\n\n"); - } + builder.Append("| Total | Passed | Failed | Skipped | Duration |\n"); + builder.Append("|---:|---:|---:|---:|---:|\n"); + builder.Append("| ").Append(aggregate.TotalTests.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(aggregate.PassedTests.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(aggregate.FailedTests.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(aggregate.SkippedTests.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(duration).Append(" |\n\n"); + + if (aggregate.IsPartial) + { + builder.Append("> [!WARNING]\n> This summary is partial because the test run was truncated.\n\n"); + } + else if (!aggregate.HasAuthoritativeRunSummary) + { + builder.Append("> [!NOTE]\n> Counts reflect the observed module fragments. The outer `dotnet test` duration and exit verdict were not supplied by the SDK.\n\n"); + } - if (aggregate.ExitCode is int authoritativeExitCode - && !GitHubActionsExitCode.IsTestResultOutcome(authoritativeExitCode)) - { - string calloutText = string.Format( - CultureInfo.InvariantCulture, - GitHubActionsResources.ExitCodeCallout, - authoritativeExitCode.ToString(CultureInfo.InvariantCulture), - GitHubActionsExitCode.GetName(authoritativeExitCode), - GitHubActionsExitCode.GetReason(authoritativeExitCode)); - builder.Append("> [!WARNING]\n> ").Append(EscapeInlineCode(calloutText)).Append("\n\n"); + if (aggregate.ExitCode is int authoritativeExitCode + && !GitHubActionsExitCode.IsTestResultOutcome(authoritativeExitCode)) + { + string calloutText = string.Format( + CultureInfo.InvariantCulture, + GitHubActionsResources.ExitCodeCallout, + authoritativeExitCode.ToString(CultureInfo.InvariantCulture), + GitHubActionsExitCode.GetName(authoritativeExitCode), + GitHubActionsExitCode.GetReason(authoritativeExitCode)); + builder.Append("> [!WARNING]\n> ").Append(EscapeInlineCode(calloutText)).Append("\n\n"); + } } foreach (CiRunSummaryModule module in aggregate.Modules) @@ -162,45 +177,53 @@ internal static string BuildAggregateMarkdown(CiRunSummaryAggregate aggregate) } builder.Append(")\n\n"); - AppendModuleMarkdown(builder, module, headingLevel: 3); + AppendModuleMarkdown(builder, module, headingLevel: 3, sections); builder.Append("\n\n"); } return builder.ToString(); } - private static void AppendModuleMarkdown(StringBuilder builder, CiRunSummaryModule module, int headingLevel) + private static void AppendModuleMarkdown( + StringBuilder builder, + CiRunSummaryModule module, + int headingLevel, + GitHubActionsStepSummarySections sections) { string heading = new('#', headingLevel); bool runFailed = module.FailedTests > 0 || GitHubActionsExitCode.IndicatesFailure(module.ExitCode); builder.Append(heading).Append(' ').Append(runFailed ? "❌" : "✅").Append(' ') .Append(EscapeInlineCode(module.AssemblyName)).Append("\n\n"); - builder.Append("| Total | Passed | Failed | Skipped | Test duration |\n"); - builder.Append("|---:|---:|---:|---:|---:|\n"); - builder.Append("| ").Append(module.TotalTests.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(module.PassedTests.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(module.FailedTests.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(module.SkippedTests.ToString(CultureInfo.InvariantCulture)) - .Append(" | ").Append(FormatDuration(TimeSpan.FromTicks(module.TestDurationTicks))).Append(" |\n\n"); - - if (!GitHubActionsExitCode.IsTestResultOutcome(module.ExitCode)) - { - builder.Append("> Module exit code: `").Append(module.ExitCode.ToString(CultureInfo.InvariantCulture)).Append("` (") - .Append(EscapeInlineCode(GitHubActionsExitCode.GetName(module.ExitCode))).Append(")\n\n"); - } - - if (module.Failures.Length > 0) + if ((sections & GitHubActionsStepSummarySections.TestResults) != 0) { - builder.Append(heading).Append("# ❌ Failures (").Append(module.FailedTests.ToString(CultureInfo.InvariantCulture)).Append(")\n\n"); - foreach (CiRunSummaryTest failure in module.Failures) + builder.Append("| Total | Passed | Failed | Skipped | Test duration |\n"); + builder.Append("|---:|---:|---:|---:|---:|\n"); + builder.Append("| ").Append(module.TotalTests.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(module.PassedTests.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(module.FailedTests.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(module.SkippedTests.ToString(CultureInfo.InvariantCulture)) + .Append(" | ").Append(FormatDuration(TimeSpan.FromTicks(module.TestDurationTicks))).Append(" |\n\n"); + + if (!GitHubActionsExitCode.IsTestResultOutcome(module.ExitCode)) { - builder.Append("- `").Append(EscapeInlineCode(failure.FullyQualifiedName)).Append("`\n"); + builder.Append("> Module exit code: `").Append(module.ExitCode.ToString(CultureInfo.InvariantCulture)).Append("` (") + .Append(EscapeInlineCode(GitHubActionsExitCode.GetName(module.ExitCode))).Append(")\n\n"); } - builder.Append('\n'); + if (module.Failures.Length > 0) + { + builder.Append(heading).Append("# ❌ Failures (").Append(module.FailedTests.ToString(CultureInfo.InvariantCulture)).Append(")\n\n"); + foreach (CiRunSummaryTest failure in module.Failures) + { + builder.Append("- `").Append(EscapeInlineCode(failure.FullyQualifiedName)).Append("`\n"); + } + + builder.Append('\n'); + } } - if (module.SlowestTests.Length > 0) + if ((sections & GitHubActionsStepSummarySections.SlowTests) != 0 + && module.SlowestTests.Length > 0) { builder.Append(heading).Append("# ⏱ Slowest tests\n\n"); foreach (CiRunSummaryTest test in module.SlowestTests) diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsSummaryReporter.cs b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsSummaryReporter.cs index 45154ac2823..ee68afc5d60 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsSummaryReporter.cs +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsSummaryReporter.cs @@ -51,6 +51,7 @@ internal sealed partial class GitHubActionsSummaryReporter : private readonly ILogger _logger; private readonly Lazy _targetFrameworkMoniker; private readonly bool _isEnabled; + private readonly GitHubActionsStepSummarySections _sections; private readonly Func _shouldDeferToArtifactPostProcessing; #if NET9_0_OR_GREATER @@ -84,6 +85,7 @@ public GitHubActionsSummaryReporter( _logger = loggerFactory.CreateLogger(); _targetFrameworkMoniker = new(TargetFrameworkMonikerHelper.GetTargetFrameworkMonikerIncludingPlatform); _isEnabled = GitHubActionsFeature.IsEnabled(commandLineOptions, environment, GitHubActionsCommandLineOptions.GitHubActionsStepSummary); + _sections = GitHubActionsStepSummarySectionsParser.GetSections(commandLineOptions); _shouldDeferToArtifactPostProcessing = shouldDeferToArtifactPostProcessing; } @@ -219,7 +221,7 @@ await _messageBus.PublishAsync( return; } - string markdown = BuildMarkdown(snapshot, assemblyName, _targetFrameworkMoniker.Value, exitCode); + string markdown = BuildMarkdown(snapshot, assemblyName, _targetFrameworkMoniker.Value, exitCode, _sections); try { @@ -250,7 +252,8 @@ private CiRunSummaryModule CreateModule( IReadOnlyList records, string assemblyName, ITestSessionContext testSessionContext) - => CiRunSummaryAggregation.CreateModule( + { + CiRunSummaryModule module = CiRunSummaryAggregation.CreateModule( records, assemblyName, _testApplicationModuleInfo.GetCurrentTestApplicationFullPath(), @@ -260,6 +263,9 @@ private CiRunSummaryModule CreateModule( testSessionContext.SessionUid.Value, GetAttemptNumber(), _testApplicationProcessExitCode.GetProcessExitCode()); + module.GitHubActionsStepSummarySections = GitHubActionsStepSummarySectionsParser.ToPersistedValues(_sections); + return module; + } private int GetAttemptNumber() => int.TryParse( diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/InternalAPI/InternalAPI.Unshipped.txt b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/InternalAPI/InternalAPI.Unshipped.txt index fe414f9ae65..ca5ef61d70d 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/InternalAPI/InternalAPI.Unshipped.txt +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/InternalAPI/InternalAPI.Unshipped.txt @@ -8,6 +8,12 @@ Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsAnnotationReporter Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsAnnotationReporter.OnTestSessionStartingAsync(Microsoft.Testing.Platform.Services.ITestSessionContext! testSessionContext) -> System.Threading.Tasks.Task! override Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsCommandLineProvider.ValidateCommandLineOptionsAsync(Microsoft.Testing.Platform.CommandLine.ICommandLineOptions! commandLineOptions) -> System.Threading.Tasks.Task! Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsExitCode +Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections +Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections.All = Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections.TestResults | Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections.SlowTests -> Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections +Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections.None = 0 -> Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections +Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections.SlowTests = 2 -> Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections +Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections.TestResults = 1 -> Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections +Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySectionsParser Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.GitHubActionsSummaryReporter(Microsoft.Testing.Platform.CommandLine.ICommandLineOptions! commandLineOptions, Microsoft.Testing.Platform.Configurations.IConfiguration! configuration, Microsoft.Testing.Platform.Helpers.IEnvironment! environment, Microsoft.Testing.Platform.Helpers.IFileSystem! fileSystem, Microsoft.Testing.Platform.Messages.IMessageBus! messageBus, Microsoft.Testing.Platform.OutputDevice.IOutputDevice! outputDevice, Microsoft.Testing.Platform.Services.ITestApplicationModuleInfo! testApplicationModuleInfo, Microsoft.Testing.Platform.Services.ITestApplicationProcessExitCode! testApplicationProcessExitCode, Microsoft.Testing.Platform.Logging.ILoggerFactory! loggerFactory, System.Func! shouldDeferToArtifactPostProcessing) -> void Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.DataTypesProduced.get -> System.Type![]! static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.AppendStepSummaryWithRetryAsync(Microsoft.Testing.Platform.Helpers.IFileSystem! fileSystem, string! path, string! content, int maxAttempts, System.TimeSpan retryDelay, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! @@ -18,6 +24,11 @@ static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsExitCode.In static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsExitCode.IsTestResultOutcome(int exitCode) -> bool static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSlowTestReporter.BuildNoticeLine(string! testLabel, System.TimeSpan elapsed) -> string! static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.BuildMarkdown(System.Collections.Generic.IReadOnlyList! records, string! assemblyName, string! targetFrameworkMoniker, int exitCode) -> string! +static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySectionsParser.GetAggregateSections(System.Collections.Generic.IReadOnlyList! modules) -> Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections +static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySectionsParser.GetSections(Microsoft.Testing.Platform.CommandLine.ICommandLineOptions! commandLineOptions) -> Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections +static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySectionsParser.ToPersistedValues(Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections sections) -> string![]! +static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySectionsParser.TryParse(System.Collections.Generic.IReadOnlyList! arguments, out Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections sections, out string? invalidValue, out bool hasEmptyValue) -> bool +static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.BuildMarkdown(System.Collections.Generic.IReadOnlyList! records, string! assemblyName, string! targetFrameworkMoniker, int exitCode, Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections sections = Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections.All) -> string! static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.BuildAggregateMarkdown(Microsoft.Testing.Extensions.CiRunSummaryAggregate! aggregate) -> string! static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.UpsertStepSummaryWithRetryAsync(Microsoft.Testing.Platform.Helpers.IFileSystem! fileSystem, string! path, string! aggregationId, string! content, int maxAttempts, System.TimeSpan retryDelay, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! static Microsoft.Testing.Extensions.TestNodeIdentity.GetDisplayLabel(Microsoft.Testing.Platform.Extensions.Messages.TestNode! testNode) -> string! @@ -27,6 +38,11 @@ static Microsoft.Testing.Extensions.TestNodeIdentity.GetDisplayLabel(Microsoft.T *REMOVED*Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.GitHubActionsSummaryReporter(Microsoft.Testing.Platform.CommandLine.ICommandLineOptions! commandLineOptions, Microsoft.Testing.Platform.Helpers.IEnvironment! environment, Microsoft.Testing.Platform.Helpers.IFileSystem! fileSystem, Microsoft.Testing.Platform.OutputDevice.IOutputDevice! outputDevice, Microsoft.Testing.Platform.Services.ITestApplicationModuleInfo! testApplicationModuleInfo, Microsoft.Testing.Platform.Services.ITestApplicationProcessExitCode! testApplicationProcessExitCode, Microsoft.Testing.Platform.Logging.ILoggerFactory! loggerFactory) -> void *REMOVED*static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSlowTestReporter.BuildNoticeLine(string! testName, System.TimeSpan elapsed) -> string! *REMOVED*static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.BuildMarkdown(System.Collections.Generic.IReadOnlyList! records, string! assemblyName, string! targetFrameworkMoniker) -> string! +*REMOVED*static Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryReporter.BuildMarkdown(System.Collections.Generic.IReadOnlyList! records, string! assemblyName, string! targetFrameworkMoniker, int exitCode) -> string! +const Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections = "report-gh-step-summary-sections" -> string! +const Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySectionsParser.AllSectionName = "all" -> string! +const Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySectionsParser.SlowTestsSectionName = "slow-tests" -> string! +const Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySectionsParser.TestResultsSectionName = "test-results" -> string! Microsoft.Testing.Platform.Helpers.ExitCode.CoverageThresholdFailed = 14 -> Microsoft.Testing.Platform.Helpers.ExitCode Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSourceLocation Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSourceLocation.GitHubActionsSourceLocation() -> void diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/PACKAGE.md b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/PACKAGE.md index 2146f04449d..750c7b89135 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/PACKAGE.md +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/PACKAGE.md @@ -16,7 +16,7 @@ This package extends Microsoft.Testing.Platform with: - **Per-assembly log groups**: emits `::group::` / `::endgroup::` workflow commands so each test assembly's output is collapsed by default in the runner UI - **Failure annotations**: emits an `::error` workflow command for each failing test so failures appear in the workflow Annotations tab and, when the source location can be resolved, on the pull request's "Files changed" diff gutter. Skipped tests are surfaced as `::warning` annotations so they are visible in the Annotations tab too. When the test session completes with a non-test-result failure — a `--minimum-expected-tests` violation, a run that discovered zero tests, a `--maximum-failed-tests` stop, or a test-adapter session failure — a single run-level `::error` is emitted describing the [Microsoft.Testing.Platform exit code](https://learn.microsoft.com/dotnet/core/testing/microsoft-testing-platform-troubleshooting#exit-codes) -- **Job summary**: writes one markdown roll-up (totals, failures, slowest tests) to the file pointed to by `GITHUB_STEP_SUMMARY`, which GitHub renders on the workflow run summary page. With an SDK that supports required artifact post-processing, multi-module `dotnet test` runs produce one authoritative overall section using the SDK's outer duration and exit verdict, with deterministic per-assembly details underneath. Older SDKs preserve the per-assembly sections. A non-test-result failure exit code is called out so a failure is not hidden behind a green ✅ +- **Job summary**: writes one markdown roll-up (totals, failures, slowest tests) to the file pointed to by `GITHUB_STEP_SUMMARY`, which GitHub renders on the workflow run summary page. Use `--report-gh-step-summary-sections` to select `test-results`, `slow-tests`, or both; `all` keeps every currently supported section and is the default. With an SDK that supports required artifact post-processing, multi-module `dotnet test` runs produce one authoritative overall section using the SDK's outer duration and exit verdict, with deterministic per-assembly details underneath. Older SDKs preserve the per-assembly sections. A non-test-result failure exit code is called out so a failure is not hidden behind a green ✅ - **Slow-test notices**: emits a `::notice` workflow command for any test still running past a threshold (default 60 seconds) > [!NOTE] @@ -41,6 +41,7 @@ The extension activates when the test run is on GitHub Actions (`GITHUB_ACTIONS= | `--report-gh-groups on\|off` | Per-assembly log groups | on | | `--report-gh-annotations on\|off` | Failure and skip annotations | on | | `--report-gh-step-summary on\|off` | Markdown job summary | on | +| `--report-gh-step-summary-sections
...` | Job-summary content: `test-results`, `slow-tests`, or `all`; accepts repeated, space-separated, and comma-separated values | `all` | | `--report-gh-slow-test-notices on\|off` | Slow-test notices | on | | `--report-gh-slow-test-threshold ` | Time before a slow-test notice is emitted; accepts a bare number of seconds or a unit suffix such as `90s`, `2m`, `1.5h` | 60s | diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/GitHubActionsResources.resx b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/GitHubActionsResources.resx index f1344c17ffe..c68c4b3b9cb 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/GitHubActionsResources.resx +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/GitHubActionsResources.resx @@ -83,6 +83,18 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Failed to write the GitHub Actions job summary to '{0}': {1} {0} is the file path, {1} is the error message. diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.cs.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.cs.xlf index acc0799eb7a..f755ef3ccc6 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.cs.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.cs.xlf @@ -22,6 +22,11 @@ Generátor sestav GitHub Actions + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) Spuštění testů se nepovedlo (ukončovací kód {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. Test neproběhl úspěšně bez poskytnutí zprávy o chybě. @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} Zápis souhrnu úlohy GitHub Actions do {0} se nezdařil: {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.de.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.de.xlf index ea55012b9b1..c90fec84668 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.de.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.de.xlf @@ -22,6 +22,11 @@ GitHub Actions Bericht-Generator + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) Testlauf fehlgeschlagen (Exitcode {0}: {1}) @@ -127,6 +132,11 @@ Ungültiger Wert: „{0}“. Der Schwellenwert für langsame Tests muss eine positive Dauer aufweisen, z. B. „60“, „90 Sek.“ oder „2 Min.“. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. Fehler beim Test ohne Angabe einer Fehlermeldung. @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} Fehler beim Schreiben der GitHub Actions Auftragszusammenfassung in „{0}“: {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.es.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.es.xlf index ffbb58c7f24..56603e19c56 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.es.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.es.xlf @@ -22,6 +22,11 @@ Generador de informes de Acciones de GitHub + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) Error en la ejecución de pruebas (código de salida {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. Error en la prueba sin proporcionar un mensaje de error. @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} No se pudo escribir el resumen del trabajo de Acciones de GitHub en ''{0}": {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.fr.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.fr.xlf index 442c74ad18e..5e91bde907c 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.fr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.fr.xlf @@ -22,6 +22,11 @@ Générateur de rapports GitHub Actions + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) Nous n’avons pas pu effectuer l’exécution de tests (code de sortie {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. Le test a échoué sans offrir de message d’échec. @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} Nous n’avons pas pu écrire le résumé du travail GitHub Actions dans « {0} » : {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.it.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.it.xlf index 1ff581c22d2..9ee1b2b1a9b 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.it.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.it.xlf @@ -22,6 +22,11 @@ GitHub Actions report generator + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) Esecuzione dei test non riuscita (codice di uscita {0}: {1}) @@ -127,6 +132,11 @@ Valore '{0}' non valido. La soglia di test lento deve essere espressa come durata positiva, ad esempio '60', '90s' o '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. Il test non è riuscito senza fornire un messaggio di errore. @@ -172,6 +182,11 @@ Enable o disable per la scrittura di un riepilogo del processo markdown nel file GITHUB_STEP_SUMMARY. I valori validi sono 'on' (accetta anche 'true', 'enable', '1') o 'off' (accetta anche 'false', 'disable', '0'). Il valore predefinito è 'on' quando si esegue in GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} Non è possibile scrivere il riepilogo del processo di GitHub Actions in '{0}': {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ja.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ja.xlf index cda7094ebf1..0b301be7145 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ja.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ja.xlf @@ -22,6 +22,11 @@ GitHub Actions レポート生成プログラム + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) テストの実行に失敗しました (終了コード {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. テストは失敗し、失敗メッセージは提供されませんでした。 @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} GitHub Actionsジョブの要約を '{0}' に書き込めませんでした: {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ko.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ko.xlf index 834dc1d401a..a6ac40a6247 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ko.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ko.xlf @@ -22,6 +22,11 @@ GitHub Actions 보고서 생성기 + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) 테스트 실행 실패(종료 코드 {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. 실패 메시지를 제공하지 않고 테스트에 실패했습니다. @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} '{0}'에 GitHub Actions 작업 요약을 쓰지 못했습니다. {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.pl.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.pl.xlf index af591d62e3a..457fcd1be91 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.pl.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.pl.xlf @@ -22,6 +22,11 @@ Generator raportów usługi GitHub Actions + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) Przebieg testu zakończył się niepowodzeniem (kod wyjścia {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. Test zakończył się niepowodzeniem bez podania komunikatu o błędzie. @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} Nie można zapisać podsumowania zadania usługi GitHub Actions w „{0}”: {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.pt-BR.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.pt-BR.xlf index 685698f4d14..75e50998387 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.pt-BR.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.pt-BR.xlf @@ -22,6 +22,11 @@ Gerador de relatório do GitHub Actions + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) A execução de teste falhou (código de saída {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. O teste falhou sem fornecer uma mensagem de falha. @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} Falha ao gravar o resumo do trabalho do GitHub Actions em '{0}': {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ru.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ru.xlf index d58b0981999..80b83c4f30a 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ru.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.ru.xlf @@ -22,6 +22,11 @@ Генератор отчетов GitHub Actions + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) Сбой тестового запуска (код выхода {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. Тест завершился сбоем без вывода сообщения об ошибке. @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} Не удалось записать сводку задания GitHub Actions в "{0}": {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.tr.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.tr.xlf index b55b9cfbb71..57cca56e801 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.tr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.tr.xlf @@ -22,6 +22,11 @@ GitHub Actions rapor oluşturucusu + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) Test çalıştırması başarısız oldu (çıkış kodu {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. Test, başarısızlık iletisi sağlanmadan başarısız oldu. @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} GitHub Actions iş özeti '{0}' konumuna yazılamadı: {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.zh-Hans.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.zh-Hans.xlf index 797769695a7..6200a5d24a1 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.zh-Hans.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.zh-Hans.xlf @@ -22,6 +22,11 @@ GitHub Actions 报告生成器 + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) 测试运行失败(退出代码 {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. 测试失败,且未提供失败消息。 @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} 未能将 GitHub Actions 作业摘要写入“{0}”: {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.zh-Hant.xlf b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.zh-Hant.xlf index 4a0a50d5ef5..b6ddbac1ff2 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.zh-Hant.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/xlf/GitHubActionsResources.zh-Hant.xlf @@ -22,6 +22,11 @@ GitHub Actions 報告產生器 + + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + At least one GitHub Actions job-summary section is required. Valid values are 'test-results', 'slow-tests', or 'all'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + Test run failed (exit code {0}: {1}) 測試執行失敗 (結束代碼 {0}: {1}) @@ -127,6 +132,11 @@ Invalid value '{0}'. The slow-test threshold must be a positive duration, e.g. '60', '90s', or '2m'. {Locked="s"}{Locked="m"} + + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + Invalid GitHub Actions job-summary section '{0}'. Valid values are 'test-results', 'slow-tests', or 'all'. Values can be repeated, space-separated, or comma-separated. + {0} is the invalid section name. {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"} + The test failed without providing a failure message. 測試失敗,且未提供失敗訊息。 @@ -172,6 +182,11 @@ Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. {Locked="on"}{Locked="off"}{Locked="true"}{Locked="enable"}{Locked="1"}{Locked="false"}{Locked="disable"}{Locked="0"}{Locked="GITHUB_STEP_SUMMARY"} + + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. + {Locked="'test-results'"}{Locked="'slow-tests'"}{Locked="'all'"}{Locked="'--report-gh'"} + Failed to write the GitHub Actions job summary to '{0}': {1} 無法將 GitHub Actions 工作摘要寫入至 '{0}': {1} diff --git a/src/Platform/SharedExtensionHelpers/CiRunSummaryAggregation.cs b/src/Platform/SharedExtensionHelpers/CiRunSummaryAggregation.cs index 5b340971557..36e108df9d1 100644 --- a/src/Platform/SharedExtensionHelpers/CiRunSummaryAggregation.cs +++ b/src/Platform/SharedExtensionHelpers/CiRunSummaryAggregation.cs @@ -47,6 +47,9 @@ internal sealed class CiRunSummaryModule public CiRunSummaryTest[] SlowestTests { get; set; } = []; public CiRunSummaryFailingClass[] TopFailingClasses { get; set; } = []; + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string[]? GitHubActionsStepSummarySections { get; set; } } internal sealed class CiRunSummaryTest diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs index c7eaa60f83d..73badec010a 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs @@ -202,6 +202,8 @@ Enable GitHub Actions report generator to emit workflow commands so test runs pr The duration a test may run before a GitHub Actions slow-test notice is emitted. Accepts a bare number of seconds or a value with a unit suffix such as '90s', '2m', or '1.5h'. Defaults to 60s. --report-gh-step-summary Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + --report-gh-step-summary-sections + Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. --report-html Enable generating an HTML report. --report-html-filename @@ -611,6 +613,10 @@ The file makes it possible to identify the tests that were running at the time o Arity: 1 Hidden: False Description: Enable or disable writing a markdown job summary to the GITHUB_STEP_SUMMARY file. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + --report-gh-step-summary-sections + Arity: 1..N + Hidden: False + Description: Select the content included in the GitHub Actions job summary. Specify one or more values, repeated, space-separated, or comma-separated: 'test-results', 'slow-tests', or 'all'. Defaults to 'all'. Requires '--report-gh'. HangDumpCommandLineProvider Name: Hang dump Version: * diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CiRunSummaryAggregationTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CiRunSummaryAggregationTests.cs index 453dd044728..7f3c3702ba4 100644 --- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CiRunSummaryAggregationTests.cs +++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CiRunSummaryAggregationTests.cs @@ -14,6 +14,11 @@ using Moq; +using GitHubActionsStepSummarySections = ghactions::Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySections; +using GitHubActionsStepSummarySectionsParser = ghactions::Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsStepSummarySectionsParser; +using GitHubCiRunSummaryAggregate = ghactions::Microsoft.Testing.Extensions.CiRunSummaryAggregate; +using GitHubCiRunSummaryAggregation = ghactions::Microsoft.Testing.Extensions.CiRunSummaryAggregation; +using GitHubCiRunSummaryModule = ghactions::Microsoft.Testing.Extensions.CiRunSummaryModule; using GitHubSummaryPostProcessor = ghactions::Microsoft.Testing.Extensions.GitHubActionsReport.GitHubActionsSummaryArtifactPostProcessor; namespace Microsoft.Testing.Extensions.UnitTests; @@ -150,6 +155,70 @@ public async Task ReadAndAggregate_DuplicateFragmentIdentity_ThrowsFormatExcepti } } + [TestMethod] + public async Task GitHubFragment_RoundTripsStepSummarySectionsAsync() + { + string directory = CreateDirectory(); + try + { + GitHubCiRunSummaryModule module = CreateGitHubModule("Selected"); + module.GitHubActionsStepSummarySections = ["test-results"]; + string path = await GitHubCiRunSummaryAggregation.WriteFragmentAsync( + directory, + GitHubSummaryPostProcessor.Provider, + GitHubSummaryPostProcessor.ProviderSlug, + module); + + string json = File.ReadAllText(path); + GitHubCiRunSummaryAggregate aggregate = GitHubCiRunSummaryAggregation.ReadAndAggregate( + [CreateGitHubInput(path, module)], + GitHubSummaryPostProcessor.Provider, + new ArtifactPostProcessingContext(ArtifactPostProcessingTruncationReason.None)); + string[] persistedSections = aggregate.Modules.Single().GitHubActionsStepSummarySections!; + + Assert.Contains("\"gitHubActionsStepSummarySections\"", json); + Assert.AreSequenceEqual(["test-results"], persistedSections); + Assert.AreEqual( + GitHubActionsStepSummarySections.TestResults, + GitHubActionsStepSummarySectionsParser.GetAggregateSections(aggregate.Modules)); + } + finally + { + Directory.Delete(directory, recursive: true); + } + } + + [TestMethod] + public async Task GitHubFragment_LegacyPayloadWithoutStepSummarySections_DefaultsToAllAsync() + { + string directory = CreateDirectory(); + try + { + GitHubCiRunSummaryModule module = CreateGitHubModule("Legacy"); + string path = await GitHubCiRunSummaryAggregation.WriteFragmentAsync( + directory, + GitHubSummaryPostProcessor.Provider, + GitHubSummaryPostProcessor.ProviderSlug, + module); + + string json = File.ReadAllText(path); + GitHubCiRunSummaryAggregate aggregate = GitHubCiRunSummaryAggregation.ReadAndAggregate( + [CreateGitHubInput(path, module)], + GitHubSummaryPostProcessor.Provider, + new ArtifactPostProcessingContext(ArtifactPostProcessingTruncationReason.None)); + + Assert.DoesNotContain("githubActionsStepSummarySections", json); + Assert.IsNull(aggregate.Modules.Single().GitHubActionsStepSummarySections); + Assert.AreEqual( + GitHubActionsStepSummarySections.All, + GitHubActionsStepSummarySectionsParser.GetAggregateSections(aggregate.Modules)); + } + finally + { + Directory.Delete(directory, recursive: true); + } + } + [TestMethod] public void ProvidersUseDistinctFragmentKinds() { @@ -359,6 +428,28 @@ private static InputArtifact CreateInput(string path, CiRunSummaryModule module) module.Architecture, module.ExecutionId); + private static GitHubCiRunSummaryModule CreateGitHubModule(string assemblyName) + => new() + { + AssemblyName = assemblyName, + ModulePath = Path.Combine(Path.GetTempPath(), assemblyName + ".dll"), + TargetFramework = "net9.0", + Architecture = "x64", + ExecutionId = "execution-" + assemblyName, + SessionUid = "session-" + assemblyName, + AttemptNumber = 1, + ExitCode = 0, + }; + + private static InputArtifact CreateGitHubInput(string path, GitHubCiRunSummaryModule module) + => new( + path, + GitHubSummaryPostProcessor.FragmentArtifactKind, + module.ModulePath, + module.TargetFramework, + module.Architecture, + module.ExecutionId); + private static string CreateDirectory() { string directory = Path.Combine(Path.GetTempPath(), $"ci-summary-aggregation-{Guid.NewGuid():N}"); diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsCommandLineProviderTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsCommandLineProviderTests.cs index 75356a2fef5..6d2f654bbaf 100644 --- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsCommandLineProviderTests.cs +++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsCommandLineProviderTests.cs @@ -19,6 +19,7 @@ public sealed class GitHubActionsCommandLineProviderTests [DataRow(GitHubActionsCommandLineOptions.GitHubActionsGroups)] [DataRow(GitHubActionsCommandLineOptions.GitHubActionsAnnotations)] [DataRow(GitHubActionsCommandLineOptions.GitHubActionsStepSummary)] + [DataRow(GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections)] [DataRow(GitHubActionsCommandLineOptions.GitHubActionsSlowTestNotices)] [DataRow(GitHubActionsCommandLineOptions.GitHubActionsSlowTestThreshold)] public async Task ValidateCommandLineOptionsAsync_ReturnsInvalid_WhenSubOptionIsUsedWithoutReportGhAsync(string subOption) @@ -53,6 +54,19 @@ public async Task ValidateCommandLineOptionsAsync_ReturnsValid_WhenSubOptionIsUs Assert.IsTrue(validationResult.IsValid, validationResult.ErrorMessage); } + [TestMethod] + public async Task ValidateCommandLineOptionsAsync_ReturnsValid_WhenStepSummarySectionsIsUsedWithReportGhAsync() + { + GitHubActionsCommandLineProvider provider = new(); + ValidationResult validationResult = await provider.ValidateCommandLineOptionsAsync(new TestCommandLineOptions(new Dictionary + { + [GitHubActionsCommandLineOptions.GitHubActionsOptionName] = [], + [GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections] = ["test-results"], + })).ConfigureAwait(false); + + Assert.IsTrue(validationResult.IsValid, validationResult.ErrorMessage); + } + [TestMethod] public async Task ValidateOptionArgumentsAsync_ReturnsInvalid_WhenGroupsValueIsNotOnOrOffAsync() { @@ -103,6 +117,91 @@ public async Task ValidateOptionArgumentsAsync_ReturnsInvalid_WhenStepSummaryVal Assert.IsFalse(validationResult.IsValid); } + [TestMethod] + [DataRow("test-results")] + [DataRow("SLOW-TESTS")] + [DataRow("all")] + [DataRow("test-results|slow-tests")] + [DataRow("test-results,slow-tests")] + [DataRow("test-results|TEST-RESULTS")] + public async Task ValidateOptionArgumentsAsync_ReturnsValid_ForStepSummarySectionsAsync(string value) + { + GitHubActionsCommandLineProvider provider = new(); + CommandLineOption option = provider.GetCommandLineOptions().Single(o => o.Name == GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections); + ValidationResult validationResult = await provider.ValidateOptionArgumentsAsync(option, value.Split('|')).ConfigureAwait(false); + + Assert.IsTrue(validationResult.IsValid, validationResult.ErrorMessage); + } + + [TestMethod] + [DataRow("")] + [DataRow(" ")] + [DataRow("test-results,")] + public async Task ValidateOptionArgumentsAsync_ReturnsLocalizedError_WhenStepSummarySectionsIsEmptyAsync(string value) + { + GitHubActionsCommandLineProvider provider = new(); + CommandLineOption option = provider.GetCommandLineOptions().Single(o => o.Name == GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections); + ValidationResult validationResult = await provider.ValidateOptionArgumentsAsync(option, [value]).ConfigureAwait(false); + + Assert.IsFalse(validationResult.IsValid); + Assert.AreEqual(GitHubActionsResources.EmptyStepSummarySections, validationResult.ErrorMessage); + } + + [TestMethod] + [DataRow("unknown", "unknown")] + [DataRow("all|unknown", "unknown")] + [DataRow("test-results,bogus", "bogus")] + public async Task ValidateOptionArgumentsAsync_ReturnsLocalizedError_WhenStepSummarySectionIsUnknownAsync(string value, string invalidValue) + { + GitHubActionsCommandLineProvider provider = new(); + CommandLineOption option = provider.GetCommandLineOptions().Single(o => o.Name == GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections); + ValidationResult validationResult = await provider.ValidateOptionArgumentsAsync(option, value.Split('|')).ConfigureAwait(false); + + Assert.IsFalse(validationResult.IsValid); + Assert.AreEqual( + string.Format(CultureInfo.InvariantCulture, GitHubActionsResources.InvalidStepSummarySection, invalidValue), + validationResult.ErrorMessage); + } + + [TestMethod] + public void TryParseStepSummarySections_IsCaseInsensitiveAndDuplicateSafe() + { + bool parsed = GitHubActionsStepSummarySectionsParser.TryParse( + [" TEST-RESULTS ", "slow-tests,SLOW-TESTS", "test-results"], + out GitHubActionsStepSummarySections sections, + out string? invalidValue, + out bool hasEmptyValue); + + Assert.IsTrue(parsed); + Assert.AreEqual(GitHubActionsStepSummarySections.All, sections); + Assert.IsNull(invalidValue); + Assert.IsFalse(hasEmptyValue); + } + + [TestMethod] + public void TryParseStepSummarySections_RejectsEmptySet() + { + bool parsed = GitHubActionsStepSummarySectionsParser.TryParse( + [], + out GitHubActionsStepSummarySections sections, + out string? invalidValue, + out bool hasEmptyValue); + + Assert.IsFalse(parsed); + Assert.AreEqual(GitHubActionsStepSummarySections.None, sections); + Assert.IsNull(invalidValue); + Assert.IsTrue(hasEmptyValue); + } + + [TestMethod] + public void GetSections_DefaultsToAll_WhenOptionIsAbsent() + { + GitHubActionsStepSummarySections sections = GitHubActionsStepSummarySectionsParser.GetSections( + new TestCommandLineOptions([])); + + Assert.AreEqual(GitHubActionsStepSummarySections.All, sections); + } + [TestMethod] public async Task ValidateOptionArgumentsAsync_ReturnsInvalid_WhenSlowTestNoticesValueIsNotOnOrOffAsync() { diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsSlowTestReporterTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsSlowTestReporterTests.cs index d0195cbf200..c2a91ceb042 100644 --- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsSlowTestReporterTests.cs +++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsSlowTestReporterTests.cs @@ -127,6 +127,24 @@ public async Task ScanOnce_RespectsConfiguredThresholdAsync() Assert.HasCount(1, outputDevice.Lines); } + [TestMethod] + public async Task ScanOnce_StepSummarySelectionDoesNotSuppressNoticesAsync() + { + CapturingOutputDevice outputDevice = new(); + Dictionary options = new(StringComparer.OrdinalIgnoreCase) + { + [GitHubActionsCommandLineOptions.GitHubActionsStepSummarySections] = ["test-results"], + }; + GitHubActionsSlowTestReporter reporter = CreateReporter(outputDevice, githubActions: true, options); + await reporter.OnTestSessionStartingAsync(new TestSessionContextStub()).ConfigureAwait(false); + await reporter.ConsumeAsync(null!, CreateMessage("u1", "Ns.T1", new InProgressTestNodeStateProperty()), CancellationToken.None).ConfigureAwait(false); + + await reporter.ScanOnceAsync(Start + TimeSpan.FromSeconds(90), CancellationToken.None).ConfigureAwait(false); + + Assert.HasCount(1, outputDevice.Lines); + Assert.Contains("::notice title=Slow test%3A Ns.T1", outputDevice.Lines[0]); + } + [TestMethod] public async Task ScanOnce_ParameterizedTests_EmitDistinctLabelsAsync() { diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsSummaryReporterTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsSummaryReporterTests.cs index 247048a4965..854a51aba40 100644 --- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsSummaryReporterTests.cs +++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsSummaryReporterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. extern alias ghactions; @@ -89,6 +89,68 @@ public void BuildMarkdown_EmitsSlowestTestsSortedByDuration() Assert.IsLessThan(fastIndex, slowIndex, markdown); } + [TestMethod] + public void BuildMarkdown_TestResultsOnly_OmitsSlowTestsSection() + { + GitHubActionsTestRecord[] records = + [ + new("Pass", "T.Pass", GitHubActionsTerminalKind.Passed, TimeSpan.FromSeconds(70)), + new("Fail", "T.Fail", GitHubActionsTerminalKind.Failed, TimeSpan.FromSeconds(5)), + ]; + + string markdown = GitHubActionsSummaryReporter.BuildMarkdown( + records, + "T", + "net9.0", + AtLeastOneTestFailedExitCode, + GitHubActionsStepSummarySections.TestResults); + + Assert.Contains("| 2 | 1 | 1 | 0 | 1m 15s |", markdown); + Assert.Contains("### ❌ Failures (1)", markdown); + Assert.Contains("`T.Fail`", markdown); + Assert.DoesNotContain("### ⏱ Slowest tests", markdown); + Assert.DoesNotContain("`T.Pass`", markdown); + } + + [TestMethod] + public void BuildMarkdown_SlowTestsOnly_OmitsTestResultsSection() + { + GitHubActionsTestRecord[] records = + [ + new("Slow", "T.Slow", GitHubActionsTerminalKind.Passed, TimeSpan.FromSeconds(65)), + new("Fail", "T.Fail", GitHubActionsTerminalKind.Failed, TimeSpan.FromSeconds(5)), + ]; + + string markdown = GitHubActionsSummaryReporter.BuildMarkdown( + records, + "T", + "net9.0", + ZeroTestsExitCode, + GitHubActionsStepSummarySections.SlowTests); + + Assert.Contains("## ❌ Test Run Summary — T (net9.0)", markdown); + Assert.Contains("### ⏱ Slowest tests", markdown); + Assert.Contains("`T.Slow` — 1m 05s", markdown); + Assert.DoesNotContain("| Total | Passed | Failed | Skipped | Duration |", markdown); + Assert.DoesNotContain("### ❌ Failures", markdown); + Assert.DoesNotContain("[!WARNING]", markdown); + } + + [TestMethod] + public void BuildMarkdown_DefaultSections_IncludeTestResultsAndSlowTests() + { + GitHubActionsTestRecord[] records = + [ + new("Slow", "T.Slow", GitHubActionsTerminalKind.Passed, TimeSpan.FromSeconds(65)), + ]; + + string markdown = GitHubActionsSummaryReporter.BuildMarkdown(records, "T", "net9.0", SuccessExitCode); + + Assert.Contains("| 1 | 1 | 0 | 0 | 1m 05s |", markdown); + Assert.Contains("### ⏱ Slowest tests", markdown); + Assert.Contains("`T.Slow` — 1m 05s", markdown); + } + [TestMethod] public void BuildMarkdown_NoTests_StillEmitsHeaderAndZeroTotals() { @@ -203,6 +265,45 @@ public void BuildAggregateMarkdown_PartialFailureUsesFailureIconAndDisambiguates Assert.Contains("This summary is partial because the test run was truncated.", markdown); } + [TestMethod] + public void BuildAggregateMarkdown_UnionsSelectionsAcrossModules() + { + GitHubCiRunSummaryModule testResultsModule = CreateAggregateModule( + "TestResults", + ["test-results"], + "TestResults.Slow"); + GitHubCiRunSummaryModule slowTestsModule = CreateAggregateModule( + "SlowTests", + ["slow-tests"], + "SlowTests.Slow"); + GitHubCiRunSummaryAggregate aggregate = CreateAggregate([testResultsModule, slowTestsModule]); + + string markdown = GitHubActionsSummaryReporter.BuildAggregateMarkdown(aggregate); + + Assert.Contains("| Total | Passed | Failed | Skipped | Duration |", markdown); + Assert.Contains("| Total | Passed | Failed | Skipped | Test duration |", markdown); + Assert.Contains("#### ⏱ Slowest tests", markdown); + Assert.Contains("`TestResults.Slow` — 2.00s", markdown); + Assert.Contains("`SlowTests.Slow` — 2.00s", markdown); + } + + [TestMethod] + public void BuildAggregateMarkdown_LegacyModuleWithoutSelection_DefaultsToAll() + { + GitHubCiRunSummaryModule legacyModule = CreateAggregateModule( + "Legacy", + sections: null, + slowTestName: "Legacy.Slow"); + GitHubCiRunSummaryAggregate aggregate = CreateAggregate([legacyModule]); + + string markdown = GitHubActionsSummaryReporter.BuildAggregateMarkdown(aggregate); + + Assert.Contains("| Total | Passed | Failed | Skipped | Duration |", markdown); + Assert.Contains("| Total | Passed | Failed | Skipped | Test duration |", markdown); + Assert.Contains("#### ⏱ Slowest tests", markdown); + Assert.Contains("`Legacy.Slow` — 2.00s", markdown); + } + [TestMethod] public async Task AppendStepSummaryWithRetryAsync_WritesContent_OnFirstAttempt() { @@ -311,6 +412,48 @@ private static Mock CreateFileSystemWritingTo(Stream target) return fileSystem; } + private static GitHubCiRunSummaryModule CreateAggregateModule( + string assemblyName, + string[]? sections, + string slowTestName) + => new() + { + AssemblyName = assemblyName, + ModulePath = $"{assemblyName}.dll", + TargetFramework = "net9.0", + Architecture = "x64", + ExecutionId = $"execution-{assemblyName}", + SessionUid = $"session-{assemblyName}", + AttemptNumber = 1, + ExitCode = SuccessExitCode, + TotalTests = 1, + PassedTests = 1, + TestDurationTicks = TimeSpan.FromSeconds(2).Ticks, + SlowestTests = + [ + new() + { + DisplayName = slowTestName, + FullyQualifiedName = slowTestName, + DurationTicks = TimeSpan.FromSeconds(2).Ticks, + }, + ], + GitHubActionsStepSummarySections = sections, + }; + + private static GitHubCiRunSummaryAggregate CreateAggregate(IReadOnlyList modules) + => new( + modules, + new ArtifactPostProcessingContext(ArtifactPostProcessingTruncationReason.None), + totalTests: modules.Sum(module => module.TotalTests), + passedTests: modules.Sum(module => module.PassedTests), + failedTests: modules.Sum(module => module.FailedTests), + skippedTests: modules.Sum(module => module.SkippedTests), + duration: TimeSpan.FromTicks(modules.Sum(module => module.TestDurationTicks)), + exitCode: SuccessExitCode, + hasAuthoritativeRunSummary: true, + isPartial: false); + // A writable stream that fails on any attempt to write or flush, simulating a mid-write I/O error (e.g. disk full) // after the exclusive append handle has already been acquired. private sealed class ThrowOnWriteStream : Stream