Enable some more test
This commit is contained in:
parent
dfea5b780f
commit
061722d4ad
2 changed files with 15 additions and 40 deletions
|
@ -2,11 +2,9 @@
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||||
using Xunit;
|
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Microsoft.DotNet.TestFramework;
|
using Microsoft.DotNet.TestFramework;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
@ -16,6 +14,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
{
|
{
|
||||||
// Adding log to root cause test failure for net46
|
// Adding log to root cause test failure for net46
|
||||||
private const string vstestLog = "VSTEST_TRACE_BUILD";
|
private const string vstestLog = "VSTEST_TRACE_BUILD";
|
||||||
|
|
||||||
// project targeting net46 will not run in non windows machine.
|
// project targeting net46 will not run in non windows machine.
|
||||||
[WindowsOnlyFact]
|
[WindowsOnlyFact]
|
||||||
public void TestsFromAGivenProjectShouldRunWithExpectedOutputForMultiTFM()
|
public void TestsFromAGivenProjectShouldRunWithExpectedOutputForMultiTFM()
|
||||||
|
@ -41,7 +40,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
.ExecuteWithCapturedOutput("--diag LogFile.txt");
|
.ExecuteWithCapturedOutput("--diag LogFile.txt");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Verify
|
// Verify
|
||||||
|
@ -61,13 +60,13 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
Console.WriteLine("*********************************StdErr****************************************************************");
|
Console.WriteLine("*********************************StdErr****************************************************************");
|
||||||
Console.WriteLine(result.StdErr.ToString());
|
Console.WriteLine(result.StdErr.ToString());
|
||||||
|
|
||||||
string logfile1 = Path.Combine(testProjectDirectory,"LogFile.txt");
|
string logfile1 = Path.Combine(testProjectDirectory, "LogFile.txt");
|
||||||
string[] logfile2 = Directory.GetFiles(testProjectDirectory, "LogFile.host.*");
|
string[] logfile2 = Directory.GetFiles(testProjectDirectory, "LogFile.host.*");
|
||||||
|
|
||||||
Console.WriteLine("**********************************Vstest.console Log****************************************************************");
|
Console.WriteLine("**********************************Vstest.console Log****************************************************************");
|
||||||
Console.WriteLine(File.ReadAllText(logfile1));
|
Console.WriteLine(File.ReadAllText(logfile1));
|
||||||
Console.WriteLine("**********************************TestHost Log****************************************************************");
|
Console.WriteLine("**********************************TestHost Log****************************************************************");
|
||||||
Console.WriteLine(logfile2.Length>0 ? File.ReadAllText(logfile2[0]):"No log file found");
|
Console.WriteLine(logfile2.Length > 0 ? File.ReadAllText(logfile2[0]) : "No log file found");
|
||||||
Console.WriteLine("**************************************************************************************************");
|
Console.WriteLine("**************************************************************************************************");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,9 +74,6 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
[WindowsOnlyFact]
|
[WindowsOnlyFact]
|
||||||
public void TestsFromAGivenXunitProjectShouldRunWithExpectedOutputForMultiTFM()
|
public void TestsFromAGivenXunitProjectShouldRunWithExpectedOutputForMultiTFM()
|
||||||
{
|
{
|
||||||
// Adding log to root cause test failure for net46
|
|
||||||
Environment.SetEnvironmentVariable(vstestLog, "1");
|
|
||||||
|
|
||||||
// Copy VSTestXunitDesktopAndNetCoreApp project in output directory of project dotnet-test.Tests
|
// Copy VSTestXunitDesktopAndNetCoreApp project in output directory of project dotnet-test.Tests
|
||||||
string testAppName = "VSTestXunitDesktopAndNetCoreApp";
|
string testAppName = "VSTestXunitDesktopAndNetCoreApp";
|
||||||
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
|
||||||
|
@ -94,38 +90,17 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
// Call test
|
// Call test
|
||||||
CommandResult result = new DotnetTestCommand()
|
CommandResult result = new DotnetTestCommand()
|
||||||
.WithWorkingDirectory(testProjectDirectory)
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
.ExecuteWithCapturedOutput("--diag LogFile.txt");
|
.ExecuteWithCapturedOutput();
|
||||||
|
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
// for target framework net46
|
||||||
|
result.StdOut.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.");
|
||||||
|
result.StdOut.Should().Contain("Passed TestNamespace.VSTestXunitTests.VSTestXunitPassTestDesktop");
|
||||||
|
|
||||||
try
|
// for target framework netcoreapp1.0
|
||||||
{
|
result.StdOut.Should().Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0.");
|
||||||
// Verify
|
result.StdOut.Should().Contain("Failed TestNamespace.VSTestXunitTests.VSTestXunitFailTestNetCoreApp");
|
||||||
// for target framework net46
|
|
||||||
result.StdOut.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.");
|
|
||||||
result.StdOut.Should().Contain("Passed TestNamespace.VSTestXunitTests.VSTestXunitPassTestDesktop");
|
|
||||||
|
|
||||||
// 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");
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Console.WriteLine("*********************************Xunit StdOut****************************************************************");
|
|
||||||
Console.WriteLine(result.StdOut.ToString());
|
|
||||||
|
|
||||||
Console.WriteLine("*********************************Xunit StdErr****************************************************************");
|
|
||||||
Console.WriteLine(result.StdErr.ToString());
|
|
||||||
|
|
||||||
string logfile1 = Path.Combine(testProjectDirectory, "LogFile.txt");
|
|
||||||
string[] logfile2 = Directory.GetFiles(testProjectDirectory, "LogFile.host.*");
|
|
||||||
|
|
||||||
Console.WriteLine("*********************************Xunit Vstest.console Log****************************************************************");
|
|
||||||
Console.WriteLine(File.ReadAllText(logfile1));
|
|
||||||
Console.WriteLine("********************************Xunit TestHost Log****************************************************************");
|
|
||||||
Console.WriteLine(logfile2.Length > 0 ? File.ReadAllText(logfile2[0]) : "No log file found");
|
|
||||||
Console.WriteLine("**************************************************************************************************");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
{
|
{
|
||||||
public class GivenDotnettestBuildsAndRunsTestfromCsproj : TestBase
|
public class GivenDotnettestBuildsAndRunsTestfromCsproj : TestBase
|
||||||
{
|
{
|
||||||
//[Fact]
|
[Fact]
|
||||||
public void TestsFromAGivenProjectShouldRunWithExpectedOutput()
|
public void TestsFromAGivenProjectShouldRunWithExpectedOutput()
|
||||||
{
|
{
|
||||||
// Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests
|
// Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests
|
||||||
|
@ -40,7 +40,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
|
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
public void TestsFromAGivenXunitProjectShouldRunWithExpectedOutput()
|
public void TestsFromAGivenXunitProjectShouldRunWithExpectedOutput()
|
||||||
{
|
{
|
||||||
// Copy VSTestXunitDotNetCoreProject project in output directory of project dotnet-vstest.Tests
|
// Copy VSTestXunitDotNetCoreProject project in output directory of project dotnet-vstest.Tests
|
||||||
|
@ -67,7 +67,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
|
||||||
result.StdOut.Should().Contain("Failed TestNamespace.VSTestXunitTests.VSTestXunitFailTest");
|
result.StdOut.Should().Contain("Failed TestNamespace.VSTestXunitTests.VSTestXunitFailTest");
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven()
|
public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven()
|
||||||
{
|
{
|
||||||
// Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests
|
// Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue