From 4a65248e3073283d85e19bc9de058a855bccc16e Mon Sep 17 00:00:00 2001
From: Medeni Baykal <433724+Haplois@users.noreply.github.com>
Date: Mon, 2 Nov 2020 09:48:05 +0100
Subject: [PATCH] Added support for `ManagedType` and `ManagedMethod`.
Added support for `ManagedType` and `ManagedMethod` into various classes. Also centralized TestPlarform version, and some refactoring.
---
scripts/Build.ps1 | 24 +++++++++
scripts/build/TestFx.Settings.targets | 1 +
scripts/test.ps1 | 1 -
.../Discovery/TypeEnumerator.cs | 2 +-
.../MSTest.CoreAdapter.csproj | 7 +--
.../ObjectModel/TestMethod.cs | 23 +++++++-
.../ObjectModel/UnitTestElement.cs | 15 +++++-
.../PlatformServices.Desktop.csproj | 6 +--
.../DesktopTestContextImplementation.cs | 52 +++++++++----------
.../ObjectModel/ITestMethod.cs | 16 ++++++
.../PlatformServices.Interface.csproj | 6 +--
.../PlatformServices.NetCore.csproj | 2 +-
.../NetCoreTestContextImplementation.cs | 8 ++-
.../PlatformServices.Portable.csproj | 6 +--
.../Services/ns10TestContextImplementation.cs | 8 ++-
.../ns10TestContextPropertyStrings.cs | 2 +
.../Extension.Core/NetCoreTestContext.cs | 10 ++++
.../Extension.Desktop/DesktopTestContext.cs | 10 ++++
.../Extension.Shared/TestContext.cs | 10 ++++
...ormServices.Desktop.Component.Tests.csproj | 6 +--
.../TestProjectForAssemblyResolution.csproj | 1 -
.../Automation.CLI/Automation.CLI.csproj | 12 ++---
test/E2ETests/Automation.CLI/CLITestBase.cs | 6 ++-
test/E2ETests/Automation.CLI/packages.config | 4 +-
.../DeploymentTestProjectNetCore.csproj | 2 +-
.../TimeoutTestProjectNetCore.csproj | 2 +-
.../MSTest.CoreAdapter.Unit.Tests.csproj | 6 +--
...PlatformServices.Desktop.Unit.Tests.csproj | 6 +--
...PlatformServices.NetCore.Unit.Tests.csproj | 2 +-
...latformServices.Portable.Unit.Tests.csproj | 6 +--
...atformServices.Universal.Unit.Tests.csproj | 6 +--
31 files changed, 190 insertions(+), 78 deletions(-)
diff --git a/scripts/Build.ps1 b/scripts/Build.ps1
index 73eab4d97b..9ef6c45582 100644
--- a/scripts/Build.ps1
+++ b/scripts/Build.ps1
@@ -307,7 +307,31 @@ function Create-NugetPackages
Write-Log "Create-NugetPackages: Complete. {$(Get-ElapsedTime($timer))}"
}
+function Replace-InFile($File, $RegEx, $ReplaceWith) {
+ $content = Get-Content -Raw -Encoding utf8 $File
+ $newContent = ($content -replace $RegEx,$ReplaceWith)
+ if($content.Equals($ReplaceWith)) {
+ return
+ }
+
+ Write-Verbose "Updating TestPlatform version in $_"
+ $newContent | Set-Content -Encoding utf8 $file -NoNewline
+}
+
+function Sync-PackageVersions {
+ $testPlarformVersion = (([XML](Get-Content $PSScriptRoot\build\TestFx.Settings.targets)).Project.PropertyGroup[1].TestPlatfromVersion).InnerText
+ $packageRegex = '(?mi)
+ 16.9.0-preview-20201021-10
11.0
Debug
AnyCPU
diff --git a/scripts/test.ps1 b/scripts/test.ps1
index 1fbaccee9b..153ccad317 100644
--- a/scripts/test.ps1
+++ b/scripts/test.ps1
@@ -50,7 +50,6 @@ $TFT_Pattern = $Pattern
$TFT_Parallel = $Parallel
$TFT_All = $All
$TestFramework = ".NETCoreApp,Version=v1.0"
-$VSTestConsoleRelativePath = "Microsoft.TestPlatform.15.0.1\tools\net46\vstest.console.exe"
#
# Prints help text for the switches this script supports.
diff --git a/src/Adapter/MSTest.CoreAdapter/Discovery/TypeEnumerator.cs b/src/Adapter/MSTest.CoreAdapter/Discovery/TypeEnumerator.cs
index 11e6e30f83..3a5e9c61dd 100644
--- a/src/Adapter/MSTest.CoreAdapter/Discovery/TypeEnumerator.cs
+++ b/src/Adapter/MSTest.CoreAdapter/Discovery/TypeEnumerator.cs
@@ -132,7 +132,7 @@ internal UnitTestElement GetTestFromMethod(MethodInfo method, bool isDeclaredInT
// This allows void returning async test method to be valid test method. Though they will be executed similar to non-async test method.
var isAsync = ReflectHelper.MatchReturnType(method, typeof(Task));
- var testMethod = new TestMethod(method.Name, this.type.FullName, this.assemblyName, isAsync);
+ var testMethod = new TestMethod(method, method.Name, this.type.FullName, this.assemblyName, isAsync);
if (!method.DeclaringType.FullName.Equals(this.type.FullName))
{
diff --git a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj
index 9fbee04dd3..6c8e04fba7 100644
--- a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj
+++ b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj
@@ -113,15 +113,16 @@
+
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\netstandard1.0\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\netstandard1.0\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\netstandard1.0\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\netstandard1.0\Microsoft.TestPlatform.PlatformAbstractions.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\System.Collections.Concurrent.dll
diff --git a/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs b/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs
index 2af0ef2b98..f27fe855a5 100644
--- a/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs
+++ b/src/Adapter/MSTest.CoreAdapter/ObjectModel/TestMethod.cs
@@ -5,6 +5,9 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel
{
using System;
using System.Diagnostics;
+ using System.Reflection;
+
+ using Microsoft.VisualStudio.TestPlatform.ObjectModel.FullyQualifiedNameUtilities;
using MSTestAdapter.PlatformServices.Interface.ObjectModel;
@@ -28,7 +31,7 @@ public sealed class TestMethod : ITestMethod
#endregion
- public TestMethod(string name, string fullClassName, string assemblyName, bool isAsync)
+ public TestMethod(string name, string fullClassName, string assemblyName, bool isAsync)
{
if (string.IsNullOrEmpty(assemblyName))
{
@@ -44,6 +47,20 @@ public TestMethod(string name, string fullClassName, string assemblyName, bool
this.IsAsync = isAsync;
}
+ public TestMethod(MethodBase method, string name, string fullClassName, string assemblyName, bool isAsync)
+ : this(name, fullClassName, assemblyName, isAsync)
+ {
+ if (method == null)
+ {
+ throw new ArgumentNullException(nameof(method));
+ }
+
+ FullyQualifiedNameHelper.GetFullyQualifiedName(method, out var managedType, out var managedMethod);
+
+ this.ManagedType = managedType;
+ this.ManagedMethod = managedMethod;
+ }
+
///
/// Gets the name of the test method
///
@@ -102,5 +119,9 @@ public string DeclaringClassFullName
/// Gets a value indicating whether specifies test method is async
///
public bool IsAsync { get; private set; }
+
+ public string ManagedType { get; }
+
+ public string ManagedMethod { get; }
}
}
diff --git a/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs b/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs
index b39abe7763..43abaa2088 100644
--- a/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs
+++ b/src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs
@@ -114,10 +114,21 @@ internal TestCase ToTestCase()
this.TestMethod.FullClassName,
this.TestMethod.Name);
- TestCase testCase = new TestCase(fullName, TestAdapter.Constants.ExecutorUri, this.TestMethod.AssemblyName);
- testCase.DisplayName = string.IsNullOrEmpty(this.DisplayName) ? this.TestMethod.Name : this.DisplayName;
+ TestCase testCase;
+ if (string.IsNullOrWhiteSpace(this.TestMethod.ManagedType) || string.IsNullOrWhiteSpace(this.TestMethod.ManagedMethod))
+ {
+ testCase = new TestCase(fullName, TestAdapter.Constants.ExecutorUri, this.TestMethod.AssemblyName);
+ }
+ else
+ {
+ testCase = new TestCase(fullName, this.TestMethod.ManagedType, this.TestMethod.ManagedMethod, TestAdapter.Constants.ExecutorUri, this.TestMethod.AssemblyName);
+ }
+
+ testCase.DisplayName = string.IsNullOrEmpty(this.DisplayName) ? this.TestMethod.Name : this.DisplayName;
testCase.SetPropertyValue(TestAdapter.Constants.TestClassNameProperty, this.TestMethod.FullClassName);
+ testCase.SetPropertyValue(TestCaseProperties.ManagedType, this.TestMethod.ManagedType);
+ testCase.SetPropertyValue(TestCaseProperties.ManagedMethod, this.TestMethod.ManagedMethod);
// Set declaring type if present so the correct method info can be retrieved
if (this.TestMethod.DeclaringClassFullName != null)
diff --git a/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj b/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj
index be1334b6dc..ef1c68d319 100644
--- a/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj
+++ b/src/Adapter/PlatformServices.Desktop/PlatformServices.Desktop.csproj
@@ -31,13 +31,13 @@
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net45\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net45\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net45\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net45\Microsoft.TestPlatform.PlatformAbstractions.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net45\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net45\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
..\..\..\packages\NuGet.Frameworks.5.0.0\lib\net40\NuGet.Frameworks.dll
diff --git a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs
index 8b36dae876..30fe477db1 100644
--- a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs
+++ b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestContextImplementation.cs
@@ -14,8 +14,10 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices
using System.IO;
using System.Linq;
using System.Threading;
+
using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface;
using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.ObjectModel;
+
using UTF = Microsoft.VisualStudio.TestTools.UnitTesting;
///
@@ -208,6 +210,24 @@ public override string FullyQualifiedTestClassName
}
}
+ ///
+ public override string ManagedType
+ {
+ get
+ {
+ return this.GetStringPropertyValue(TestContextPropertyStrings.ManagedType);
+ }
+ }
+
+ ///
+ public override string ManagedMethod
+ {
+ get
+ {
+ return this.GetStringPropertyValue(TestContextPropertyStrings.ManagedMethod);
+ }
+ }
+
///
public override string TestName
{
@@ -450,40 +470,16 @@ private static UTF.UnitTestOutcome ToUTF(UTF.UnitTestOutcome outcome)
switch (outcome)
{
case UTF.UnitTestOutcome.Error:
- {
- return UTF.UnitTestOutcome.Error;
- }
-
case UTF.UnitTestOutcome.Failed:
- {
- return UTF.UnitTestOutcome.Failed;
- }
-
case UTF.UnitTestOutcome.Inconclusive:
- {
- return UTF.UnitTestOutcome.Inconclusive;
- }
-
case UTF.UnitTestOutcome.Passed:
- {
- return UTF.UnitTestOutcome.Passed;
- }
-
case UTF.UnitTestOutcome.Timeout:
- {
- return UTF.UnitTestOutcome.Timeout;
- }
-
case UTF.UnitTestOutcome.InProgress:
- {
- return UTF.UnitTestOutcome.InProgress;
- }
+ return outcome;
default:
- {
- Debug.Fail("Unknown outcome " + outcome);
- return UTF.UnitTestOutcome.Unknown;
- }
+ Debug.Fail("Unknown outcome " + outcome);
+ return UTF.UnitTestOutcome.Unknown;
}
}
@@ -505,6 +501,8 @@ private string GetStringPropertyValue(string propertyName)
private void InitializeProperties()
{
this.properties[TestContextPropertyStrings.FullyQualifiedTestClassName] = this.testMethod.FullClassName;
+ this.properties[TestContextPropertyStrings.ManagedType] = this.testMethod.ManagedType;
+ this.properties[TestContextPropertyStrings.ManagedMethod] = this.testMethod.ManagedMethod;
this.properties[TestContextPropertyStrings.TestName] = this.testMethod.Name;
}
}
diff --git a/src/Adapter/PlatformServices.Interface/ObjectModel/ITestMethod.cs b/src/Adapter/PlatformServices.Interface/ObjectModel/ITestMethod.cs
index 5d3abe84dd..7a270973f7 100644
--- a/src/Adapter/PlatformServices.Interface/ObjectModel/ITestMethod.cs
+++ b/src/Adapter/PlatformServices.Interface/ObjectModel/ITestMethod.cs
@@ -33,5 +33,21 @@ public interface ITestMethod
/// Gets a value indicating whether test method is async
///
bool IsAsync { get; }
+
+ ///
+ /// Gets the fully specified type name metadata format.
+ ///
+ ///
+ /// NamespaceA.NamespaceB.ClassName`1+InnerClass`2
+ ///
+ string ManagedType { get; }
+
+ ///
+ /// Gets the fully specified method name metadata format.
+ ///
+ ///
+ /// MethodName`2(ParamTypeA,ParamTypeB,…)
+ ///
+ string ManagedMethod { get; }
}
}
diff --git a/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj b/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj
index 3d7c2bc883..5775f07da3 100644
--- a/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj
+++ b/src/Adapter/PlatformServices.Interface/PlatformServices.Interface.csproj
@@ -64,13 +64,13 @@
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\netstandard1.0\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\netstandard1.0\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\netstandard1.0\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\netstandard1.0\Microsoft.TestPlatform.PlatformAbstractions.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
..\..\..\packages\System.ComponentModel.Primitives.4.3.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll
diff --git a/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj b/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj
index 82c9d84093..de0ba08fe2 100644
--- a/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj
+++ b/src/Adapter/PlatformServices.NetCore/PlatformServices.NetCore.csproj
@@ -66,7 +66,7 @@
-
+
diff --git a/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs b/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs
index 40595a6bee..0f69e66124 100644
--- a/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs
+++ b/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestContextImplementation.cs
@@ -26,8 +26,10 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices
///
public class TestContextImplementation : UTF.TestContext, ITestContext
{
- private static readonly string FullyQualifiedTestClassNameLabel = "FullyQualifiedTestClassName";
- private static readonly string TestNameLabel = "TestName";
+ private static readonly string FullyQualifiedTestClassNameLabel = nameof(FullyQualifiedTestClassName);
+ private static readonly string ManagedTypeLabel = nameof(ManagedType);
+ private static readonly string ManagedMethodLabel = nameof(ManagedMethod);
+ private static readonly string TestNameLabel = nameof(TestName);
///
/// List of result files associated with the test
@@ -444,6 +446,8 @@ private string GetStringPropertyValue(string propertyName)
private void InitializeProperties()
{
this.properties[FullyQualifiedTestClassNameLabel] = this.testMethod.FullClassName;
+ this.properties[ManagedTypeLabel] = this.testMethod.ManagedType;
+ this.properties[ManagedMethodLabel] = this.testMethod.ManagedMethod;
this.properties[TestNameLabel] = this.testMethod.Name;
}
}
diff --git a/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj b/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj
index 157ab331b5..f31516f6a5 100644
--- a/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj
+++ b/src/Adapter/PlatformServices.Portable/PlatformServices.Portable.csproj
@@ -105,13 +105,13 @@
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\netstandard1.0\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\netstandard1.0\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\netstandard1.0\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\netstandard1.0\Microsoft.TestPlatform.PlatformAbstractions.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\netstandard1.0\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
..\..\..\packages\System.ComponentModel.Primitives.4.3.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll
diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs
index acdc11a496..ebae8a2e0f 100644
--- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs
+++ b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs
@@ -26,8 +26,10 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices
///
public class TestContextImplementation : UTF.TestContext, ITestContext
{
- private static readonly string FullyQualifiedTestClassNameLabel = "FullyQualifiedTestClassName";
- private static readonly string TestNameLabel = "TestName";
+ private static readonly string FullyQualifiedTestClassNameLabel = nameof(FullyQualifiedTestClassName);
+ private static readonly string ManagedTypeLabel = nameof(ManagedType);
+ private static readonly string ManagedMethodLabel = nameof(ManagedMethod);
+ private static readonly string TestNameLabel = nameof(TestName);
///
/// Properties
@@ -339,6 +341,8 @@ private object GetPropertyValue(string propertyName)
private void InitializeProperties()
{
this.properties[FullyQualifiedTestClassNameLabel] = this.testMethod.FullClassName;
+ this.properties[ManagedTypeLabel] = this.testMethod.ManagedType;
+ this.properties[ManagedMethodLabel] = this.testMethod.ManagedMethod;
this.properties[TestNameLabel] = this.testMethod.Name;
}
}
diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs
index 1a17f1759a..456641657c 100644
--- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs
+++ b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextPropertyStrings.cs
@@ -18,6 +18,8 @@ internal static class TestContextPropertyStrings
public static readonly string TestLogsDir = "TestLogsDir";
public static readonly string FullyQualifiedTestClassName = "FullyQualifiedTestClassName";
+ public static readonly string ManagedType = "ManagedType";
+ public static readonly string ManagedMethod = "ManagedMethod";
public static readonly string TestName = "TestName";
}
}
diff --git a/src/TestFramework/Extension.Core/NetCoreTestContext.cs b/src/TestFramework/Extension.Core/NetCoreTestContext.cs
index 140116e780..2ef0757f87 100644
--- a/src/TestFramework/Extension.Core/NetCoreTestContext.cs
+++ b/src/TestFramework/Extension.Core/NetCoreTestContext.cs
@@ -87,6 +87,16 @@ public abstract class TestContext
///
public virtual string FullyQualifiedTestClassName => this.GetProperty("FullyQualifiedTestClassName");
+ ///
+ /// Gets the fully specified type name metadata format.
+ ///
+ public virtual string ManagedType => this.GetProperty(nameof(this.ManagedType));
+
+ ///
+ /// Gets the fully specified method name metadata format.
+ ///
+ public virtual string ManagedMethod => this.GetProperty(nameof(this.ManagedMethod));
+
///
/// Gets the name of the test method currently being executed
///
diff --git a/src/TestFramework/Extension.Desktop/DesktopTestContext.cs b/src/TestFramework/Extension.Desktop/DesktopTestContext.cs
index 9e7a4d9299..a7781f8aa8 100644
--- a/src/TestFramework/Extension.Desktop/DesktopTestContext.cs
+++ b/src/TestFramework/Extension.Desktop/DesktopTestContext.cs
@@ -100,6 +100,16 @@ public abstract class TestContext
///
public virtual string FullyQualifiedTestClassName => this.GetProperty("FullyQualifiedTestClassName");
+ ///
+ /// Gets the fully specified type name metadata format.
+ ///
+ public virtual string ManagedType => this.GetProperty(nameof(this.ManagedType));
+
+ ///
+ /// Gets the fully specified method name metadata format.
+ ///
+ public virtual string ManagedMethod => this.GetProperty(nameof(this.ManagedMethod));
+
///
/// Gets the name of the test method currently being executed
///
diff --git a/src/TestFramework/Extension.Shared/TestContext.cs b/src/TestFramework/Extension.Shared/TestContext.cs
index b8f5a7089a..1db99d2f27 100644
--- a/src/TestFramework/Extension.Shared/TestContext.cs
+++ b/src/TestFramework/Extension.Shared/TestContext.cs
@@ -37,6 +37,16 @@ public abstract class TestContext
///
public virtual string FullyQualifiedTestClassName => this.GetProperty("FullyQualifiedTestClassName");
+ ///
+ /// Gets the fully specified type name metadata format.
+ ///
+ public virtual string ManagedType => this.GetProperty(nameof(this.ManagedType));
+
+ ///
+ /// Gets the fully specified method name metadata format.
+ ///
+ public virtual string ManagedMethod => this.GetProperty(nameof(this.ManagedMethod));
+
///
/// Gets the Name of the test method currently being executed
///
diff --git a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/PlatformServices.Desktop.Component.Tests.csproj b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/PlatformServices.Desktop.Component.Tests.csproj
index 8d604ee353..e399b662e7 100644
--- a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/PlatformServices.Desktop.Component.Tests.csproj
+++ b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/PlatformServices.Desktop.Component.Tests.csproj
@@ -42,13 +42,13 @@
..\..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
..\..\..\packages\Moq.4.8.2\lib\net45\Moq.dll
diff --git a/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/TestProjectForAssemblyResolution.csproj b/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/TestProjectForAssemblyResolution.csproj
index 052e8878de..1c6bd3478b 100644
--- a/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/TestProjectForAssemblyResolution.csproj
+++ b/test/ComponentTests/TestAssets/TestProjectForAssemblyResolution/TestProjectForAssemblyResolution.csproj
@@ -19,5 +19,4 @@
-
diff --git a/test/E2ETests/Automation.CLI/Automation.CLI.csproj b/test/E2ETests/Automation.CLI/Automation.CLI.csproj
index 1b49c0bb7a..0140fff639 100644
--- a/test/E2ETests/Automation.CLI/Automation.CLI.csproj
+++ b/test/E2ETests/Automation.CLI/Automation.CLI.csproj
@@ -33,22 +33,22 @@
- ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0\lib\net451\Microsoft.TestPlatform.CommunicationUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.CommunicationUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
- ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0\lib\net451\Microsoft.TestPlatform.VsTestConsole.TranslationLayer.dll
+ ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.VsTestConsole.TranslationLayer.dll
- ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0\lib\net451\Microsoft.VisualStudio.TestPlatform.Common.dll
+ ..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.$(TestPlatfromVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.Common.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
diff --git a/test/E2ETests/Automation.CLI/CLITestBase.cs b/test/E2ETests/Automation.CLI/CLITestBase.cs
index 206b76b60c..d4a994c362 100644
--- a/test/E2ETests/Automation.CLI/CLITestBase.cs
+++ b/test/E2ETests/Automation.CLI/CLITestBase.cs
@@ -17,8 +17,10 @@ public class CLITestBase
private const string TestAssetsFolder = "TestAssets";
private const string ArtifactsFolder = "artifacts";
private const string PackagesFolder = "packages";
- private const string TestPlatformCLIPackage = @"Microsoft.TestPlatform.15.5.0";
- private const string VstestConsoleRelativePath = @"tools\net451\vstest.console.exe";
+
+ // This value is automatically updated by "build.ps1" script.
+ private const string TestPlatformCLIPackage = @"Microsoft.TestPlatform.16.9.0-preview-20201021-10";
+ private const string VstestConsoleRelativePath = @"tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe";
private static VsTestConsoleWrapper vsTestConsoleWrapper;
private DiscoveryEventsHandler discoveryEventsHandler;
diff --git a/test/E2ETests/Automation.CLI/packages.config b/test/E2ETests/Automation.CLI/packages.config
index b3eb1cc130..eefc1074f1 100644
--- a/test/E2ETests/Automation.CLI/packages.config
+++ b/test/E2ETests/Automation.CLI/packages.config
@@ -1,8 +1,8 @@

-
+
-
+
diff --git a/test/E2ETests/TestAssets/DeploymentTestProjectNetCore/DeploymentTestProjectNetCore.csproj b/test/E2ETests/TestAssets/DeploymentTestProjectNetCore/DeploymentTestProjectNetCore.csproj
index be5a9e7536..22ce796a5c 100644
--- a/test/E2ETests/TestAssets/DeploymentTestProjectNetCore/DeploymentTestProjectNetCore.csproj
+++ b/test/E2ETests/TestAssets/DeploymentTestProjectNetCore/DeploymentTestProjectNetCore.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/test/E2ETests/TestAssets/TimeoutTestProjectNetCore/TimeoutTestProjectNetCore.csproj b/test/E2ETests/TestAssets/TimeoutTestProjectNetCore/TimeoutTestProjectNetCore.csproj
index fbebb3b499..4e26f2a93d 100644
--- a/test/E2ETests/TestAssets/TimeoutTestProjectNetCore/TimeoutTestProjectNetCore.csproj
+++ b/test/E2ETests/TestAssets/TimeoutTestProjectNetCore/TimeoutTestProjectNetCore.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj
index 0e57e9240c..e02869db42 100644
--- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj
+++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj
@@ -40,13 +40,13 @@
True
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
$(TestFxRoot)packages\Moq.4.5.21\lib\net45\Moq.dll
diff --git a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/PlatformServices.Desktop.Unit.Tests.csproj b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/PlatformServices.Desktop.Unit.Tests.csproj
index 28016e3eaa..c06fbeb2ed 100644
--- a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/PlatformServices.Desktop.Unit.Tests.csproj
+++ b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/PlatformServices.Desktop.Unit.Tests.csproj
@@ -40,13 +40,13 @@
..\..\..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
..\..\..\packages\Moq.4.5.21\lib\net45\Moq.dll
diff --git a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj
index d705d108b6..ea5b54bb15 100644
--- a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj
+++ b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj
@@ -35,7 +35,7 @@
-
+
diff --git a/test/UnitTests/PlatformServices.Portable.Unit.Tests/PlatformServices.Portable.Unit.Tests.csproj b/test/UnitTests/PlatformServices.Portable.Unit.Tests/PlatformServices.Portable.Unit.Tests.csproj
index 02c8d77a81..c1a8d2b143 100644
--- a/test/UnitTests/PlatformServices.Portable.Unit.Tests/PlatformServices.Portable.Unit.Tests.csproj
+++ b/test/UnitTests/PlatformServices.Portable.Unit.Tests/PlatformServices.Portable.Unit.Tests.csproj
@@ -39,16 +39,16 @@
True
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
FrameworkV1
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
..\..\..\packages\Moq.4.5.21\lib\net45\Moq.dll
diff --git a/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj b/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj
index 12418475da..28097a3964 100644
--- a/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj
+++ b/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj
@@ -40,16 +40,16 @@
True
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll
FrameworkV1
- ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.16.9.0-preview-20201021-10\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
+ ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatfromVersion)\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
..\..\..\packages\Moq.4.7.8\lib\net45\Moq.dll