Skip to content

Commit 5c4e0e5

Browse files
authored
Skipped tests count as not run (#3243)
1 parent 7d73c91 commit 5c4e0e5

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/InvokeTestingPlatformTask.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,9 @@ private Task<IResponse> HandleRequestAsync(IRequest request)
370370
string summary = string.Format(
371371
CultureInfo.CurrentCulture,
372372
Resources.MSBuildResources.Summary,
373-
runSummaryInfoRequest.TotalFailed > 0 ? Resources.MSBuildResources.Failed : Resources.MSBuildResources.Passed,
373+
runSummaryInfoRequest.TotalFailed > 0 || runSummaryInfoRequest.TotalPassed == 0
374+
? Resources.MSBuildResources.Failed
375+
: Resources.MSBuildResources.Passed,
374376
runSummaryInfoRequest.TotalFailed,
375377
runSummaryInfoRequest.TotalPassed,
376378
runSummaryInfoRequest.TotalSkipped,

src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.Categories.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ internal static class TestNodePropertiesCategories
1515
public static Type[] WellKnownTestNodeTestRunOutcomeProperties { get; } =
1616
[
1717
typeof(PassedTestNodeStateProperty),
18-
typeof(SkippedTestNodeStateProperty),
1918

2019
typeof(FailedTestNodeStateProperty),
2120
typeof(ErrorTestNodeStateProperty),

src/Platform/Microsoft.Testing.Platform/OutputDevice/ConsoleDisplayService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public async Task DisplayAfterSessionEndRunAsync()
247247
{
248248
(true, _, _) => (false, PlatformResources.Aborted),
249249
(false, _, _) when _totalTests < _minimumExpectedTest => (false, string.Format(CultureInfo.CurrentCulture, PlatformResources.MinimumExpectedTestsPolicyViolation, _totalTests, _minimumExpectedTest)),
250-
(false, 0, _) => (false, PlatformResources.ZeroTestsRan),
250+
(false, _, _) when _totalTests == 0 || _totalTests == _totalSkippedTests => (false, PlatformResources.ZeroTestsRan),
251251
(false, _, > 0) => (false, string.Format(CultureInfo.CurrentCulture, "{0}!", PlatformResources.Failed)),
252252
_ => (true, string.Format(CultureInfo.CurrentCulture, "{0}!", PlatformResources.Passed)),
253253
};

test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedTestTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,17 @@ public class TestClass
132132
[TestMethod]
133133
[DynamicData(nameof(AdditionalData))]
134134
[DynamicData(nameof(AdditionalData2))]
135-
public void Test()
135+
public void Test(int i)
136136
{
137137
}
138138
139-
public static IEnumerable<int> AdditionalData => Array.Empty<int>();
139+
public static IEnumerable<object[]> AdditionalData => Array.Empty<object[]>();
140140
141-
public static IEnumerable<int> AdditionalData2
141+
public static IEnumerable<object[]> AdditionalData2
142142
{
143143
get
144144
{
145-
yield return 2;
145+
yield return new object[] { 2 };
146146
}
147147
}
148148
}

test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"Microsoft.Testing.Platform.Acceptance.IntegrationTests": {
44
"commandName": "Project",
5-
"commandLineArgs": "--treenode-filter /*/*/InfoTests/**",
5+
"commandLineArgs": "--treenode-filter /*/*/*/**",
66
"environmentVariables": {
77
//"TESTINGPLATFORM_HOTRELOAD_ENABLED": "1"
88
}

test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public async Task Trx_WhenSkipTest_ItAppearsAsExpectedInsideTheTrx(string tfm)
7171
var testHost = TestInfrastructure.TestHost.LocateFrom(_testAssetFixture.TargetAssetPathWithSkippedTest, TestAssetFixture.AssetNameUsingMSTest, tfm);
7272
TestHostResult testHostResult = await testHost.ExecuteAsync($"--report-trx --report-trx-filename {fileName}.trx");
7373

74-
testHostResult.AssertExitCodeIs(ExitCodes.Success);
74+
testHostResult.AssertExitCodeIs(ExitCodes.ZeroTests);
7575

7676
string trxFile = Directory.GetFiles(testHost.DirectoryName, $"{fileName}.trx", SearchOption.AllDirectories).Single();
7777

@@ -107,7 +107,7 @@ public async Task Trx_UsingDataDriven_CreatesUnitTestTagForEachOneInsideTheTrx(s
107107
var testHost = TestInfrastructure.TestHost.LocateFrom(_testAssetFixture.TargetAssetPathWithSkippedTest, TestAssetFixture.AssetNameUsingMSTest, tfm);
108108
TestHostResult testHostResult = await testHost.ExecuteAsync($"--report-trx --report-trx-filename {fileName}.trx");
109109

110-
testHostResult.AssertExitCodeIs(ExitCodes.Success);
110+
testHostResult.AssertExitCodeIs(ExitCodes.ZeroTests);
111111

112112
string trxFile = Directory.GetFiles(testHost.DirectoryName, $"{fileName}.trx", SearchOption.AllDirectories).Single();
113113

test/UnitTests/Microsoft.Testing.Platform.UnitTests/Services/TestApplicationResultTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public TestApplicationResultTests(ITestExecutionContext testExecutionContext)
2222
{
2323
}
2424

25-
public async Task GetProcessExitCodeAsync_If_All_Skipped_Returns_Zero()
25+
public async Task GetProcessExitCodeAsync_If_All_Skipped_Returns_ZeroTestsRan()
2626
{
2727
await _testApplicationResult.ConsumeAsync(new DummyProducer(), new TestNodeUpdateMessage(
2828
default,
@@ -33,7 +33,7 @@ public async Task GetProcessExitCodeAsync_If_All_Skipped_Returns_Zero()
3333
Properties = new PropertyBag(SkippedTestNodeStateProperty.CachedInstance),
3434
}), CancellationToken.None);
3535

36-
Assert.AreEqual(ExitCodes.Success, await _testApplicationResult.GetProcessExitCodeAsync());
36+
Assert.AreEqual(ExitCodes.ZeroTests, await _testApplicationResult.GetProcessExitCodeAsync());
3737
}
3838

3939
public async Task GetProcessExitCodeAsync_If_No_Tests_Ran_Returns_ZeroTestsRan()

0 commit comments

Comments
 (0)