diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsAnnotationReporter.cs b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsAnnotationReporter.cs index 5a003fcd65..bad0de6b3e 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsAnnotationReporter.cs +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsAnnotationReporter.cs @@ -15,7 +15,8 @@ namespace Microsoft.Testing.Extensions.GitHubActionsReport; /// /// Emits a GitHub Actions ::error workflow command for each failing test so the failure surfaces /// both in the workflow run's Annotations tab and, when the source location can be resolved, on the -/// pull request's "Files changed" diff gutter. +/// pull request's "Files changed" diff gutter. Skipped tests are surfaced as title-only ::warning +/// workflow commands so they are visible in the Annotations tab too. /// internal sealed class GitHubActionsAnnotationReporter : IDataConsumer, @@ -87,6 +88,14 @@ public async Task ConsumeAsync(IDataProducer dataProducer, IData value, Cancella if (failure is null) { + // Skipped tests carry no exception (and therefore no source location); surface them as a + // title-only '::warning' so intentionally or unexpectedly skipped tests are visible in the + // workflow Annotations tab alongside failures, rather than being silently absent. + if (nodeState is SkippedTestNodeStateProperty skipped) + { + await WriteSkippedAnnotationAsync(GetTestName(nodeUpdateMessage.TestNode), skipped.Explanation, cancellationToken).ConfigureAwait(false); + } + return; } @@ -155,6 +164,39 @@ private async Task WriteAnnotationAsync(string testName, string? explanation, Ex GitHubActionsEscaper.EscapeData(message)); } + private async Task WriteSkippedAnnotationAsync(string testName, string? explanation, CancellationToken cancellationToken) + { + if (_logger.IsEnabled(LogLevel.Trace)) + { + _logger.LogTrace("Skip received."); + } + + string line = GetSkippedAnnotation(testName, explanation); + + if (_logger.IsEnabled(LogLevel.Trace)) + { + _logger.LogTrace($"Showing skip annotation '{line}'."); + } + + // Prepend a newline for the same reason as the failure annotation: it guarantees the '::warning' + // workflow command starts at column 0 on its own line so GitHub recognizes it. + await _outputDisplay.DisplayAsync(this, new FormattedTextOutputDeviceData($"\n{line}"), cancellationToken).ConfigureAwait(false); + } + + internal static /* for testing */ string GetSkippedAnnotation(string testName, string? explanation) + { + string message = explanation ?? GitHubActionsResources.NoSkipReasonFallback; + string title = string.Format(CultureInfo.InvariantCulture, GitHubActionsResources.SkippedAnnotationTitle, testName); + + // Skipped nodes never carry a stack trace, so there is no file/line to pin the annotation to; a + // title-only '::warning' still surfaces in the workflow Annotations tab. + return string.Format( + CultureInfo.InvariantCulture, + "::warning title={0}::{1}", + GitHubActionsEscaper.EscapeProperty(title), + GitHubActionsEscaper.EscapeData(message)); + } + private static string GetTestName(TestNode testNode) => TestNodeIdentity.GetTestName(testNode); diff --git a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/PACKAGE.md b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/PACKAGE.md index 0d674a4040..850cb292f9 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/PACKAGE.md +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/PACKAGE.md @@ -15,7 +15,7 @@ dotnet add package Microsoft.Testing.Extensions.GitHubActionsReport 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 +- **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 title-only `::warning` annotations so they are visible in the Annotations tab too - **Job summary**: appends 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 - **Slow-test notices**: emits a `::notice` workflow command for any test still running past a threshold (default 60 seconds) @@ -25,7 +25,7 @@ The extension activates when the test run is on GitHub Actions (`GITHUB_ACTIONS= |---|---|---| | `--report-gh` | Master switch that turns the extension on (required, in addition to running on GitHub Actions) | off | | `--report-gh-groups on\|off` | Per-assembly log groups | on | -| `--report-gh-annotations on\|off` | Failure annotations | on | +| `--report-gh-annotations on\|off` | Failure and skip annotations | on | | `--report-gh-step-summary on\|off` | Markdown job summary | on | | `--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 ec65d7cb29..f7a0470da3 100644 --- a/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/GitHubActionsResources.resx +++ b/src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/Resources/GitHubActionsResources.resx @@ -62,16 +62,23 @@ GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} Test failed: {0} {0} is the fully qualified test name. + + Test skipped: {0} + {0} is the fully qualified test name. + The test failed without providing a failure message. + + The test was skipped without providing a reason. + 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"} 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 432611fc10..b59ffad7c8 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 e320897cc8..99a1166eec 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 2b3c00a7b6..f3230be497 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 dbf86ae3f1..a01f39307c 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 35d93329b2..5ec842daec 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 7e70cb7cb2..88743b8039 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 c696cb06d0..bd28627b3e 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 0d44ee2503..5eaf4ac183 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 5f1dab9dda..23ad765bee 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 f3b69bb488..aabe314874 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 83525819c6..dbf34ec071 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 395751aa81..5c61cd059d 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} 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 257c67e094..12a6e5749e 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 @@ -8,8 +8,8 @@ {0} is the fully qualified test name. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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"} @@ -47,11 +47,21 @@ The test failed without providing a failure message. + + The test was skipped without providing a reason. + The test was skipped without providing a reason. + + Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. + + Test skipped: {0} + Test skipped: {0} + {0} is the fully qualified test name. + Slow test: {0} Slow test: {0} diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs index f28ac9cdd0..e42fb50933 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs @@ -184,7 +184,7 @@ Enable generating a CTRF (Common Test Report Format) JSON report --report-gh Enable GitHub Actions report generator to emit workflow commands so test runs produce a first-class experience on GitHub Actions. --report-gh-annotations - Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Enable or disable GitHub Actions annotations for failed and skipped tests. 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-groups Enable or disable per-assembly log groups. 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-slow-test-notices @@ -558,7 +558,7 @@ The file makes it possible to identify the tests that were running at the time o --report-gh-annotations Arity: 1 Hidden: False - Description: Enable or disable GitHub Actions failure annotations. Valid values are 'on' (also accepts 'true', 'enable', '1') or 'off' (also accepts 'false', 'disable', '0'). Defaults to 'on' when running on GitHub Actions. + Description: Enable or disable GitHub Actions annotations for failed and skipped tests. 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-groups Arity: 1 Hidden: False diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsAnnotationReporterTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsAnnotationReporterTests.cs index 4aeddaa797..fccbd56e12 100644 --- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsAnnotationReporterTests.cs +++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/GitHubActionsAnnotationReporterTests.cs @@ -87,6 +87,22 @@ public void GetErrorAnnotation_UsesFallbackMessage_WhenNoExplanationOrException( Assert.IsTrue(text.StartsWith("::error title=Test failed%3A MyNamespace.MyTest::", StringComparison.Ordinal), text); } + [TestMethod] + public void GetSkippedAnnotation_EmitsTitleOnlyWarningWithReasonAndEscaping() + { + string text = GitHubActionsAnnotationReporter.GetSkippedAnnotation("MyNamespace.MyTest", "not today\nmaybe\rlater"); + + Assert.AreEqual("::warning title=Test skipped%3A MyNamespace.MyTest::not today%0Amaybe%0Dlater", text); + } + + [TestMethod] + public void GetSkippedAnnotation_FallsBackToDefaultReason_WhenNoExplanation() + { + string text = GitHubActionsAnnotationReporter.GetSkippedAnnotation("MyNamespace.MyTest", explanation: null); + + Assert.AreEqual("::warning title=Test skipped%3A MyNamespace.MyTest::The test was skipped without providing a reason.", text); + } + // Throws (and catches) an exception, reporting the exact line of the throw statement so tests can assert the // resolved line without hard-coding a physical number that shifts whenever code above changes. private static Exception CaptureException(string message, out int throwLine)