From 1b5497afda3fc42319f3f1d2430a412fe0df4658 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Tue, 1 Nov 2016 16:18:33 +0530 Subject: [PATCH 01/14] Enale disabled vstest test. It was failing in restore. Going with increamental approach. In this commit i am trying to enable restore. In next commit will enable vstest --- .../VSTestDotNetCoreProject.csproj | 3 +- test/dotnet-vstest.Tests/VSTestTests.cs | 34 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj b/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj index d0246131e..1d855c2c1 100644 --- a/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj +++ b/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj @@ -1,5 +1,4 @@ - - + diff --git a/test/dotnet-vstest.Tests/VSTestTests.cs b/test/dotnet-vstest.Tests/VSTestTests.cs index 29c1cdca3..5d3e46c30 100644 --- a/test/dotnet-vstest.Tests/VSTestTests.cs +++ b/test/dotnet-vstest.Tests/VSTestTests.cs @@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests { public class VSTestTests : TestBase { - [Fact(Skip="https://github.com/dotnet/cli/issues/4526")] + [Fact] public void TestsFromAGivenContainerShouldRunWithExpectedOutput() { // Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests @@ -30,25 +30,25 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests .Pass(); // Build project VSTestDotNetCoreProject - new BuildCommand() - .WithWorkingDirectory(testProjectDirectory) - .Execute() - .Should() - .Pass(); + //new BuildCommand() + // .WithWorkingDirectory(testProjectDirectory) + // .Execute() + // .Should() + // .Pass(); - // Prepare args to send vstest - string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; - string testAdapterPath = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0"); - string outputDll = Path.Combine(testAdapterPath, $"{testAppName}.dll"); - string argsForVstest = string.Concat("\"", outputDll, "\""); + //// Prepare args to send vstest + //string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; + //string testAdapterPath = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0"); + //string outputDll = Path.Combine(testAdapterPath, $"{testAppName}.dll"); + //string argsForVstest = string.Concat("\"", outputDll, "\""); - // Call vstest - CommandResult result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest); + //// Call vstest + //CommandResult result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest); - // Verify - 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"); + //// Verify + //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"); } } } From b13a7cee50c9a9f42f39f166d33e88278b361aec Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Tue, 1 Nov 2016 17:17:45 +0530 Subject: [PATCH 02/14] Enable Vstest test --- test/dotnet-vstest.Tests/VSTestTests.cs | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/dotnet-vstest.Tests/VSTestTests.cs b/test/dotnet-vstest.Tests/VSTestTests.cs index 5d3e46c30..e3d685090 100644 --- a/test/dotnet-vstest.Tests/VSTestTests.cs +++ b/test/dotnet-vstest.Tests/VSTestTests.cs @@ -30,25 +30,25 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests .Pass(); // Build project VSTestDotNetCoreProject - //new BuildCommand() - // .WithWorkingDirectory(testProjectDirectory) - // .Execute() - // .Should() - // .Pass(); + new BuildCommand() + .WithWorkingDirectory(testProjectDirectory) + .Execute() + .Should() + .Pass(); - //// Prepare args to send vstest - //string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; - //string testAdapterPath = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0"); - //string outputDll = Path.Combine(testAdapterPath, $"{testAppName}.dll"); - //string argsForVstest = string.Concat("\"", outputDll, "\""); + // Prepare args to send vstest + string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; + string testAdapterPath = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0"); + string outputDll = Path.Combine(testAdapterPath, $"{testAppName}.dll"); + string argsForVstest = string.Concat("\"", outputDll, "\""); - //// Call vstest - //CommandResult result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest); + // Call vstest + CommandResult result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest); - //// Verify - //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"); + // Verify + 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"); } } } From 6688ba22a43b9611bbca6b869cbe7f4e4b1075cb Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Tue, 1 Nov 2016 18:30:39 +0530 Subject: [PATCH 03/14] Updated the package version of testplatform in redist.csproj --- src/redist/redist.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index e6f051f25..db1923315 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -33,10 +33,10 @@ 4.0.0-rc-2037 - 15.0.0-preview-20161005-01 + 15.0.0-preview-20161028-03 - 15.0.0-preview-20161005-01 + 15.0.0-preview-20161028-03 From be9fd8388bde14db20d8e0c43e9ddf056893911d Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Tue, 1 Nov 2016 20:10:34 +0530 Subject: [PATCH 04/14] Hack for bug https://github.com/dotnet/sdk/issues/115 for Microsoft.TestPlatform.CLI --- build/Microsoft.DotNet.Cli.Compile.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index c2e875fd0..13db81831 100644 --- a/build/Microsoft.DotNet.Cli.Compile.targets +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -97,7 +97,7 @@ - + From 5c5ce3d336523e837a95db2c3f472bc3c7fbc84b Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Tue, 1 Nov 2016 22:01:30 +0530 Subject: [PATCH 05/14] Enable test verb tests --- .../VSTestDesktopAndNetCoreApp.csproj | 2 +- build/Microsoft.DotNet.Cli.Compile.targets | 2 +- ...ildsAndRunsTestFromCsprojForMultipleTFM.cs | 19 ++++++++++--------- ...enDotnetTestBuildsAndRunsTestfromCsproj.cs | 12 ++++++------ 4 files changed, 18 insertions(+), 17 deletions(-) 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"); From 0995daf83e3d636e129b69dac47f8f55b004ce07 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Wed, 2 Nov 2016 01:45:44 +0530 Subject: [PATCH 06/14] 1) Added test to cover xunit scenario 2) Added log in multi tfm test to root cause the issue where it is failing for net46 --- .../VSTestDesktopAndNetCoreApp/Tests.cs | 8 -- .../VSTestDesktopAndNetCoreApp.csproj | 7 +- .../VSTestDotNetCoreProject/Tests.cs | 8 -- .../VSTestDotNetCoreProject.csproj | 6 +- .../Nuget.config | 13 ++++ .../UnitTest1.cs | 32 ++++++++ .../VSTestXunitDesktopAndNetCoreApp.csproj | 40 ++++++++++ .../VSTestXunitDotNetCoreProject/Nuget.config | 13 ++++ .../VSTestXunitDotNetCoreProject/UnitTest1.cs | 19 +++++ .../VSTestXunitDotNetCoreProject.csproj | 34 ++++++++ build/Microsoft.DotNet.Cli.Compile.targets | 2 +- src/dotnet/commands/dotnet-test/Program.cs | 2 +- src/redist/redist.csproj | 2 +- ...ildsAndRunsTestFromCsprojForMultipleTFM.cs | 77 +++++++++++++++++-- ...enDotnetTestBuildsAndRunsTestfromCsproj.cs | 33 +++++++- 15 files changed, 262 insertions(+), 34 deletions(-) create mode 100644 TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config create mode 100644 TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs create mode 100644 TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj create mode 100644 TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config create mode 100644 TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs create mode 100644 TestAssets/TestProjects/VSTestXunitDotNetCoreProject/VSTestXunitDotNetCoreProject.csproj diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs index f242df270..25b1623c7 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs +++ b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs @@ -2,14 +2,6 @@ namespace TestNamespace { - public class Program - { - public static void Main(string[] args) - { - - } - } - [TestClass] public class VSTestTests { diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj index 78bfad3bd..ae1b80048 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj +++ b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj @@ -1,5 +1,4 @@ - - + @@ -32,8 +31,8 @@ 1.1.4-preview - - 15.0.0-preview-20161028-03 + + 15.0.0-preview-20161024-02 diff --git a/TestAssets/TestProjects/VSTestDotNetCoreProject/Tests.cs b/TestAssets/TestProjects/VSTestDotNetCoreProject/Tests.cs index afb3b28a2..e9b847369 100644 --- a/TestAssets/TestProjects/VSTestDotNetCoreProject/Tests.cs +++ b/TestAssets/TestProjects/VSTestDotNetCoreProject/Tests.cs @@ -2,14 +2,6 @@ namespace TestNamespace { - public class Program - { - public static void Main(string[] args) - { - - } - } - [TestClass] public class VSTestTests { diff --git a/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj b/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj index 1d855c2c1..77fd7abea 100644 --- a/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj +++ b/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj @@ -3,7 +3,7 @@ Exe - netcoreapp1.0 + netcoreapp1.0 @@ -24,8 +24,8 @@ 1.1.4-preview - - 15.0.0-preview-20161028-03 + + 15.0.0-preview-20161024-02 diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config new file mode 100644 index 000000000..ad44d5bc9 --- /dev/null +++ b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs new file mode 100644 index 000000000..6a839a1d4 --- /dev/null +++ b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs @@ -0,0 +1,32 @@ +using System; +using Xunit; + +namespace TestNamespace +{ + public class VSTestXunitTests + { + [Fact] + public void VSTestXunitPassTest() + { + } + + [Fact] + public void VSTestXunitFailTest() + { + Assert.Equal(1,2); + } + + #if DESKTOP + [Fact] + public void VSTestXunitPassTestDesktop() + { + } + #else + [Fact] + public void VSTestXunitFailTestNetCoreApp() + { + Assert.Equal(1,2); + } + #endif + } +} diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj new file mode 100644 index 000000000..4e9c679bf --- /dev/null +++ b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj @@ -0,0 +1,40 @@ + + + + + Exe + net46;netcoreapp1.0 + + + + DESKTOP;$(DefineConstants) + + + + + + + + + 1.0.1 + + + + + + 1.0.0-alpha-20161026-2 + All + + + 15.0.0-preview-20161024-02 + + + 2.2.0-beta3-build3402 + + + 2.2.0-beta4-build1188 + + + + + diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config new file mode 100644 index 000000000..ad44d5bc9 --- /dev/null +++ b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs new file mode 100644 index 000000000..990b97de4 --- /dev/null +++ b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs @@ -0,0 +1,19 @@ +using System; +using Xunit; + +namespace TestNamespace +{ + public class VSTestXunitTests + { + [Fact] + public void VSTestXunitPassTest() + { + } + + [Fact] + public void VSTestXunitFailTest() + { + Assert.Equal(1,2); + } + } +} diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/VSTestXunitDotNetCoreProject.csproj b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/VSTestXunitDotNetCoreProject.csproj new file mode 100644 index 000000000..ef33981c1 --- /dev/null +++ b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/VSTestXunitDotNetCoreProject.csproj @@ -0,0 +1,34 @@ + + + + + Exe + netcoreapp1.0 + + + + + + + + + + 1.0.1 + + + 1.0.0-alpha-20161026-2 + All + + + 15.0.0-preview-20161024-02 + + + 2.2.0-beta3-build3402 + + + 2.2.0-beta4-build1188 + + + + + diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index 4596a58a2..33dc22518 100644 --- a/build/Microsoft.DotNet.Cli.Compile.targets +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -97,7 +97,7 @@ - + diff --git a/src/dotnet/commands/dotnet-test/Program.cs b/src/dotnet/commands/dotnet-test/Program.cs index be2a8cf97..d8c9e6a00 100644 --- a/src/dotnet/commands/dotnet-test/Program.cs +++ b/src/dotnet/commands/dotnet-test/Program.cs @@ -72,7 +72,7 @@ namespace Microsoft.DotNet.Tools.Test CommandOptionType.SingleValue); var outputOption = cmd.Option( - "-o|--output ", + "-o|--output ", @"Directory in which to find the binaries to be run", CommandOptionType.SingleValue); diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index db1923315..d459c888c 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -33,7 +33,7 @@ 4.0.0-rc-2037 - 15.0.0-preview-20161028-03 + 15.0.0-preview-20161101-02 15.0.0-preview-20161028-03 diff --git a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs index 06239cee7..3f1b5bbd7 100644 --- a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -8,15 +8,20 @@ using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Cli.Utils; using System.Runtime.InteropServices; using System.IO; +using System; namespace Microsoft.DotNet.Cli.Test.Tests { public class GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM : TestBase { + // Adding log to root cause test failure for net46 + private const string vstestLog = "VSTEST_TRACE_BUILD"; // project targeting net46 will not run in non windows machine. [WindowsOnlyFact] public void TestsFromAGivenProjectShouldRunWithExpectedOutputForMultiTFM() { + Environment.SetEnvironmentVariable(vstestLog, "1"); + // Copy VSTestDesktopAndNetCoreApp project in output directory of project dotnet-test.Tests string testAppName = "VSTestDesktopAndNetCoreApp"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); @@ -50,14 +55,76 @@ namespace Microsoft.DotNet.Cli.Test.Tests } catch { + Console.WriteLine("*********************************StdOut****************************************************************"); + Console.WriteLine(result.StdOut.ToString()); + + Console.WriteLine("*********************************StdErr****************************************************************"); + Console.WriteLine(result.StdErr.ToString()); + string logfile1 = Path.Combine(testProjectDirectory,"LogFile.txt"); string[] logfile2 = Directory.GetFiles(testProjectDirectory, "LogFile.host.*"); - System.Console.WriteLine("**********************************Vstest.console Log****************************************************************"); - System.Console.WriteLine(File.ReadAllText(logfile1)); - System.Console.WriteLine("**********************************TestHost Log****************************************************************"); - System.Console.WriteLine(logfile2.Length>0 ? File.ReadAllText(logfile2[0]):"No log file found"); - System.Console.WriteLine("**************************************************************************************************"); + Console.WriteLine("**********************************Vstest.console Log****************************************************************"); + Console.WriteLine(File.ReadAllText(logfile1)); + Console.WriteLine("**********************************TestHost Log****************************************************************"); + Console.WriteLine(logfile2.Length>0 ? File.ReadAllText(logfile2[0]):"No log file found"); + Console.WriteLine("**************************************************************************************************"); + } + } + + [WindowsOnlyFact] + 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 + string testAppName = "VSTestXunitDesktopAndNetCoreApp"; + TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); + + string testProjectDirectory = testInstance.TestRoot; + + // Restore project VSTestXunitDesktopAndNetCoreApp + new RestoreCommand() + .WithWorkingDirectory(testProjectDirectory) + .Execute() + .Should() + .Pass(); + + // Call test + CommandResult result = new DotnetTestCommand() + .WithWorkingDirectory(testProjectDirectory) + .ExecuteWithCapturedOutput("--diag LogFile.txt"); + + + + 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.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("**************************************************************************************************"); } } } diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index 8d3510386..723e7fb3a 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests { public class GivenDotnettestBuildsAndRunsTestfromCsproj : TestBase { - [Fact] + //[Fact] public void TestsFromAGivenProjectShouldRunWithExpectedOutput() { // Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests @@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests // Call test CommandResult result = new DotnetTestCommand() .WithWorkingDirectory(testProjectDirectory) - .ExecuteWithCapturedOutput("-f netcoreapp1.0"); + .ExecuteWithCapturedOutput(); // Verify result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0."); @@ -40,7 +40,34 @@ namespace Microsoft.DotNet.Cli.Test.Tests result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest"); } - [Fact] + //[Fact] + public void TestsFromAGivenXunitProjectShouldRunWithExpectedOutput() + { + // Copy VSTestXunitDotNetCoreProject project in output directory of project dotnet-vstest.Tests + string testAppName = "VSTestXunitDotNetCoreProject"; + TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); + + string testProjectDirectory = testInstance.TestRoot; + + // Restore project VSTestXunitDotNetCoreProject + new RestoreCommand() + .WithWorkingDirectory(testProjectDirectory) + .Execute() + .Should() + .Pass(); + + // Call test + CommandResult result = new DotnetTestCommand() + .WithWorkingDirectory(testProjectDirectory) + .ExecuteWithCapturedOutput(); + + // Verify + 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"); + } + + //[Fact] public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven() { // Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests From dfea5b780f4051389ec797072db61131bc75e867 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Wed, 2 Nov 2016 01:56:42 +0530 Subject: [PATCH 07/14] Nitpick --- .../VSTestDesktopAndNetCoreApp/Tests.cs | 12 ++++++------ .../VSTestDesktopAndNetCoreApp.csproj | 10 +++++----- .../VSTestDotNetCoreProject.csproj | 6 +++--- .../VSTestXunitDesktopAndNetCoreApp/Nuget.config | 1 - .../VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs | 16 ++++++++-------- .../VSTestXunitDesktopAndNetCoreApp.csproj | 4 ++-- .../VSTestXunitDotNetCoreProject/Nuget.config | 1 - .../VSTestXunitDotNetCoreProject/UnitTest1.cs | 6 +++--- 8 files changed, 27 insertions(+), 29 deletions(-) diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs index 25b1623c7..6b1329249 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs +++ b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs @@ -15,18 +15,18 @@ namespace TestNamespace { Assert.Fail(); } - - #if DESKTOP - [TestMethod] + +#if DESKTOP + [TestMethod] public void VSTestPassTestDesktop() { } - #else - [TestMethod] +#else + [TestMethod] public void VSTestFailTestNetCoreApp() { Assert.Fail(); } - #endif +#endif } } \ No newline at end of file diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj index ae1b80048..94314c1d8 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj +++ b/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj @@ -5,7 +5,7 @@ Exe net46;netcoreapp1.0 - + DESKTOP;$(DefineConstants) @@ -13,7 +13,7 @@ - + 1.0.1 @@ -25,13 +25,13 @@ 1.0.0-alpha-20161026-2 All - + 1.0.5-preview - + 1.1.4-preview - + 15.0.0-preview-20161024-02 diff --git a/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj b/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj index 77fd7abea..d7d9c648b 100644 --- a/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj +++ b/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj @@ -18,13 +18,13 @@ 1.0.0-alpha-20161026-2 All - + 1.0.5-preview - + 1.1.4-preview - + 15.0.0-preview-20161024-02 diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config index ad44d5bc9..1b7dbc159 100644 --- a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config +++ b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config @@ -5,7 +5,6 @@ - diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs index 6a839a1d4..b77a42021 100644 --- a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs +++ b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs @@ -13,20 +13,20 @@ namespace TestNamespace [Fact] public void VSTestXunitFailTest() { - Assert.Equal(1,2); + Assert.Equal(1, 2); } - - #if DESKTOP - [Fact] + +#if DESKTOP + [Fact] public void VSTestXunitPassTestDesktop() { } - #else - [Fact] +#else + [Fact] public void VSTestXunitFailTestNetCoreApp() { - Assert.Equal(1,2); + Assert.Equal(1, 2); } - #endif +#endif } } diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj index 4e9c679bf..9b408113c 100644 --- a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj +++ b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj @@ -5,7 +5,7 @@ Exe net46;netcoreapp1.0 - + DESKTOP;$(DefineConstants) @@ -13,7 +13,7 @@ - + 1.0.1 diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config index ad44d5bc9..1b7dbc159 100644 --- a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config +++ b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config @@ -5,7 +5,6 @@ - diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs index 990b97de4..5ed55618b 100644 --- a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs +++ b/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs @@ -9,11 +9,11 @@ namespace TestNamespace public void VSTestXunitPassTest() { } - - [Fact] + + [Fact] public void VSTestXunitFailTest() { - Assert.Equal(1,2); + Assert.Equal(1, 2); } } } From 061722d4ada029d618ad949b450d977850224cd7 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Wed, 2 Nov 2016 03:01:13 +0530 Subject: [PATCH 08/14] Enable some more test --- ...ildsAndRunsTestFromCsprojForMultipleTFM.cs | 49 +++++-------------- ...enDotnetTestBuildsAndRunsTestfromCsproj.cs | 6 +-- 2 files changed, 15 insertions(+), 40 deletions(-) diff --git a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs index 3f1b5bbd7..9957efff4 100644 --- a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -2,11 +2,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.DotNet.Tools.Test.Utilities; -using Xunit; using FluentAssertions; using Microsoft.DotNet.TestFramework; using Microsoft.DotNet.Cli.Utils; -using System.Runtime.InteropServices; using System.IO; using System; @@ -16,6 +14,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests { // Adding log to root cause test failure for net46 private const string vstestLog = "VSTEST_TRACE_BUILD"; + // project targeting net46 will not run in non windows machine. [WindowsOnlyFact] public void TestsFromAGivenProjectShouldRunWithExpectedOutputForMultiTFM() @@ -41,7 +40,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests .ExecuteWithCapturedOutput("--diag LogFile.txt"); - + try { // Verify @@ -61,13 +60,13 @@ namespace Microsoft.DotNet.Cli.Test.Tests Console.WriteLine("*********************************StdErr****************************************************************"); 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.*"); Console.WriteLine("**********************************Vstest.console Log****************************************************************"); Console.WriteLine(File.ReadAllText(logfile1)); 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("**************************************************************************************************"); } } @@ -75,9 +74,6 @@ namespace Microsoft.DotNet.Cli.Test.Tests [WindowsOnlyFact] 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 string testAppName = "VSTestXunitDesktopAndNetCoreApp"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); @@ -94,38 +90,17 @@ namespace Microsoft.DotNet.Cli.Test.Tests // Call test CommandResult result = new DotnetTestCommand() .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 - { - // 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"); - - // 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("**************************************************************************************************"); - } + // 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"); } } } diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index 723e7fb3a..429708e90 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests { public class GivenDotnettestBuildsAndRunsTestfromCsproj : TestBase { - //[Fact] + [Fact] public void TestsFromAGivenProjectShouldRunWithExpectedOutput() { // 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"); } - //[Fact] + [Fact] public void TestsFromAGivenXunitProjectShouldRunWithExpectedOutput() { // 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"); } - //[Fact] + [Fact] public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven() { // Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests From 9b92fe23361f90a38bd54b788827539d6b5b46b8 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Wed, 2 Nov 2016 15:07:13 +0530 Subject: [PATCH 09/14] Adding try catch for xunit test to get logs --- ...ildsAndRunsTestFromCsprojForMultipleTFM.cs | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs index 9957efff4..8a5373393 100644 --- a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -92,15 +92,34 @@ namespace Microsoft.DotNet.Cli.Test.Tests .WithWorkingDirectory(testProjectDirectory) .ExecuteWithCapturedOutput(); + 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.VSTestXunitTests.VSTestXunitPassTestDesktop"); - // 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"); + // 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()); - // 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"); + 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("**************************************************************************************************"); + } } } } From 4af8d52a23710b3e71674341291bdf046f0c4ed2 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Wed, 2 Nov 2016 18:11:36 +0530 Subject: [PATCH 10/14] Updated the version of microsoft.testplatform.cli package --- build/Microsoft.DotNet.Cli.Compile.targets | 2 +- src/redist/redist.csproj | 2 +- ...nDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index 33dc22518..cc79410e7 100644 --- a/build/Microsoft.DotNet.Cli.Compile.targets +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -97,7 +97,7 @@ - + diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index d459c888c..59fd617c9 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -33,7 +33,7 @@ 4.0.0-rc-2037 - 15.0.0-preview-20161101-02 + 15.0.0-preview-20161102-02 15.0.0-preview-20161028-03 diff --git a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs index 8a5373393..d37ab18d3 100644 --- a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -90,7 +90,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests // Call test CommandResult result = new DotnetTestCommand() .WithWorkingDirectory(testProjectDirectory) - .ExecuteWithCapturedOutput(); + .ExecuteWithCapturedOutput("--diag LogFile2.txt"); try { @@ -111,8 +111,8 @@ namespace Microsoft.DotNet.Cli.Test.Tests Console.WriteLine("*********************************Xunit StdErr****************************************************************"); Console.WriteLine(result.StdErr.ToString()); - string logfile1 = Path.Combine(testProjectDirectory, "LogFile.txt"); - string[] logfile2 = Directory.GetFiles(testProjectDirectory, "LogFile.host.*"); + string logfile1 = Path.Combine(testProjectDirectory, "LogFile2.txt"); + string[] logfile2 = Directory.GetFiles(testProjectDirectory, "LogFile2.host.*"); Console.WriteLine("**********************************Xunit Vstest.console Log****************************************************************"); Console.WriteLine(File.ReadAllText(logfile1)); From dc249a94e91fc27797774706bf1209aa9f4d5b12 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Wed, 2 Nov 2016 21:34:35 +0530 Subject: [PATCH 11/14] Logging --- ...otnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs index d37ab18d3..3823bf267 100644 --- a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -65,8 +65,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests Console.WriteLine("**********************************Vstest.console Log****************************************************************"); Console.WriteLine(File.ReadAllText(logfile1)); - Console.WriteLine("**********************************TestHost Log****************************************************************"); + Console.WriteLine("**********************************TestHost Log1****************************************************************"); Console.WriteLine(logfile2.Length > 0 ? File.ReadAllText(logfile2[0]) : "No log file found"); + Console.WriteLine("**********************************TestHost Log2****************************************************************"); + Console.WriteLine(logfile2.Length > 1 ? File.ReadAllText(logfile2[1]) : "No log file found"); Console.WriteLine("**************************************************************************************************"); } } @@ -116,8 +118,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests Console.WriteLine("**********************************Xunit Vstest.console Log****************************************************************"); Console.WriteLine(File.ReadAllText(logfile1)); - Console.WriteLine("**********************************Xunit TestHost Log****************************************************************"); + Console.WriteLine("**********************************Xunit TestHost Log1****************************************************************"); Console.WriteLine(logfile2.Length > 0 ? File.ReadAllText(logfile2[0]) : "No log file found"); + Console.WriteLine("**********************************Xunit TestHost Log2****************************************************************"); + Console.WriteLine(logfile2.Length > 1 ? File.ReadAllText(logfile2[1]) : "No log file found"); Console.WriteLine("**************************************************************************************************"); } } From 111499899d0e598a0858195d6ce37a7fa480dda3 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Wed, 2 Nov 2016 23:38:20 +0530 Subject: [PATCH 12/14] Reduced the test name to overcome 256 character file length limit in windows --- .../Tests.cs | 0 .../VSTestDesktopAndNetCore.csproj} | 0 .../Tests.cs | 0 .../VSTestDotNetCore.csproj} | 0 .../Nuget.config | 0 .../UnitTest1.cs | 0 .../VSTestXunitDesktopAndNetCore.csproj} | 0 .../Nuget.config | 0 .../UnitTest1.cs | 0 .../VSTestXunitDotNetCore.csproj} | 0 ...ildsAndRunsTestFromCsprojForMultipleTFM.cs | 86 ++++--------------- ...enDotnetTestBuildsAndRunsTestfromCsproj.cs | 4 +- 12 files changed, 20 insertions(+), 70 deletions(-) rename TestAssets/TestProjects/{VSTestDesktopAndNetCoreApp => VSTestDesktopAndNetCore}/Tests.cs (100%) rename TestAssets/TestProjects/{VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj => VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj} (100%) rename TestAssets/TestProjects/{VSTestDotNetCoreProject => VSTestDotNetCore}/Tests.cs (100%) rename TestAssets/TestProjects/{VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj => VSTestDotNetCore/VSTestDotNetCore.csproj} (100%) rename TestAssets/TestProjects/{VSTestXunitDesktopAndNetCoreApp => VSTestXunitDesktopAndNetCore}/Nuget.config (100%) rename TestAssets/TestProjects/{VSTestXunitDesktopAndNetCoreApp => VSTestXunitDesktopAndNetCore}/UnitTest1.cs (100%) rename TestAssets/TestProjects/{VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj => VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj} (100%) rename TestAssets/TestProjects/{VSTestXunitDotNetCoreProject => VSTestXunitDotNetCore}/Nuget.config (100%) rename TestAssets/TestProjects/{VSTestXunitDotNetCoreProject => VSTestXunitDotNetCore}/UnitTest1.cs (100%) rename TestAssets/TestProjects/{VSTestXunitDotNetCoreProject/VSTestXunitDotNetCoreProject.csproj => VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj} (100%) diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs b/TestAssets/TestProjects/VSTestDesktopAndNetCore/Tests.cs similarity index 100% rename from TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/Tests.cs rename to TestAssets/TestProjects/VSTestDesktopAndNetCore/Tests.cs diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj b/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj similarity index 100% rename from TestAssets/TestProjects/VSTestDesktopAndNetCoreApp/VSTestDesktopAndNetCoreApp.csproj rename to TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj diff --git a/TestAssets/TestProjects/VSTestDotNetCoreProject/Tests.cs b/TestAssets/TestProjects/VSTestDotNetCore/Tests.cs similarity index 100% rename from TestAssets/TestProjects/VSTestDotNetCoreProject/Tests.cs rename to TestAssets/TestProjects/VSTestDotNetCore/Tests.cs diff --git a/TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj b/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj similarity index 100% rename from TestAssets/TestProjects/VSTestDotNetCoreProject/VSTestDotNetCoreProject.csproj rename to TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/Nuget.config similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/Nuget.config rename to TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/Nuget.config diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/UnitTest1.cs similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/UnitTest1.cs rename to TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/UnitTest1.cs diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDesktopAndNetCoreApp/VSTestXunitDesktopAndNetCoreApp.csproj rename to TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config b/TestAssets/TestProjects/VSTestXunitDotNetCore/Nuget.config similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDotNetCoreProject/Nuget.config rename to TestAssets/TestProjects/VSTestXunitDotNetCore/Nuget.config diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs b/TestAssets/TestProjects/VSTestXunitDotNetCore/UnitTest1.cs similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDotNetCoreProject/UnitTest1.cs rename to TestAssets/TestProjects/VSTestXunitDotNetCore/UnitTest1.cs diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCoreProject/VSTestXunitDotNetCoreProject.csproj b/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj similarity index 100% rename from TestAssets/TestProjects/VSTestXunitDotNetCoreProject/VSTestXunitDotNetCoreProject.csproj rename to TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj diff --git a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs index 3823bf267..e1dcde289 100644 --- a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -12,15 +12,10 @@ namespace Microsoft.DotNet.Cli.Test.Tests { public class GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM : TestBase { - // Adding log to root cause test failure for net46 - private const string vstestLog = "VSTEST_TRACE_BUILD"; - // project targeting net46 will not run in non windows machine. [WindowsOnlyFact] - public void TestsFromAGivenProjectShouldRunWithExpectedOutputForMultiTFM() + public void MStestMultiTFM() { - Environment.SetEnvironmentVariable(vstestLog, "1"); - // Copy VSTestDesktopAndNetCoreApp project in output directory of project dotnet-test.Tests string testAppName = "VSTestDesktopAndNetCoreApp"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); @@ -37,44 +32,21 @@ namespace Microsoft.DotNet.Cli.Test.Tests // Call test CommandResult result = new DotnetTestCommand() .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.VSTestTests.VSTestPassTestDesktop"); - 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 - { - Console.WriteLine("*********************************StdOut****************************************************************"); - Console.WriteLine(result.StdOut.ToString()); - - Console.WriteLine("*********************************StdErr****************************************************************"); - Console.WriteLine(result.StdErr.ToString()); - - string logfile1 = Path.Combine(testProjectDirectory, "LogFile.txt"); - string[] logfile2 = Directory.GetFiles(testProjectDirectory, "LogFile.host.*"); - - Console.WriteLine("**********************************Vstest.console Log****************************************************************"); - Console.WriteLine(File.ReadAllText(logfile1)); - Console.WriteLine("**********************************TestHost Log1****************************************************************"); - Console.WriteLine(logfile2.Length > 0 ? File.ReadAllText(logfile2[0]) : "No log file found"); - Console.WriteLine("**********************************TestHost Log2****************************************************************"); - Console.WriteLine(logfile2.Length > 1 ? File.ReadAllText(logfile2[1]) : "No log file found"); - 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"); } [WindowsOnlyFact] - public void TestsFromAGivenXunitProjectShouldRunWithExpectedOutputForMultiTFM() + public void XunitMultiTFM() { // Copy VSTestXunitDesktopAndNetCoreApp project in output directory of project dotnet-test.Tests string testAppName = "VSTestXunitDesktopAndNetCoreApp"; @@ -92,38 +64,16 @@ namespace Microsoft.DotNet.Cli.Test.Tests // Call test CommandResult result = new DotnetTestCommand() .WithWorkingDirectory(testProjectDirectory) - .ExecuteWithCapturedOutput("--diag LogFile2.txt"); + .ExecuteWithCapturedOutput(); - 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.VSTestXunitTests.VSTestXunitPassTestDesktop"); + // 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"); - // 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, "LogFile2.txt"); - string[] logfile2 = Directory.GetFiles(testProjectDirectory, "LogFile2.host.*"); - - Console.WriteLine("**********************************Xunit Vstest.console Log****************************************************************"); - Console.WriteLine(File.ReadAllText(logfile1)); - Console.WriteLine("**********************************Xunit TestHost Log1****************************************************************"); - Console.WriteLine(logfile2.Length > 0 ? File.ReadAllText(logfile2[0]) : "No log file found"); - Console.WriteLine("**********************************Xunit TestHost Log2****************************************************************"); - Console.WriteLine(logfile2.Length > 1 ? File.ReadAllText(logfile2[1]) : "No log file found"); - 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.VSTestXunitTests.VSTestXunitFailTestNetCoreApp"); } } } diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index 429708e90..4f2f7322f 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests public class GivenDotnettestBuildsAndRunsTestfromCsproj : TestBase { [Fact] - public void TestsFromAGivenProjectShouldRunWithExpectedOutput() + public void MSTestSingleTFM() { // Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests string testAppName = "VSTestDotNetCoreProject"; @@ -41,7 +41,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests } [Fact] - public void TestsFromAGivenXunitProjectShouldRunWithExpectedOutput() + public void XunitSingleTFM() { // Copy VSTestXunitDotNetCoreProject project in output directory of project dotnet-vstest.Tests string testAppName = "VSTestXunitDotNetCoreProject"; From 734afe84cf8aea22295a600c8c8f4d956085a1f6 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Thu, 3 Nov 2016 00:14:03 +0530 Subject: [PATCH 13/14] Update test to point new short name test assets --- ...ildsAndRunsTestFromCsprojForMultipleTFM.cs | 12 +++++------ ...enDotnetTestBuildsAndRunsTestfromCsproj.cs | 20 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs index e1dcde289..3ef4dc3af 100644 --- a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -16,13 +16,13 @@ namespace Microsoft.DotNet.Cli.Test.Tests [WindowsOnlyFact] public void MStestMultiTFM() { - // Copy VSTestDesktopAndNetCoreApp project in output directory of project dotnet-test.Tests - string testAppName = "VSTestDesktopAndNetCoreApp"; + // Copy VSTestDesktopAndNetCore project in output directory of project dotnet-test.Tests + string testAppName = "VSTestDesktopAndNetCore"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); string testProjectDirectory = testInstance.TestRoot; - // Restore project VSTestDesktopAndNetCoreApp + // Restore project VSTestDesktopAndNetCore new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() @@ -48,13 +48,13 @@ namespace Microsoft.DotNet.Cli.Test.Tests [WindowsOnlyFact] public void XunitMultiTFM() { - // Copy VSTestXunitDesktopAndNetCoreApp project in output directory of project dotnet-test.Tests - string testAppName = "VSTestXunitDesktopAndNetCoreApp"; + // Copy VSTestXunitDesktopAndNetCore project in output directory of project dotnet-test.Tests + string testAppName = "VSTestXunitDesktopAndNetCore"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); string testProjectDirectory = testInstance.TestRoot; - // Restore project VSTestXunitDesktopAndNetCoreApp + // Restore project VSTestXunitDesktopAndNetCore new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index 4f2f7322f..37f527585 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -16,13 +16,13 @@ namespace Microsoft.DotNet.Cli.Test.Tests [Fact] public void MSTestSingleTFM() { - // Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests - string testAppName = "VSTestDotNetCoreProject"; + // 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 VSTestDotNetCoreProject + // Restore project VSTestDotNetCore new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() @@ -43,13 +43,13 @@ namespace Microsoft.DotNet.Cli.Test.Tests [Fact] public void XunitSingleTFM() { - // Copy VSTestXunitDotNetCoreProject project in output directory of project dotnet-vstest.Tests - string testAppName = "VSTestXunitDotNetCoreProject"; + // Copy VSTestXunitDotNetCore project in output directory of project dotnet-vstest.Tests + string testAppName = "VSTestXunitDotNetCore"; TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName); string testProjectDirectory = testInstance.TestRoot; - // Restore project VSTestXunitDotNetCoreProject + // Restore project VSTestXunitDotNetCore new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() @@ -70,13 +70,13 @@ namespace Microsoft.DotNet.Cli.Test.Tests [Fact] public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven() { - // Copy VSTestDotNetCoreProject project in output directory of project dotnet-vstest.Tests - string testAppName = "VSTestDotNetCoreProject"; + // 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 VSTestDotNetCoreProject + // Restore project VSTestDotNetCore new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() @@ -85,7 +85,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; string expectedError = Path.Combine(testProjectDirectory, "bin", - configuration, "netcoreapp1.0", "VSTestDotNetCoreProject.dll"); + configuration, "netcoreapp1.0", "VSTestDotNetCore.dll"); expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found."; // Call test From fa4fad1ba02d4f873c4579d7e6d522cc64c0df94 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Thu, 3 Nov 2016 00:49:49 +0530 Subject: [PATCH 14/14] Update vstest test to use short name test asset --- test/dotnet-vstest.Tests/VSTestTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/dotnet-vstest.Tests/VSTestTests.cs b/test/dotnet-vstest.Tests/VSTestTests.cs index e3d685090..addfa6afa 100644 --- a/test/dotnet-vstest.Tests/VSTestTests.cs +++ b/test/dotnet-vstest.Tests/VSTestTests.cs @@ -16,20 +16,20 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests [Fact] public void TestsFromAGivenContainerShouldRunWithExpectedOutput() { - // Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests - string testAppName = "VSTestDotNetCoreProject"; + // 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 VSTestDotNetCoreProject + // Restore project VSTestDotNetCore new RestoreCommand() .WithWorkingDirectory(testProjectDirectory) .Execute() .Should() .Pass(); - // Build project VSTestDotNetCoreProject + // Build project VSTestDotNetCore new BuildCommand() .WithWorkingDirectory(testProjectDirectory) .Execute()