diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj index 9fc218a6f..78bfad3bd 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj +++ b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj @@ -4,7 +4,7 @@ Exe - net46 + net46;netcoreapp1.0 diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index 13db81831..4596a58a2 100644 --- a/build/Microsoft.DotNet.Cli.Compile.targets +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -97,7 +97,7 @@ - + diff --git a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs index 23f7593e6..06239cee7 100644 --- a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -14,10 +14,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests public class GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM : TestBase { // project targeting net46 will not run in non windows machine. - [WindowsOnlyFact(Skip="https://github.com/dotnet/cli/issues/4526")] + [WindowsOnlyFact] public void TestsFromAGivenProjectShouldRunWithExpectedOutputForMultiTFM() { - // Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests + // Copy VSTestDesktopAndNetCoreApp project in output directory of project dotnet-test.Tests string testAppName = "VSTestDesktopAndNetCoreApp"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); @@ -30,18 +30,23 @@ namespace Microsoft.DotNet.Cli.Test.Tests .Should() .Pass(); - // Call test3 + // Call test CommandResult result = new DotnetTestCommand() .WithWorkingDirectory(testProjectDirectory) .ExecuteWithCapturedOutput("--diag LogFile.txt"); - // Verify - // for target framework net46 + try { + // Verify + // for target framework net46 result.StdOut.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0."); result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTestDesktop"); + + // for target framework netcoreapp1.0 + result.StdOut.Should().Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0."); + result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTestNetCoreApp"); } catch { @@ -54,10 +59,6 @@ namespace Microsoft.DotNet.Cli.Test.Tests System.Console.WriteLine(logfile2.Length>0 ? File.ReadAllText(logfile2[0]):"No log file found"); System.Console.WriteLine("**************************************************************************************************"); } - - // for target framework netcoreapp1.0 - //result.StdOut.Should().Contain("Total tests: 3. Passed: 1. Failed: 2. Skipped: 0."); - //result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTestNetCoreApp"); } } } diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index df280b4ca..8d3510386 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -13,10 +13,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests { public class GivenDotnettestBuildsAndRunsTestfromCsproj : TestBase { - //[Fact] + [Fact] public void TestsFromAGivenProjectShouldRunWithExpectedOutput() { - // Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests + // Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests string testAppName = "VSTestDotNetCoreProject"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); @@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests // Call test CommandResult result = new DotnetTestCommand() .WithWorkingDirectory(testProjectDirectory) - .ExecuteWithCapturedOutput("/p:TargetFramework=netcoreapp1.0"); + .ExecuteWithCapturedOutput("-f netcoreapp1.0"); // Verify result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0."); @@ -40,10 +40,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest"); } - //[Fact] + [Fact] public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven() { - // Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests + // Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests string testAppName = "VSTestDotNetCoreProject"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); @@ -61,7 +61,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests configuration, "netcoreapp1.0", "VSTestDotNetCoreProject.dll"); expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found."; - // Call test3 + // Call test CommandResult result = new DotnetTestCommand() .WithWorkingDirectory(testProjectDirectory) .ExecuteWithCapturedOutput("--noBuild");