From 2cc790ac755cb3794a395fe6bf28778566eb8a09 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Tue, 22 Nov 2016 23:35:02 +0530 Subject: [PATCH 1/6] Bug fixes --- .../VSTestDesktopAndNetCore.csproj | 7 ++++--- .../VSTestDotNetCore/VSTestDotNetCore.csproj | 6 +++--- .../VSTestXunitDesktopAndNetCore.csproj | 2 +- .../VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj | 2 +- build/Microsoft.DotNet.Cli.Compile.targets | 2 +- .../Microsoft.TestPlatform.CrossTargeting.targets | 10 +++++++++- .../dotnet-new/CSharp_Mstest/$projectName$.csproj | 6 +++--- .../dotnet-new/CSharp_Xunittest/$projectName$.csproj | 2 +- src/redist/redist.csproj | 4 ++-- 9 files changed, 25 insertions(+), 16 deletions(-) diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj b/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj index 4758dc3b24..3f635f61e1 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj +++ b/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj @@ -4,6 +4,7 @@ Exe net46;netcoreapp1.0 + win7-x64 @@ -26,13 +27,13 @@ All - 1.0.5-preview + 1.0.6-preview - 1.1.4-preview + 1.1.5-preview - 15.0.0-preview-20161024-02 + 15.0.0-preview-20161122-02 diff --git a/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj b/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj index db9d8f51a5..7f644e9e4e 100644 --- a/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj +++ b/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj @@ -19,13 +19,13 @@ All - 1.0.5-preview + 1.0.6-preview - 1.1.4-preview + 1.1.5-preview - 15.0.0-preview-20161024-02 + 15.0.0-preview-20161122-02 diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj index 9b09ff0b76..48cb84e2fe 100644 --- a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj +++ b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj @@ -26,7 +26,7 @@ All - 15.0.0-preview-20161024-02 + 15.0.0-preview-20161122-02 2.2.0-beta4-build3444 diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj b/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj index b318a9fcda..0eb8d81aaf 100644 --- a/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj +++ b/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj @@ -20,7 +20,7 @@ All - 15.0.0-preview-20161024-02 + 15.0.0-preview-20161122-02 2.2.0-beta4-build3444 diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index ca95e66f49..9017625f94 100644 --- a/build/Microsoft.DotNet.Cli.Compile.targets +++ b/build/Microsoft.DotNet.Cli.Compile.targets @@ -97,7 +97,7 @@ - + diff --git a/resources/MSBuildImports/15.0/Microsoft.Common.CrossTargeting.targets/ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets b/resources/MSBuildImports/15.0/Microsoft.Common.CrossTargeting.targets/ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets index 3ec63dfeac..964126f3b4 100644 --- a/resources/MSBuildImports/15.0/Microsoft.Common.CrossTargeting.targets/ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets +++ b/resources/MSBuildImports/15.0/Microsoft.Common.CrossTargeting.targets/ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets @@ -11,8 +11,10 @@ Copyright (c) .NET Foundation. All rights reserved. --> + $(MSBuildExtensionsPath)\Microsoft.TestPlatform.Build.dll $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + - + + + + + + + VSTest diff --git a/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj index 83514f920e..fd1357b914 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj @@ -20,13 +20,13 @@ All - 15.0.0-preview-20161024-02 + 15.0.0-preview-20161122-02 - 1.1.3-preview + 1.1.5-preview - 1.0.4-preview + 1.0.6-preview diff --git a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj index db356ca9d0..604aa8db36 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj @@ -20,7 +20,7 @@ All - 15.0.0-preview-20161024-02 + 15.0.0-preview-20161122-02 2.2.0-beta4-build3444 diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 95e2160475..ad1ad8695a 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -33,10 +33,10 @@ 4.0.0-rc2 - 15.0.0-preview-20161102-02 + 15.0.0-preview-20161122-02 - 15.0.0-preview-20161107-06 + 15.0.0-preview-20161122-02 From e4e9c4e788198cfc8784784aa0e67c9b959d4ba4 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Tue, 22 Nov 2016 23:41:28 +0530 Subject: [PATCH 2/6] Nitpick --- .../VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj b/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj index 3f635f61e1..7894663149 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj +++ b/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj @@ -4,7 +4,6 @@ Exe net46;netcoreapp1.0 - win7-x64 From 596d3ecbf7346907147b8579d935036e04809961 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Wed, 23 Nov 2016 16:01:40 +0530 Subject: [PATCH 3/6] -Fixed failed tests -Added test to cover trx logger scenario. --- src/dotnet/commands/dotnet-test/Program.cs | 2 ++ src/redist/redist.csproj | 2 +- ...ldsAndRunsTestFromCsprojForMultipleTFM.cs} | 2 +- ...enDotnetTestBuildsAndRunsTestfromCsproj.cs | 35 +++++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) rename test/dotnet-test.Tests/{GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs => GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs} (97%) diff --git a/src/dotnet/commands/dotnet-test/Program.cs b/src/dotnet/commands/dotnet-test/Program.cs index a200c09607..11dfd861c3 100644 --- a/src/dotnet/commands/dotnet-test/Program.cs +++ b/src/dotnet/commands/dotnet-test/Program.cs @@ -24,6 +24,8 @@ public static int Run(string[] args) Description = "Test Driver for the .NET Platform" }; + cmd.AllowArgumentSeparator = true; + cmd.ArgumentSeparatorHelpText = HelpMessageStrings.MSBuildAdditionalArgsHelpText; cmd.HelpOption("-h|--help"); var argRoot = cmd.Argument( diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index ad1ad8695a..56d3cc1159 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -36,7 +36,7 @@ 15.0.0-preview-20161122-02 - 15.0.0-preview-20161122-02 + 15.0.0-preview-20161123-02 diff --git a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs similarity index 97% rename from test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs rename to test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs index fe34143a31..ac1eeaddbf 100644 --- a/test/dotnet-test.Tests/GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs @@ -10,7 +10,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests { - public class GivenDotnetTest3BuildsAndRunsTestFromCsprojForMultipleTFM : TestBase + public class GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM : TestBase { [WindowsOnlyFact(Skip="https://github.com/dotnet/cli/issues/4616")] public void MStestMultiTFM() diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index 37f5275859..8bde5e77e2 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -96,5 +96,40 @@ public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven() // 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]); + } } } \ No newline at end of file From 583734b750fa9e252b66042ce9c2e7f13dccac00 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Wed, 23 Nov 2016 18:24:39 +0530 Subject: [PATCH 4/6] Fix for issue https://github.com/Microsoft/vstest/issues/241 --- src/redist/redist.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 56d3cc1159..bee11a8c93 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -36,7 +36,7 @@ 15.0.0-preview-20161122-02 - 15.0.0-preview-20161123-02 + 15.0.0-preview-20161123-03 From c1416b480253a708a15a4e0de55aaadc273864b0 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Thu, 24 Nov 2016 01:20:23 +0530 Subject: [PATCH 5/6] 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 --- .../ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/MSBuildImports/15.0/Microsoft.Common.CrossTargeting.targets/ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets b/resources/MSBuildImports/15.0/Microsoft.Common.CrossTargeting.targets/ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets index 964126f3b4..16ce339ae8 100644 --- a/resources/MSBuildImports/15.0/Microsoft.Common.CrossTargeting.targets/ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets +++ b/resources/MSBuildImports/15.0/Microsoft.Common.CrossTargeting.targets/ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets @@ -40,7 +40,8 @@ Copyright (c) .NET Foundation. All rights reserved. + Properties="TargetFramework=%(_TargetFramework.Identity);VSTestNoBuild=true" + ContinueOnError="true"> From b7cd88633f4940d76c3d511bcd18696bc90aa008 Mon Sep 17 00:00:00 2001 From: Faizan Ahmad Date: Thu, 24 Nov 2016 11:45:42 +0530 Subject: [PATCH 6/6] Bump Microsoft.Testplatform.CLI and Microsoft.NET.Test.Sdk version --- .../VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj | 2 +- .../TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj | 2 +- .../VSTestXunitDesktopAndNetCore.csproj | 2 +- .../VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj | 2 +- build/Microsoft.DotNet.Cli.Compile.targets | 2 +- .../commands/dotnet-new/CSharp_Mstest/$projectName$.csproj | 2 +- .../commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj | 2 +- src/redist/redist.csproj | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj b/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj index 7894663149..b1b182f072 100644 --- a/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj +++ b/TestAssets/TestProjects/VSTestDesktopAndNetCore/VSTestDesktopAndNetCore.csproj @@ -32,7 +32,7 @@ 1.1.5-preview - 15.0.0-preview-20161122-02 + 15.0.0-preview-20161123-03 diff --git a/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj b/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj index 7f644e9e4e..6b0d3573f8 100644 --- a/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj +++ b/TestAssets/TestProjects/VSTestDotNetCore/VSTestDotNetCore.csproj @@ -25,7 +25,7 @@ 1.1.5-preview - 15.0.0-preview-20161122-02 + 15.0.0-preview-20161123-03 diff --git a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj index 48cb84e2fe..cb10dcf42e 100644 --- a/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj +++ b/TestAssets/TestProjects/VSTestXunitDesktopAndNetCore/VSTestXunitDesktopAndNetCore.csproj @@ -26,7 +26,7 @@ All - 15.0.0-preview-20161122-02 + 15.0.0-preview-20161123-03 2.2.0-beta4-build3444 diff --git a/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj b/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj index 0eb8d81aaf..b2c8afc166 100644 --- a/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj +++ b/TestAssets/TestProjects/VSTestXunitDotNetCore/VSTestXunitDotNetCore.csproj @@ -20,7 +20,7 @@ All - 15.0.0-preview-20161122-02 + 15.0.0-preview-20161123-03 2.2.0-beta4-build3444 diff --git a/build/Microsoft.DotNet.Cli.Compile.targets b/build/Microsoft.DotNet.Cli.Compile.targets index 9017625f94..14ef2371d3 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-new/CSharp_Mstest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj index fd1357b914..410830bcac 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Mstest/$projectName$.csproj @@ -20,7 +20,7 @@ All - 15.0.0-preview-20161122-02 + 15.0.0-preview-20161123-03 1.1.5-preview diff --git a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj index 604aa8db36..ec72af7b9d 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj +++ b/src/dotnet/commands/dotnet-new/CSharp_Xunittest/$projectName$.csproj @@ -20,7 +20,7 @@ All - 15.0.0-preview-20161122-02 + 15.0.0-preview-20161123-03 2.2.0-beta4-build3444 diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index bee11a8c93..de4271c428 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -33,7 +33,7 @@ 4.0.0-rc2 - 15.0.0-preview-20161122-02 + 15.0.0-preview-20161123-03 15.0.0-preview-20161123-03