Bug fixes (#4810)
* Bug fixes * Nitpick * -Fixed failed tests -Added test to cover trx logger scenario. * Fix for issue https://github.com/Microsoft/vstest/issues/241 * Fix for failed test. We have taken fix where dotnet test will return nonzero if test fails. In multi TFM scenario if test fails it termates the whole process as dotnet test is returning 1. As a fix of this we should continue if some test fails for next TFM * Bump Microsoft.Testplatform.CLI and Microsoft.NET.Test.Sdk version
This commit is contained in:
parent
3a3ab7e0b0
commit
eb8e0cfa40
12 changed files with 64 additions and 18 deletions
|
@ -96,5 +96,40 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
|||
// Verify
|
||||
result.StdOut.Should().Contain(expectedError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestWillCreateTrxLogger()
|
||||
{
|
||||
// Copy VSTestDotNetCore project in output directory of project dotnet-vstest.Tests
|
||||
string testAppName = "VSTestDotNetCore";
|
||||
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
||||
|
||||
string testProjectDirectory = testInstance.TestRoot;
|
||||
|
||||
// Restore project VSTestDotNetCore
|
||||
new RestoreCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.Execute()
|
||||
.Should()
|
||||
.Pass();
|
||||
|
||||
string trxLoggerDirectory = Path.Combine(testProjectDirectory, "TestResults");
|
||||
|
||||
// Delete trxLoggerDirectory if it exist
|
||||
if(Directory.Exists(trxLoggerDirectory))
|
||||
{
|
||||
Directory.Delete(trxLoggerDirectory, true);
|
||||
}
|
||||
|
||||
// Call test with logger enable
|
||||
CommandResult result = new DotnetTestCommand()
|
||||
.WithWorkingDirectory(testProjectDirectory)
|
||||
.ExecuteWithCapturedOutput("--logger:trx");
|
||||
|
||||
// Verify
|
||||
String[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "*.trx");
|
||||
Assert.Equal(1, trxFiles.Length);
|
||||
result.StdOut.Should().Contain(trxFiles[0]);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue