From ab8577d6ecbc89ed750b7ce1c60a9c2c4f29d905 Mon Sep 17 00:00:00 2001 From: Maksim Stepanov <17935127+delatrie@users.noreply.github.com> Date: Fri, 23 Oct 2026 05:47:17 +0400 Subject: [PATCH 1/2] feat(net): introduce global error status --- src/Allure.Net.Commons/AllureApi.cs | 45 ++++++- .../Model/allure2.Designer.cs | 21 ++++ .../Results/FileSystemResultsDestination.cs | 4 + .../Internal/InternalAllureExtensions.cs | 11 ++ src/Allure.Net/Model/GlobalError.cs | 5 + src/Allure.Net/Model/GlobalErrorStatus.cs | 17 +++ .../api/async/AllureApi.Async.Globals.cs | 110 ++++++++++++++++++ .../api/sync/AllureApi.Sync.Globals.cs | 44 +++++++ .../AllureFacadeTests/GlobalTests.cs | 26 +++++ .../FileSystemResultsDestinationTests.cs | 33 ++++-- .../Operations/Globals/AddGlobalErrorTests.cs | 54 ++++++++- 11 files changed, 353 insertions(+), 17 deletions(-) create mode 100644 src/Allure.Net/Model/GlobalErrorStatus.cs diff --git a/src/Allure.Net.Commons/AllureApi.cs b/src/Allure.Net.Commons/AllureApi.cs index 7fa2b675..3477c9da 100644 --- a/src/Allure.Net.Commons/AllureApi.cs +++ b/src/Allure.Net.Commons/AllureApi.cs @@ -602,7 +602,21 @@ public static void AddGlobalAttachment( public static void AddGlobalError(Exception error) => AddGlobalErrorInternal( CreateGlobalError( - ModelFunctions.ToStatusDetails(error) + ModelFunctions.ToStatusDetails(error), + GlobalErrorStatus.Broken + ) + ); + + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error to persist. + /// The status to assign to the error. + public static void AddGlobalError(Exception error, GlobalErrorStatus status) => + AddGlobalErrorInternal( + CreateGlobalError( + ModelFunctions.ToStatusDetails(error), + status ) ); @@ -613,7 +627,21 @@ public static void AddGlobalError(Exception error) => public static void AddGlobalError(string message) => AddGlobalErrorInternal( CreateGlobalError( - new StatusDetails { message = message } + new StatusDetails { message = message }, + GlobalErrorStatus.Broken + ) + ); + + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error message to persist. + /// The status to assign to the error. + public static void AddGlobalError(string message, GlobalErrorStatus status) => + AddGlobalErrorInternal( + CreateGlobalError( + new StatusDetails { message = message }, + status ) ); @@ -622,7 +650,15 @@ public static void AddGlobalError(string message) => /// /// The error details to persist. public static void AddGlobalError(StatusDetails statusDetails) => - AddGlobalErrorInternal(CreateGlobalError(statusDetails)); + AddGlobalErrorInternal(CreateGlobalError(statusDetails, GlobalErrorStatus.Broken)); + + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error details to persist. + /// The status to assign to the error. + public static void AddGlobalError(StatusDetails statusDetails, GlobalErrorStatus status) => + AddGlobalErrorInternal(CreateGlobalError(statusDetails, status)); /// /// Attaches screen diff images to the current fixture, test, or step. @@ -993,7 +1029,7 @@ internal static void AddGlobalErrorInternal(GlobalError error) => } ); - static GlobalError CreateGlobalError(StatusDetails? statusDetails) + static GlobalError CreateGlobalError(StatusDetails? statusDetails, GlobalErrorStatus status) { statusDetails ??= new StatusDetails(); return new GlobalError @@ -1003,6 +1039,7 @@ static GlobalError CreateGlobalError(StatusDetails? statusDetails) flaky = statusDetails.flaky, muted = statusDetails.muted, known = statusDetails.known, + status = status, timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds() }; } diff --git a/src/Allure.Net.Commons/Model/allure2.Designer.cs b/src/Allure.Net.Commons/Model/allure2.Designer.cs index 6248a4d6..2a1c2da1 100644 --- a/src/Allure.Net.Commons/Model/allure2.Designer.cs +++ b/src/Allure.Net.Commons/Model/allure2.Designer.cs @@ -397,6 +397,13 @@ public enum Status skipped, } + public enum GlobalErrorStatus + { + Broken, + + Failed, + } + [System.Diagnostics.DebuggerStepThroughAttribute()] public partial class StatusDetails { @@ -573,9 +580,23 @@ public partial class GlobalError : StatusDetails { #region Private fields + private GlobalErrorStatus _status = GlobalErrorStatus.Broken; private long _timestamp; #endregion + public GlobalErrorStatus status + { + get + { + return this._status; + } + + set + { + this._status = value; + } + } + public long timestamp { get diff --git a/src/Allure.Net.Sdk/Results/FileSystemResultsDestination.cs b/src/Allure.Net.Sdk/Results/FileSystemResultsDestination.cs index e1586733..68d9f2d5 100644 --- a/src/Allure.Net.Sdk/Results/FileSystemResultsDestination.cs +++ b/src/Allure.Net.Sdk/Results/FileSystemResultsDestination.cs @@ -52,6 +52,10 @@ public FileSystemResultsDestination(string directoryPath, bool indentJson) namingPolicy: JsonNamingPolicy.CamelCase, allowIntegerValues: false ), + new JsonStringEnumConverter( + namingPolicy: JsonNamingPolicy.CamelCase, + allowIntegerValues: false + ), }, }; } diff --git a/src/Allure.Net/Internal/InternalAllureExtensions.cs b/src/Allure.Net/Internal/InternalAllureExtensions.cs index d719f6fc..4df0fa20 100644 --- a/src/Allure.Net/Internal/InternalAllureExtensions.cs +++ b/src/Allure.Net/Internal/InternalAllureExtensions.cs @@ -46,6 +46,17 @@ internal GlobalError ToAllureGlobalError() => : exception.GetType().Name, Trace = exception.ToString() }; + + internal GlobalError ToAllureGlobalError(GlobalErrorStatus status) => + new() + { + Status = status, + Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + Message = exception.Message is { Length: >0 } message + ? message + : exception.GetType().Name, + Trace = exception.ToString() + }; } extension (MethodBase method) diff --git a/src/Allure.Net/Model/GlobalError.cs b/src/Allure.Net/Model/GlobalError.cs index 2da9db45..a616a016 100644 --- a/src/Allure.Net/Model/GlobalError.cs +++ b/src/Allure.Net/Model/GlobalError.cs @@ -5,6 +5,11 @@ namespace Allure.Model; /// public sealed class GlobalError : StatusDetails { + /// + /// Gets or sets the classification of the global error. + /// + public GlobalErrorStatus Status { get; set; } = GlobalErrorStatus.Broken; + /// /// Gets or sets the occurrence time as Unix epoch milliseconds. /// diff --git a/src/Allure.Net/Model/GlobalErrorStatus.cs b/src/Allure.Net/Model/GlobalErrorStatus.cs new file mode 100644 index 00000000..7a49cd82 --- /dev/null +++ b/src/Allure.Net/Model/GlobalErrorStatus.cs @@ -0,0 +1,17 @@ +namespace Allure.Model; + +/// +/// Classifies a global error based on whether it was caused by an assertion failure. +/// +public enum GlobalErrorStatus +{ + /// + /// The error was caused by something other than a failed assertion. + /// + Broken, + + /// + /// The error was caused by a failed assertion. + /// + Failed, +} diff --git a/src/Allure.Net/api/async/AllureApi.Async.Globals.cs b/src/Allure.Net/api/async/AllureApi.Async.Globals.cs index 55715e6b..3fa827dc 100644 --- a/src/Allure.Net/api/async/AllureApi.Async.Globals.cs +++ b/src/Allure.Net/api/async/AllureApi.Async.Globals.cs @@ -664,6 +664,33 @@ public static Task AddGlobalErrorAsync(Exception error, CancellationToken cancel cancellationToken: cancellationToken ) ?? Task.CompletedTask; + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error to persist. + /// The status to assign to the error. + public static Task AddGlobalErrorAsync(Exception error, GlobalErrorStatus status) => + AllureRuntimeRouter.ResolveGlobalScope()?.Operations.Async.AddGlobalErrorAsync( + error.ToAllureGlobalError(status), + cancellationToken: default + ) ?? Task.CompletedTask; + + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error to persist. + /// The status to assign to the error. + /// A cancellation token. + public static Task AddGlobalErrorAsync( + Exception error, + GlobalErrorStatus status, + CancellationToken cancellationToken + ) => + AllureRuntimeRouter.ResolveGlobalScope()?.Operations.Async.AddGlobalErrorAsync( + error.ToAllureGlobalError(status), + cancellationToken: cancellationToken + ) ?? Task.CompletedTask; + /// /// Adds a global error not tied to the current fixture, test, or step. /// @@ -693,6 +720,43 @@ public static Task AddGlobalErrorAsync(string message, CancellationToken cancell cancellationToken: cancellationToken ) ?? Task.CompletedTask; + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error message to persist. + /// The status to assign to the error. + public static Task AddGlobalErrorAsync(string message, GlobalErrorStatus status) => + AllureRuntimeRouter.ResolveGlobalScope()?.Operations.Async.AddGlobalErrorAsync( + error: new() + { + Status = status, + Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + Message = message, + }, + cancellationToken: default + ) ?? Task.CompletedTask; + + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error message to persist. + /// The status to assign to the error. + /// A cancellation token. + public static Task AddGlobalErrorAsync( + string message, + GlobalErrorStatus status, + CancellationToken cancellationToken + ) => + AllureRuntimeRouter.ResolveGlobalScope()?.Operations.Async.AddGlobalErrorAsync( + error: new() + { + Status = status, + Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + Message = message, + }, + cancellationToken: cancellationToken + ) ?? Task.CompletedTask; + /// /// Adds a global error not tied to the current fixture, test, or step. /// @@ -733,4 +797,50 @@ CancellationToken cancellationToken }, cancellationToken: cancellationToken ) ?? Task.CompletedTask; + + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error details to persist. + /// The status to assign to the error. + public static Task AddGlobalErrorAsync(StatusDetails statusDetails, GlobalErrorStatus status) => + AllureRuntimeRouter.ResolveGlobalScope()?.Operations.Async.AddGlobalErrorAsync( + error: new() + { + Status = status, + Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + Message = statusDetails.Message, + Trace = statusDetails.Trace, + Flaky = statusDetails.Flaky, + Known = statusDetails.Known, + Muted = statusDetails.Muted, + }, + cancellationToken: default + ) ?? Task.CompletedTask; + + + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error details to persist. + /// The status to assign to the error. + /// A cancellation token. + public static Task AddGlobalErrorAsync( + StatusDetails statusDetails, + GlobalErrorStatus status, + CancellationToken cancellationToken + ) => + AllureRuntimeRouter.ResolveGlobalScope()?.Operations.Async.AddGlobalErrorAsync( + error: new() + { + Status = status, + Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + Message = statusDetails.Message, + Trace = statusDetails.Trace, + Flaky = statusDetails.Flaky, + Known = statusDetails.Known, + Muted = statusDetails.Muted, + }, + cancellationToken: cancellationToken + ) ?? Task.CompletedTask; } diff --git a/src/Allure.Net/api/sync/AllureApi.Sync.Globals.cs b/src/Allure.Net/api/sync/AllureApi.Sync.Globals.cs index 9e52f768..8dda452f 100644 --- a/src/Allure.Net/api/sync/AllureApi.Sync.Globals.cs +++ b/src/Allure.Net/api/sync/AllureApi.Sync.Globals.cs @@ -304,6 +304,16 @@ public static void AddGlobalError(Exception error) => error.ToAllureGlobalError() ); + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error to persist. + /// The status to assign to the error. + public static void AddGlobalError(Exception error, GlobalErrorStatus status) => + AllureRuntimeRouter.ResolveGlobalScope()?.Operations.Sync.AddGlobalError( + error.ToAllureGlobalError(status) + ); + /// /// Adds a global error not tied to the current fixture, test, or step. /// @@ -317,6 +327,21 @@ public static void AddGlobalError(string message) => } ); + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error message to persist. + /// The status to assign to the error. + public static void AddGlobalError(string message, GlobalErrorStatus status) => + AllureRuntimeRouter.ResolveGlobalScope()?.Operations.Sync.AddGlobalError( + new() + { + Status = status, + Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + Message = message, + } + ); + /// /// Adds a global error not tied to the current fixture, test, or step. /// @@ -333,4 +358,23 @@ public static void AddGlobalError(StatusDetails statusDetails) => Muted = statusDetails.Muted, } ); + + /// + /// Adds a global error not tied to the current fixture, test, or step. + /// + /// The error details to persist. + /// The status to assign to the error. + public static void AddGlobalError(StatusDetails statusDetails, GlobalErrorStatus status) => + AllureRuntimeRouter.ResolveGlobalScope()?.Operations.Sync.AddGlobalError( + new() + { + Status = status, + Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + Message = statusDetails.Message, + Trace = statusDetails.Trace, + Flaky = statusDetails.Flaky, + Known = statusDetails.Known, + Muted = statusDetails.Muted, + } + ); } diff --git a/tests/Allure.Net.Commons.Tests/UserAPITests/AllureFacadeTests/GlobalTests.cs b/tests/Allure.Net.Commons.Tests/UserAPITests/AllureFacadeTests/GlobalTests.cs index 06172b3f..dd478160 100644 --- a/tests/Allure.Net.Commons.Tests/UserAPITests/AllureFacadeTests/GlobalTests.cs +++ b/tests/Allure.Net.Commons.Tests/UserAPITests/AllureFacadeTests/GlobalTests.cs @@ -133,6 +133,32 @@ public void GlobalApisWorkWithoutActiveTestContext() Assert.That(this.writer.Globals, Has.Count.EqualTo(2)); } + [Test] + public void StatusOverloadsAllowProvidingStatus() + { + AllureApi.AddGlobalError("", GlobalErrorStatus.Failed); + AllureApi.AddGlobalError(new Exception(), GlobalErrorStatus.Failed); + AllureApi.AddGlobalError(new StatusDetails(), GlobalErrorStatus.Failed); + + Assert.That( + this.writer.Globals.Select(static (global) => global.errors[0].status), + Is.EqualTo([GlobalErrorStatus.Failed, GlobalErrorStatus.Failed, GlobalErrorStatus.Failed]) + ); + } + + [Test] + public void StatusDefaultsToBroken() + { + AllureApi.AddGlobalError(""); + AllureApi.AddGlobalError(new Exception()); + AllureApi.AddGlobalError(new StatusDetails()); + + Assert.That( + this.writer.Globals.Select(static (global) => global.errors[0].status), + Is.EqualTo([GlobalErrorStatus.Broken, GlobalErrorStatus.Broken, GlobalErrorStatus.Broken]) + ); + } + [Test] public void GlobalApisDoNotMutateCurrentTestAttachments() { diff --git a/tests/Allure.Net.Sdk.Tests/Results/FileSystemResultsDestinationTests.cs b/tests/Allure.Net.Sdk.Tests/Results/FileSystemResultsDestinationTests.cs index b01218f9..e008055f 100644 --- a/tests/Allure.Net.Sdk.Tests/Results/FileSystemResultsDestinationTests.cs +++ b/tests/Allure.Net.Sdk.Tests/Results/FileSystemResultsDestinationTests.cs @@ -15,7 +15,7 @@ public async Task ShouldWriteTestResult() await VerifyObjectWrite( "-result.json", - result.Uuid, + (e) => e.GetProperty("uuid").ToString() == result.Uuid, (destination) => destination.WriteTestResult(result) ); } @@ -27,7 +27,7 @@ public async Task ShouldWriteTestResultAsync() await VerifyObjectWriteAsync( "-result.json", - result.Uuid, + (e) => e.GetProperty("uuid").ToString() == result.Uuid, (destination, token) => destination.WriteTestResultAsync(result, token) ); } @@ -40,7 +40,7 @@ public async Task ShouldWriteContainer() await VerifyObjectWrite( "-container.json", - container.Uuid, + (e) => e.GetProperty("uuid").ToString() == container.Uuid, (destination) => destination.WriteContainer(container) ); } @@ -53,7 +53,7 @@ public async Task ShouldWriteContainerAsync() await VerifyObjectWriteAsync( "-container.json", - container.Uuid, + (e) => e.GetProperty("uuid").ToString() == container.Uuid, (destination, token) => destination.WriteContainerAsync(container, token) ); } @@ -63,7 +63,7 @@ public async Task ShouldWriteGlobals() { await VerifyObjectWrite( "-globals.json", - "global error", + AssertGlobal, (destination) => destination.WriteGlobals(NewGlobals()) ); } @@ -73,7 +73,7 @@ public async Task ShouldWriteGlobalsAsync() { await VerifyObjectWriteAsync( "-globals.json", - "global error", + AssertGlobal, (destination, token) => destination.WriteGlobalsAsync(NewGlobals(), token) ); } @@ -363,7 +363,7 @@ await File.ReadAllBytesAsync(attachmentFilePath) static async Task VerifyObjectWrite( string suffix, - string expectedContent, + Func assertObject, Action write ) { @@ -374,7 +374,7 @@ Action write write(new FileSystemResultsDestination(directory, false)); - await VerifyWrittenFile(directory, suffix, expectedContent); + await VerifyWrittenFile(directory, suffix, assertObject); } finally { @@ -384,7 +384,7 @@ Action write static async Task VerifyObjectWriteAsync( string suffix, - string expectedContent, + Func assertObject, Func write ) { @@ -398,7 +398,7 @@ await write( CancellationToken.None ); - await VerifyWrittenFile(directory, suffix, expectedContent); + await VerifyWrittenFile(directory, suffix, assertObject); } finally { @@ -409,7 +409,7 @@ await write( static async Task VerifyWrittenFile( string directory, string suffix, - string expectedContent + Func assertObject ) { await Assert.That(Directory.Exists(directory)).IsTrue(); @@ -421,8 +421,8 @@ await Assert.That(Regex.IsMatch( var json = await File.ReadAllTextAsync(file); using var document = JsonDocument.Parse(json); - await Assert.That(json).Contains(expectedContent); await Assert.That(document.RootElement.ValueKind).IsEqualTo(JsonValueKind.Object); + await Assert.That(document.RootElement).Satisfies(assertObject); } static AllureTestResult NewTestResult(string name = "result name") => @@ -487,4 +487,13 @@ static bool IsValidJson(string content) return false; } } + + static bool AssertGlobal(JsonElement element) + { + var error = element.GetProperty("errors")[0]; + var message = error.GetProperty("message").GetString(); + var status = error.GetProperty("status").GetString(); + + return message == "global error" && status == "broken"; + } } diff --git a/tests/Allure.Net.Tests/Api/Operations/Globals/AddGlobalErrorTests.cs b/tests/Allure.Net.Tests/Api/Operations/Globals/AddGlobalErrorTests.cs index 3ded6b73..99849dce 100644 --- a/tests/Allure.Net.Tests/Api/Operations/Globals/AddGlobalErrorTests.cs +++ b/tests/Allure.Net.Tests/Api/Operations/Globals/AddGlobalErrorTests.cs @@ -1,4 +1,3 @@ -using Allure.Abstractions; using Allure.Model; using TUnit.Mocks.Assertions; @@ -419,4 +418,57 @@ public async Task AddGlobalErrorStatusDetailsAsyncWithTokenDoesNotThrowWithoutEn await AllureApi.AddGlobalErrorAsync(error, CancellationToken.None); } + [Test] + public async Task StatuslessOverloadsSetStatusToBroken() + { + var error = new InvalidOperationException("exception message"); + using var endpoint = InstallEndpoint(InstallationScope.Global); + + AllureApi.AddGlobalError(""); + AllureApi.AddGlobalError(new StatusDetails { Message = "" }); + AllureApi.AddGlobalError(new Exception()); + await AllureApi.AddGlobalErrorAsync(""); + await AllureApi.AddGlobalErrorAsync(new StatusDetails { Message = "" }); + await AllureApi.AddGlobalErrorAsync(new Exception()); + await AllureApi.AddGlobalErrorAsync("", CancellationToken.None); + await AllureApi.AddGlobalErrorAsync(new StatusDetails { Message = "" }, CancellationToken.None); + await AllureApi.AddGlobalErrorAsync(new Exception(), CancellationToken.None); + + await Assert.That(endpoint.SyncApi.AddGlobalError( + (value) => value is { Status: GlobalErrorStatus.Broken } + )).WasCalled(Times.Exactly(3)); + endpoint.SyncApi.VerifyNoOtherCalls(); + await Assert.That(endpoint.AsyncApi.AddGlobalErrorAsync( + (value) => value is { Status: GlobalErrorStatus.Broken }, + CancellationToken.None + )).WasCalled(Times.Exactly(6)); + endpoint.SyncApi.VerifyNoOtherCalls(); + } + + [Test] + public async Task StatusOverloadsSetStatusToProvidedValue() + { + var error = new InvalidOperationException("exception message"); + using var endpoint = InstallEndpoint(InstallationScope.Global); + + AllureApi.AddGlobalError("", GlobalErrorStatus.Failed); + AllureApi.AddGlobalError(new StatusDetails { Message = "" }, GlobalErrorStatus.Failed); + AllureApi.AddGlobalError(new Exception(), GlobalErrorStatus.Failed); + await AllureApi.AddGlobalErrorAsync("", GlobalErrorStatus.Failed); + await AllureApi.AddGlobalErrorAsync(new StatusDetails { Message = "" }, GlobalErrorStatus.Failed); + await AllureApi.AddGlobalErrorAsync(new Exception(), GlobalErrorStatus.Failed); + await AllureApi.AddGlobalErrorAsync("", GlobalErrorStatus.Failed, CancellationToken.None); + await AllureApi.AddGlobalErrorAsync(new StatusDetails { Message = "" }, GlobalErrorStatus.Failed, CancellationToken.None); + await AllureApi.AddGlobalErrorAsync(new Exception(), GlobalErrorStatus.Failed, CancellationToken.None); + + await Assert.That(endpoint.SyncApi.AddGlobalError( + (value) => value is { Status: GlobalErrorStatus.Failed } + )).WasCalled(Times.Exactly(3)); + endpoint.SyncApi.VerifyNoOtherCalls(); + await Assert.That(endpoint.AsyncApi.AddGlobalErrorAsync( + (value) => value is { Status: GlobalErrorStatus.Failed }, + CancellationToken.None + )).WasCalled(Times.Exactly(6)); + endpoint.SyncApi.VerifyNoOtherCalls(); + } } From e964bc034bb2d2b44b83edf349e5994d514a8874 Mon Sep 17 00:00:00 2001 From: Maksim Stepanov <17935127+delatrie@users.noreply.github.com> Date: Fri, 23 Oct 2026 05:54:52 +0400 Subject: [PATCH 2/2] test(xunit.v3): add watchdog error status assertion --- .../Assertions/Model/AllureGlobalError.cs | 1 + .../Lifecycle/WatchdogTests.cs | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/Allure.Testing/Assertions/Model/AllureGlobalError.cs b/tests/Allure.Testing/Assertions/Model/AllureGlobalError.cs index 90f5fe52..3eb082dd 100644 --- a/tests/Allure.Testing/Assertions/Model/AllureGlobalError.cs +++ b/tests/Allure.Testing/Assertions/Model/AllureGlobalError.cs @@ -4,6 +4,7 @@ namespace Allure.Testing.Assertions.Model; public readonly record struct AllureGlobalError(JsonElement Json) : + IAllureStatusProperty, IAllureStatusDetails, IAllureTimestampProperty { diff --git a/tests/Allure.Xunit.v3.Tests/Lifecycle/WatchdogTests.cs b/tests/Allure.Xunit.v3.Tests/Lifecycle/WatchdogTests.cs index 9bc6f82a..45e2e26a 100644 --- a/tests/Allure.Xunit.v3.Tests/Lifecycle/WatchdogTests.cs +++ b/tests/Allure.Xunit.v3.Tests/Lifecycle/WatchdogTests.cs @@ -1,4 +1,5 @@ using Allure.Testing; +using Allure.Testing.Assertions.Model; namespace Allure.Xunit.v3.Tests.Lifecycle; @@ -14,11 +15,12 @@ public async Task ShouldRecordGlobalErrorWhenTestProcessCrashes(CancellationToke await Assert.That(results) .HasSingleGlobals() - .With.SingleError((error) => error.HasMessage((message) => - message - .Contains("Test host application process") - .And.Contains("(PID=") - .And.Contains("has crashed") - .And.Contains("Exit code:"))); + .With.SingleError((error) => + error.HasMessage((message) => + message.Contains("Test host application process") + .And.Contains("(PID=") + .And.Contains("has crashed") + .And.Contains("Exit code:")) + .And.HasStatus(AllureStatus.Broken)); } }