Skip to content

Commit

Permalink
Cleanup FailedStates in TrxReportEngine (#4247)
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Dec 5, 2024
1 parent a741052 commit ee0cc58
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Microsoft.Testing.Platform.Extensions.Messages;
using Microsoft.Testing.Platform.Extensions.TestFramework;
using Microsoft.Testing.Platform.Helpers;
using Microsoft.Testing.Platform.Messages;
using Microsoft.Testing.Platform.Services;

namespace Microsoft.Testing.Extensions.TrxReport.Abstractions;
Expand All @@ -28,14 +29,6 @@ internal sealed partial class TrxReportEngine
private static readonly Regex InvalidXmlCharReplace = BuildInvalidXmlCharReplace();
private static readonly MatchEvaluator InvalidXmlEvaluator = ReplaceInvalidCharacterWithUniCodeEscapeSequence;

private static readonly Type[] FailedStates =
[
typeof(FailedTestNodeStateProperty),
typeof(CancelledTestNodeStateProperty),
typeof(ErrorTestNodeStateProperty),
typeof(TimeoutTestNodeStateProperty)
];

private static readonly HashSet<char> InvalidFileNameChars =
[
'\"',
Expand Down Expand Up @@ -469,7 +462,7 @@ private void AddResults(string testAppModule, XElement testRun, out XElement tes
string outcome = "Passed";
TestNodeStateProperty? testState = testNode.Properties.SingleOrDefault<TestNodeStateProperty>();
if (testState is { } state
&& FailedStates.Contains(testState.GetType()))
&& TestNodePropertiesCategories.WellKnownTestNodeTestRunOutcomeFailedProperties.Contains(testState.GetType()))
{
outcome = resultSummaryOutcome = "Failed";
}
Expand Down

0 comments on commit ee0cc58

Please sign in to comment.