diff --git a/src/Agent.Worker/TestResults/TrxResultReader.cs b/src/Agent.Worker/TestResults/TrxResultReader.cs index 1758ced921..382406ebfa 100644 --- a/src/Agent.Worker/TestResults/TrxResultReader.cs +++ b/src/Agent.Worker/TestResults/TrxResultReader.cs @@ -286,14 +286,18 @@ private List ReadActualResults(XmlNodeList resultsNodes, str DateTime completedDate = startedDate.AddTicks(duration.Ticks); resultCreateModel.CompletedDate = completedDate; - if (resultNode.Attributes["outcome"] != null && resultNode.Attributes["outcome"].Value != null) + if (resultNode.Attributes["outcome"] == null || resultNode.Attributes["outcome"].Value == null || string.Equals(resultNode.Attributes["outcome"].Value, "failed", StringComparison.OrdinalIgnoreCase)) { - resultCreateModel.Outcome = resultNode.Attributes["outcome"].Value; - } - else + resultCreateModel.Outcome = TestOutcome.Failed.ToString(); ; + } + else if (string.Equals(resultNode.Attributes["outcome"].Value, "passed", StringComparison.OrdinalIgnoreCase)) { - resultCreateModel.Outcome = "Failed"; + resultCreateModel.Outcome = TestOutcome.Passed.ToString(); } + else + { + resultCreateModel.Outcome = TestOutcome.NotExecuted.ToString(); + } if (resultNode.Attributes["testName"] != null && resultNode.Attributes["testName"].Value != null) { diff --git a/src/Test/L0/Worker/TestResults/TrxResultReaderTests.cs b/src/Test/L0/Worker/TestResults/TrxResultReaderTests.cs index 413dbd6f71..dc04893bb1 100644 --- a/src/Test/L0/Worker/TestResults/TrxResultReaderTests.cs +++ b/src/Test/L0/Worker/TestResults/TrxResultReaderTests.cs @@ -46,6 +46,45 @@ public void ResultsWithoutTestNamesAreSkipped() Assert.Equal(0, runData.Results.Length); } + [Fact] + [Trait("Level", "L0")] + [Trait("Category", "PublishTestResults")] + public void PendingOutcomeTreatedAsNotExecuted() + { + SetupMocks(); + String trxContents = "" + + "" + + "" + + "" + + "" + + "" + + + "" + + "Show console log output.Assert.Fail failed.at UnitTestProject4.UnitTest1.TestMethod2() in C:\\Users\\somerandomusername\\Source\\Repos\\Projectx\\UnitTestProject4\\UnitTestProject4\\UnitTest1.cs:line 21" + + "" + + "" + + "Do not show console log output." + + "" + + "" + + "" + + "LOCAL SERVICE_LAB-BUILDVNEXT 2015-05-20 18_53_41\\In\\eb421c16-4546-435a-9c24-0d2878ea76d4\\PSD_Startseite.webtestResult" + + "" + + "" + + + "" + + "" + + ""; + + var runData = GetTestRunData(trxContents, null, new TestRunContext("Owner", "any cpu", "debug", 1, "", "releaseUri", "releaseEnvironmentUri")); + + Assert.Equal(runData.Results.Length, 2); + + Assert.Equal(runData.Results[0].Outcome, "NotExecuted"); + Assert.Equal(runData.Results[0].TestCaseTitle, "TestMethod2"); + Assert.Equal(runData.Results[1].Outcome, "Passed"); + Assert.Equal(runData.Results[1].TestCaseTitle, "PSD_Startseite"); + } + [Fact] [Trait("Level", "L0")] [Trait("Category", "PublishTestResults")]