devlooped / dotnet-trx

Pretty-print test results from trx files
MIT License
33 stars 1 forks source link

Exit code should match success/failure status #24

Closed kzu closed 2 months ago

kzu commented 2 months ago

This makes it easier to use it to stop CI steps, without having to re-calculate overall test results status.

In CI, continue-on-error can be set to true if trx is run as a separate step.

The backwards compatibility option --no-exit-code can be used to ignore failures and always return success/0.

This also means you can safely chain calls to dotnet test without losing the status code result, such as:

dotnet test -l trx || trx

this would result in a trx report only if dotnet-test failed, and preserve the failure after trx issues the report.

devlooped-bot commented 2 months ago

3 failed 5 passed 3 failed 2 skipped 3 failed 5 passed 3 failed 2 skipped 2 failed 6 passed 2 failed 2 skipped

:test_tube: Details on macOS Unix 14.5.0
:x: Demo.Tests.Fails_With_Complex_StackTrace > ```csharp > at Demo.Tests.Unexpected() in /_/src/Demo/Tests.cs:line 49 > at Demo.Tests.Run() in /_/src/Demo/Tests.cs:line 47 > at Demo.Tests.b__6_0() in /_/src/Demo/Tests.cs:line 36 > at Demo.Tests.Fails_With_Complex_StackTrace() in /_/src/Demo/Tests.cs:line 38 > ```
:x: Demo.Tests.Fails_With_Output > ```csharp > at Demo.Tests.Fails_With_Output() in /_/src/Demo/Tests.cs:line 30 > ``` > > It was going so well... > > Yet you never know > > Which is why you sprinkle all these WriteLines :eyes:
:x: Demo.Tests.FailsOnlyOnUnix > ```csharp > at Demo.Tests.FailsOnlyOnUnix() in /_/src/Demo/Tests.cs:line 45 > ```
:white_check_mark: Demo.Tests.Parameterized(culture: "de") :white_check_mark: Demo.Tests.Parameterized(culture: "en") :white_check_mark: Demo.Tests.Parameterized(culture: "es") :white_check_mark: Demo.Tests.Parameterized(culture: "fr") :grey_question: Demo.Tests.Skipped_Test_Does_Not_Run => Shouldn't run for now :)
:white_check_mark: Demo.Tests.Test_With_Output > > Hello, world from xunit ITestOutputHelper!
:grey_question: Demo.Tests.WindowsOnlyTest => Test only runs on Win32NT
:test_tube: Details on Ubuntu 22.04.4 LTS
:x: Demo.Tests.Fails_With_Complex_StackTrace > ```csharp > at Demo.Tests.Unexpected() in /_/src/Demo/Tests.cs:line 49 > at Demo.Tests.Run() in /_/src/Demo/Tests.cs:line 47 > at Demo.Tests.b__6_0() in /_/src/Demo/Tests.cs:line 36 > at Demo.Tests.Fails_With_Complex_StackTrace() in /_/src/Demo/Tests.cs:line 38 > ```
:x: Demo.Tests.Fails_With_Output > ```csharp > at Demo.Tests.Fails_With_Output() in /_/src/Demo/Tests.cs:line 30 > ``` > > It was going so well... > > Yet you never know > > Which is why you sprinkle all these WriteLines :eyes:
:x: Demo.Tests.FailsOnlyOnUnix > ```csharp > at Demo.Tests.FailsOnlyOnUnix() in /_/src/Demo/Tests.cs:line 45 > ```
:white_check_mark: Demo.Tests.Parameterized(culture: "de") :white_check_mark: Demo.Tests.Parameterized(culture: "en") :white_check_mark: Demo.Tests.Parameterized(culture: "es") :white_check_mark: Demo.Tests.Parameterized(culture: "fr") :grey_question: Demo.Tests.Skipped_Test_Does_Not_Run => Shouldn't run for now :)
:white_check_mark: Demo.Tests.Test_With_Output > > Hello, world from xunit ITestOutputHelper!
:grey_question: Demo.Tests.WindowsOnlyTest => Test only runs on Win32NT
:test_tube: Details on Microsoft Windows 10.0.20348
:x: Demo.Tests.Fails_With_Complex_StackTrace > ```csharp > at Demo.Tests.Unexpected() in /_/src/Demo/Tests.cs:line 49 > at Demo.Tests.Run() in /_/src/Demo/Tests.cs:line 47 > at Demo.Tests.b__6_0() in /_/src/Demo/Tests.cs:line 36 > at Demo.Tests.Fails_With_Complex_StackTrace() in /_/src/Demo/Tests.cs:line 38 > ```
:x: Demo.Tests.Fails_With_Output > ```csharp > at Demo.Tests.Fails_With_Output() in /_/src/Demo/Tests.cs:line 30 > ``` > > It was going so well... > > Yet you never know > > Which is why you sprinkle all these WriteLines :eyes:
:grey_question: Demo.Tests.FailsOnlyOnUnix => Test only runs on Unix :white_check_mark: Demo.Tests.Parameterized(culture: "de") :white_check_mark: Demo.Tests.Parameterized(culture: "en") :white_check_mark: Demo.Tests.Parameterized(culture: "es") :white_check_mark: Demo.Tests.Parameterized(culture: "fr") :grey_question: Demo.Tests.Skipped_Test_Does_Not_Run => Shouldn't run for now :)
:white_check_mark: Demo.Tests.Test_With_Output > > Hello, world from xunit ITestOutputHelper!
:white_check_mark: Demo.Tests.WindowsOnlyTest > > This test runs only on Windows

from dotnet-trx on .NET 8.0.6 with :purple_heart: