diff --git a/src/Tests/Tests/Framework/EndpointTests/ApiIntegrationTestBase.cs b/src/Tests/Tests/Framework/EndpointTests/ApiIntegrationTestBase.cs index 4714e3fdbe7..35454e88a23 100644 --- a/src/Tests/Tests/Framework/EndpointTests/ApiIntegrationTestBase.cs +++ b/src/Tests/Tests/Framework/EndpointTests/ApiIntegrationTestBase.cs @@ -6,6 +6,7 @@ using Elastic.Xunit.XunitPlumbing; using Elasticsearch.Net; using FluentAssertions; +using FluentAssertions.Execution; using Nest; using Tests.Core.Client; using Tests.Core.Extensions; @@ -53,7 +54,20 @@ protected override Task AssertOnAllResponses(Action assert) return; } - assert(r); + using (var scope = new AssertionScope()) + { + assert(r); + var failures = scope.Discard(); + if (failures.Length <= 0) return; + + var failure = failures[0]; + scope.AddReportable("Failure", failure); + scope.AddReportable("DebugInformation", r.DebugInformation); + scope.FailWith( $@"{{Failure}} +Response Under Test: +{{DebugInformation}}"); + + } }); } } diff --git a/src/Tests/Tests/Search/Request/FieldsUsageTests.cs b/src/Tests/Tests/Search/Request/FieldsUsageTests.cs index fecf355e849..6f6023bc1a5 100644 --- a/src/Tests/Tests/Search/Request/FieldsUsageTests.cs +++ b/src/Tests/Tests/Search/Request/FieldsUsageTests.cs @@ -60,7 +60,6 @@ [I] protected Task FieldsAreReturned() => this.AssertOnAllResponses(r => var name = fieldValues.Value(Field(p => p.Name)); name.Should().NotBeNullOrWhiteSpace(); - var commits = fieldValues.ValueOf(p => p.NumberOfCommits); commits.Should().BeGreaterThan(0);