Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,6 @@ private void AddOrUpdateTestNodeStateStatistics(TestNodeUid testNodeUid, bool ha
return;
}

if (existingStatistics.HasPassed == hasPassed)
{
return;
}

if (hasPassed)
{
existingStatistics.TotalPassedRetries++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ public void PopulateTestNodeStatistics_WithDuplicatePassedEvents()
Assert.AreEqual(0, statistics.TotalDiscoveredTests);
Assert.AreEqual(1, statistics.TotalPassedTests);
Assert.AreEqual(0, statistics.TotalFailedTests);
Assert.AreEqual(0, statistics.TotalPassedRetries);
Assert.AreEqual(1, statistics.TotalPassedRetries);
Assert.AreEqual(0, statistics.TotalFailedRetries);
}
Comment thread
Evangelink marked this conversation as resolved.

[TestMethod]
public void PopulateTestNodeStatistics_WithOutcomeChangeForSameUid_CountsAsRetry()
public void PopulateTestNodeStatistics_WithEventsForSameUid()
{
PropertyBag properties = new(
new FailedTestNodeStateProperty("failed"));
Expand All @@ -148,7 +148,7 @@ public void PopulateTestNodeStatistics_WithOutcomeChangeForSameUid_CountsAsRetry
PropertyBag otherProperties = new(
PassedTestNodeStateProperty.CachedInstance);

TestNodeUpdateMessage otherTestNode = new(new SessionUid("2"), new TestNode { Uid = new TestNodeUid("test()"), DisplayName = string.Empty, Properties = otherProperties });
TestNodeUpdateMessage otherTestNode = new(new SessionUid(string.Empty), new TestNode { Uid = new TestNodeUid("test()"), DisplayName = string.Empty, Properties = otherProperties });

_service.PopulateTestNodeStatistics(testNode);
_service.PopulateTestNodeStatistics(otherTestNode);
Expand All @@ -161,50 +161,6 @@ public void PopulateTestNodeStatistics_WithOutcomeChangeForSameUid_CountsAsRetry
Assert.AreEqual(0, statistics.TotalFailedRetries);
}

[TestMethod]
public void PopulateTestNodeStatistics_WithDuplicateFailedEvents_DoesNotCountAsRetry()
{
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_OnlyCountsFirstRetry()
{
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()
{
Expand Down
Loading