Merge pull request #5054 from codito/fix-retcode

Return non-zero exit code for test failure in multitargeted test project
This commit is contained in:
Livar 2016-12-16 18:08:12 -08:00 committed by GitHub
commit e491fbdcd0
4 changed files with 11 additions and 7 deletions

View file

@ -41,7 +41,7 @@ Copyright (c) .NET Foundation. All rights reserved.
Condition="'$(TargetFrameworks)' != '' "
Targets="$(InnerVSTestTargets)"
Properties="TargetFramework=%(_TargetFramework.Identity);VSTestNoBuild=true"
ContinueOnError="true">
ContinueOnError="ErrorAndContinue">
<Output ItemName="InnerOutput" TaskParameter="TargetOutputs" />
</MSBuild>
</Target>

View file

@ -39,6 +39,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
.And.Contain("Passed TestNamespace.VSTestTests.VSTestPassTestDesktop", "because .NET 4.6 tests will pass")
.And.Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0.", "because netcoreapp1.0 tests will fail")
.And.Contain("Failed TestNamespace.VSTestTests.VSTestFailTestNetCoreApp", "because netcoreapp1.0 tests will fail");
result.ExitCode.Should().Be(1);
}
[WindowsOnlyFact]
@ -70,6 +71,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
// for target framework netcoreapp1.0
result.StdOut.Should().Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0.");
result.StdOut.Should().Contain("Failed TestNamespace.VSTestXunitTests.VSTestXunitFailTestNetCoreApp");
result.ExitCode.Should().Be(1);
}
}
}

View file

@ -38,6 +38,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
result.ExitCode.Should().Be(1);
}
[Fact]
@ -65,6 +66,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestXunitTests.VSTestXunitPassTest");
result.StdOut.Should().Contain("Failed TestNamespace.VSTestXunitTests.VSTestXunitFailTest");
result.ExitCode.Should().Be(1);
}
[Fact]
@ -138,4 +140,4 @@ namespace Microsoft.DotNet.Cli.Test.Tests
}
}
}
}
}

View file

@ -32,12 +32,12 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests
var argsForVstest = $"\"{outputDll.FullName}\"";
// Call vstest
new VSTestCommand()
.ExecuteWithCapturedOutput(argsForVstest)
.StdOut
var result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest);
result.StdOut
.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.")
.And.Contain("Passed TestNamespace.VSTestTests.VSTestPassTest")
.And.Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
.And.Contain("Passed TestNamespace.VSTestTests.VSTestPassTest")
.And.Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
result.ExitCode.Should().Be(1);
}
}
}