-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting Option for marking not runnable tests as failed #524
Changes from 1 commit
94edd73
bc5f4b5
4c409f1
5240657
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,9 @@ internal static class UnitTestOutcomeHelper | |
/// </summary> | ||
/// <param name="unitTestOutcome"> The unit Test Outcome. </param> | ||
/// <param name="mapInconclusiveToFailed">Should map inconclusive to failed.</param> | ||
/// <param name="mapNotRunnableToFailed">Should map not runnable to failed</param> | ||
/// <returns>The Test platforms outcome.</returns> | ||
internal static TestOutcome ToTestOutcome(UnitTestOutcome unitTestOutcome, bool mapInconclusiveToFailed) | ||
internal static TestOutcome ToTestOutcome(UnitTestOutcome unitTestOutcome, bool mapInconclusiveToFailed, bool mapNotRunnableToFailed) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. Pass entire settings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed. Passing entire adapter settings now. |
||
{ | ||
switch (unitTestOutcome) | ||
{ | ||
|
@@ -29,7 +30,14 @@ internal static TestOutcome ToTestOutcome(UnitTestOutcome unitTestOutcome, bool | |
return TestOutcome.Failed; | ||
|
||
case UnitTestOutcome.NotRunnable: | ||
return TestOutcome.None; | ||
{ | ||
if (mapNotRunnableToFailed) | ||
{ | ||
return TestOutcome.Failed; | ||
} | ||
|
||
return TestOutcome.None; | ||
} | ||
|
||
case UnitTestOutcome.Ignored: | ||
return TestOutcome.Skipped; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ public MSTestSettings() | |
{ | ||
this.CaptureDebugTraces = true; | ||
this.MapInconclusiveToFailed = false; | ||
this.MapNotRunnableToFailed = false; | ||
this.EnableBaseClassTestMethodsFromOtherAssemblies = true; | ||
this.ForcedLegacyMode = false; | ||
this.TestSettingsFile = null; | ||
|
@@ -121,6 +122,11 @@ private set | |
/// </summary> | ||
public bool MapInconclusiveToFailed { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether a not runnable result be mapped to failed test. | ||
/// </summary> | ||
public bool MapNotRunnableToFailed { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether to enable discovery of test methods from base classes in a different assembly from the inheriting test class. | ||
/// </summary> | ||
|
@@ -159,6 +165,7 @@ public static void PopulateSettings(MSTestSettings settings) | |
CurrentSettings.ForcedLegacyMode = settings.ForcedLegacyMode; | ||
CurrentSettings.TestSettingsFile = settings.TestSettingsFile; | ||
CurrentSettings.MapInconclusiveToFailed = settings.MapInconclusiveToFailed; | ||
CurrentSettings.MapNotRunnableToFailed = settings.MapNotRunnableToFailed; | ||
CurrentSettings.EnableBaseClassTestMethodsFromOtherAssemblies = settings.EnableBaseClassTestMethodsFromOtherAssemblies; | ||
CurrentSettings.ParallelizationWorkers = settings.ParallelizationWorkers; | ||
CurrentSettings.ParallelizationScope = settings.ParallelizationScope; | ||
|
@@ -280,6 +287,7 @@ private static MSTestSettings ToSettings(XmlReader reader) | |
// <MSTestV2> | ||
// <CaptureTraceOutput>true</CaptureTraceOutput> | ||
// <MapInconclusiveToFailed>false</MapInconclusiveToFailed> | ||
// <MapNotRunnableToFailed>false</MapNotRunnableToFailed> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice 👍 |
||
// <EnableBaseClassTestMethodsFromOtherAssemblies>false</EnableBaseClassTestMethodsFromOtherAssemblies> | ||
// <TestTimeout>5000</TestTimeout> | ||
// <Parallelize> | ||
|
@@ -350,6 +358,16 @@ private static MSTestSettings ToSettings(XmlReader reader) | |
break; | ||
} | ||
|
||
case "MAPNOTRUNNABLETOFAILED": | ||
{ | ||
if (bool.TryParse(reader.ReadInnerXml(), out result)) | ||
{ | ||
settings.MapNotRunnableToFailed = result; | ||
} | ||
|
||
break; | ||
} | ||
|
||
case "SETTINGSFILE": | ||
{ | ||
string fileName = reader.ReadInnerXml(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of passing individual values from settings : MapInconclusiveToFailed and MapNotRunnableToFailed, prefer passing the entire settings. In future, we can extract whichever value will be required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed. Passing entire adapter settings now. Modified the tests with these as well.