Skip to content

Commit

Permalink
Test outcome none mapping (#219)
Browse files Browse the repository at this point in the history
* Added new outcome to the public UnitTestOutcome enum, added mapping for the UnitTestOutcome.NotRunnable.

* Updated unit tests.
  • Loading branch information
irguzhav authored and AbhitejJohn committed Jul 10, 2017
1 parent 110a8c1 commit cf5a8b5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public static UnitTestOutcome ToUnitTestOutcome(this UTF.UnitTestOutcome framewo
outcome = UnitTestOutcome.Timeout;
break;

case UTF.UnitTestOutcome.NotRunnable:
outcome = UnitTestOutcome.NotRunnable;
break;

case UTF.UnitTestOutcome.Unknown:
default:
outcome = UnitTestOutcome.Error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ internal static TestOutcome ToTestOutcome(UnitTestOutcome unitTestOutcome, bool

case UnitTestOutcome.Failed:
case UnitTestOutcome.Error:
case UnitTestOutcome.NotRunnable:
case UnitTestOutcome.Timeout:
return TestOutcome.Failed;

case UnitTestOutcome.NotRunnable:
return TestOutcome.None;

case UnitTestOutcome.Ignored:
return TestOutcome.Skipped;

case UnitTestOutcome.Inconclusive:
{
if (mapInconclusiveToFailed)
Expand Down
7 changes: 6 additions & 1 deletion src/TestFramework/MSTest.Core/UnitTestOutcome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public enum UnitTestOutcome : int
/// <summary>
/// Test is in an unknown state
/// </summary>
Unknown
Unknown,

/// <summary>
/// Test cannot be executed.
/// </summary>
NotRunnable
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public void UniTestHelperToTestOutcomeForUnitTestOutcomeErrorShouldReturnTestOut
}

[TestMethod]
public void UniTestHelperToTestOutcomeForUnitTestOutcomeNotRunnableShouldReturnTestOutcomeFailed()
public void UniTestHelperToTestOutcomeForUnitTestOutcomeNotRunnableShouldReturnTestOutcomeNone()
{
var resultOutcome = UnitTestOutcomeHelper.ToTestOutcome(UnitTestOutcome.NotRunnable, mapInconclusiveToFailed: false);
Assert.AreEqual(TestOutcome.Failed, resultOutcome);
Assert.AreEqual(TestOutcome.None, resultOutcome);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ public void UniTestHelperToTestOutcomeForUnitTestOutcomeErrorShouldReturnTestOut
}

[TestMethod]
public void UniTestHelperToTestOutcomeForUnitTestOutcomeNotRunnableShouldReturnTestOutcomeFailed()
public void UniTestHelperToTestOutcomeForUnitTestOutcomeNotRunnableShouldReturnTestOutcomeNone()
{
var resultOutcome = UnitTestOutcomeHelper.ToTestOutcome(UnitTestOutcome.NotRunnable, false);
Assert.AreEqual(TestOutcome.Failed, resultOutcome);
Assert.AreEqual(TestOutcome.None, resultOutcome);
}

[TestMethod]
Expand Down

0 comments on commit cf5a8b5

Please sign in to comment.