From 647815583607e946103aef8ab1f566da3066a5ba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 17:03:06 +0000 Subject: [PATCH 1/4] Initial plan From 8f91a0d5530a2416fc6674b3b9f6faeff02662b1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 17:09:33 +0000 Subject: [PATCH 2/4] Avoid counting duplicate server telemetry results Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com> --- .../PerRequestServerDataConsumerService.cs | 5 ++ .../ServerDataConsumerServiceTests.cs | 46 ++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/PerRequestServerDataConsumerService.cs b/src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/PerRequestServerDataConsumerService.cs index fe89730a84..b0b884797e 100644 --- a/src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/PerRequestServerDataConsumerService.cs +++ b/src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/PerRequestServerDataConsumerService.cs @@ -243,6 +243,11 @@ private void AddOrUpdateTestNodeStateStatistics(TestNodeUid testNodeUid, bool ha return; } + if (existingStatistics.HasPassed == hasPassed) + { + return; + } + if (hasPassed) { existingStatistics.TotalPassedRetries++; diff --git a/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs index 8fe8ab2684..41cbfaed35 100644 --- a/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs +++ b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs @@ -133,7 +133,7 @@ public void PopulateTestNodeStatistics_WithDuplicatePassedEvents() Assert.AreEqual(0, statistics.TotalDiscoveredTests); Assert.AreEqual(1, statistics.TotalPassedTests); Assert.AreEqual(0, statistics.TotalFailedTests); - Assert.AreEqual(1, statistics.TotalPassedRetries); + Assert.AreEqual(0, statistics.TotalPassedRetries); Assert.AreEqual(0, statistics.TotalFailedRetries); } @@ -161,6 +161,50 @@ public void PopulateTestNodeStatistics_WithEventsForSameUid() Assert.AreEqual(0, statistics.TotalFailedRetries); } + [TestMethod] + public void PopulateTestNodeStatistics_WithDuplicateFailedEvents() + { + PropertyBag properties = new( + new FailedTestNodeStateProperty("failed")); + + TestNodeUpdateMessage testNode = new(new SessionUid("1"), new TestNode { Uid = new TestNodeUid("test()"), DisplayName = string.Empty, Properties = properties }); + + _service.PopulateTestNodeStatistics(testNode); + _service.PopulateTestNodeStatistics(testNode); + + TestNodeStatistics statistics = _service.GetTestNodeStatistics(); + Assert.AreEqual(0, statistics.TotalDiscoveredTests); + Assert.AreEqual(0, statistics.TotalPassedTests); + Assert.AreEqual(1, statistics.TotalFailedTests); + Assert.AreEqual(0, statistics.TotalPassedRetries); + Assert.AreEqual(0, statistics.TotalFailedRetries); + } + + [TestMethod] + public void PopulateTestNodeStatistics_WithDuplicateEventAfterOutcomeChange() + { + PropertyBag failedProperties = new( + new FailedTestNodeStateProperty("failed")); + + TestNodeUpdateMessage failedTestNode = new(new SessionUid("1"), new TestNode { Uid = new TestNodeUid("test()"), DisplayName = string.Empty, Properties = failedProperties }); + + PropertyBag passedProperties = new( + PassedTestNodeStateProperty.CachedInstance); + + TestNodeUpdateMessage passedTestNode = new(new SessionUid("1"), new TestNode { Uid = new TestNodeUid("test()"), DisplayName = string.Empty, Properties = passedProperties }); + + _service.PopulateTestNodeStatistics(failedTestNode); + _service.PopulateTestNodeStatistics(passedTestNode); + _service.PopulateTestNodeStatistics(passedTestNode); + + TestNodeStatistics statistics = _service.GetTestNodeStatistics(); + Assert.AreEqual(0, statistics.TotalDiscoveredTests); + Assert.AreEqual(1, statistics.TotalPassedTests); + Assert.AreEqual(0, statistics.TotalFailedTests); + Assert.AreEqual(1, statistics.TotalPassedRetries); + Assert.AreEqual(0, statistics.TotalFailedRetries); + } + [TestMethod] public void PopulateTestNodeStatistics_WithEventsForDifferentUids() { From ebb5b5abe8d2bb9b3490e7cc7289d2a000843a99 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 17:10:30 +0000 Subject: [PATCH 3/4] Clarify server telemetry duplicate-result tests Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com> --- .../ServerMode/ServerDataConsumerServiceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs index 41cbfaed35..cb13978ec0 100644 --- a/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs +++ b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs @@ -138,7 +138,7 @@ public void PopulateTestNodeStatistics_WithDuplicatePassedEvents() } [TestMethod] - public void PopulateTestNodeStatistics_WithEventsForSameUid() + public void PopulateTestNodeStatistics_WithOutcomeChangeForSameUid() { PropertyBag properties = new( new FailedTestNodeStateProperty("failed")); @@ -148,7 +148,7 @@ public void PopulateTestNodeStatistics_WithEventsForSameUid() PropertyBag otherProperties = new( PassedTestNodeStateProperty.CachedInstance); - TestNodeUpdateMessage otherTestNode = new(new SessionUid(string.Empty), new TestNode { Uid = new TestNodeUid("test()"), DisplayName = string.Empty, Properties = otherProperties }); + TestNodeUpdateMessage otherTestNode = new(new SessionUid("2"), new TestNode { Uid = new TestNodeUid("test()"), DisplayName = string.Empty, Properties = otherProperties }); _service.PopulateTestNodeStatistics(testNode); _service.PopulateTestNodeStatistics(otherTestNode); From ce10af071e2a889ef771c1fa65dd1798c5b478be Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 17:11:22 +0000 Subject: [PATCH 4/4] Rename duplicate-result telemetry tests Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com> --- .../ServerMode/ServerDataConsumerServiceTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs index cb13978ec0..46ac014e89 100644 --- a/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs +++ b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/ServerDataConsumerServiceTests.cs @@ -138,7 +138,7 @@ public void PopulateTestNodeStatistics_WithDuplicatePassedEvents() } [TestMethod] - public void PopulateTestNodeStatistics_WithOutcomeChangeForSameUid() + public void PopulateTestNodeStatistics_WithOutcomeChangeForSameUid_CountsAsRetry() { PropertyBag properties = new( new FailedTestNodeStateProperty("failed")); @@ -162,7 +162,7 @@ public void PopulateTestNodeStatistics_WithOutcomeChangeForSameUid() } [TestMethod] - public void PopulateTestNodeStatistics_WithDuplicateFailedEvents() + public void PopulateTestNodeStatistics_WithDuplicateFailedEvents_DoesNotCountAsRetry() { PropertyBag properties = new( new FailedTestNodeStateProperty("failed")); @@ -181,7 +181,7 @@ public void PopulateTestNodeStatistics_WithDuplicateFailedEvents() } [TestMethod] - public void PopulateTestNodeStatistics_WithDuplicateEventAfterOutcomeChange() + public void PopulateTestNodeStatistics_WithDuplicateEventAfterOutcomeChange_OnlyCountsFirstRetry() { PropertyBag failedProperties = new( new FailedTestNodeStateProperty("failed"));