diff --git a/src/Adapter/MSTest.TestAdapter/Constants.cs b/src/Adapter/MSTest.TestAdapter/Constants.cs
index f110859dc8..aa57e7b505 100644
--- a/src/Adapter/MSTest.TestAdapter/Constants.cs
+++ b/src/Adapter/MSTest.TestAdapter/Constants.cs
@@ -88,36 +88,6 @@ internal static class Constants
internal static readonly TestProperty InnerResultsCountProperty = TestProperty.Register("InnerResultsCount", InnerResultsCountLabel, typeof(int), TestPropertyAttributes.Hidden, typeof(TestResult));
- internal static readonly TestProperty TestRunIdProperty = TestProperty.Register(TestRunId, TestRunId, typeof(int), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty TestPlanIdProperty = TestProperty.Register(TestPlanId, TestPlanId, typeof(int), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty TestCaseIdProperty = TestProperty.Register(TestCaseId, TestCaseId, typeof(int), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty TestPointIdProperty = TestProperty.Register(TestPointId, TestPointId, typeof(int), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty TestConfigurationIdProperty = TestProperty.Register(TestConfigurationId, TestConfigurationId, typeof(int), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty TestConfigurationNameProperty = TestProperty.Register(TestConfigurationName, TestConfigurationName, typeof(string), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty IsInLabEnvironmentProperty = TestProperty.Register(IsInLabEnvironment, IsInLabEnvironment, typeof(bool), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty BuildConfigurationIdProperty = TestProperty.Register(BuildConfigurationId, BuildConfigurationId, typeof(int), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty BuildDirectoryProperty = TestProperty.Register(BuildDirectory, BuildDirectory, typeof(string), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty BuildFlavorProperty = TestProperty.Register(BuildFlavor, BuildFlavor, typeof(string), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty BuildNumberProperty = TestProperty.Register(BuildNumber, BuildNumber, typeof(string), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty BuildPlatformProperty = TestProperty.Register(BuildPlatform, BuildPlatform, typeof(string), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty BuildUriProperty = TestProperty.Register(BuildUri, BuildUri, typeof(string), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty TfsServerCollectionUrlProperty = TestProperty.Register(TfsServerCollectionUrl, TfsServerCollectionUrl, typeof(string), TestPropertyAttributes.Hidden, typeof(TestCase));
-
- internal static readonly TestProperty TfsTeamProjectProperty = TestProperty.Register(TfsTeamProject, TfsTeamProject, typeof(string), TestPropertyAttributes.Hidden, typeof(TestCase));
-
internal static readonly TestProperty TestDynamicDataTypeProperty = TestProperty.Register("MSTest.DynamicDataType", "DynamicDataType", typeof(int), TestPropertyAttributes.Hidden, typeof(TestCase));
internal static readonly TestProperty TestDynamicDataProperty = TestProperty.Register("MSTest.DynamicData", "DynamicData", typeof(string[]), TestPropertyAttributes.Hidden, typeof(TestCase));
@@ -147,21 +117,5 @@ internal static class Constants
private const string CssProjectStructureLabel = "CssProjectStructure";
private const string WorkItemIdsLabel = "WorkItemIds";
- private const string TestRunId = "__Tfs_TestRunId__";
- private const string TestPlanId = "__Tfs_TestPlanId__";
- private const string TestCaseId = "__Tfs_TestCaseId__";
- private const string TestPointId = "__Tfs_TestPointId__";
- private const string TestConfigurationId = "__Tfs_TestConfigurationId__";
- private const string TestConfigurationName = "__Tfs_TestConfigurationName__";
- private const string IsInLabEnvironment = "__Tfs_IsInLabEnvironment__";
- private const string BuildConfigurationId = "__Tfs_BuildConfigurationId__";
- private const string BuildDirectory = "__Tfs_BuildDirectory__";
- private const string BuildFlavor = "__Tfs_BuildFlavor__";
- private const string BuildNumber = "__Tfs_BuildNumber__";
- private const string BuildPlatform = "__Tfs_BuildPlatform__";
- private const string BuildUri = "__Tfs_BuildUri__";
- private const string TfsServerCollectionUrl = "__Tfs_TfsServerCollectionUrl__";
- private const string TfsTeamProject = "__Tfs_TeamProject__";
-
#endregion
}
diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TcmTestPropertiesProvider.cs b/src/Adapter/MSTest.TestAdapter/Execution/TcmTestPropertiesProvider.cs
deleted file mode 100644
index cf576cba0a..0000000000
--- a/src/Adapter/MSTest.TestAdapter/Execution/TcmTestPropertiesProvider.cs
+++ /dev/null
@@ -1,50 +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 TestPlatformObjectModel = Microsoft.VisualStudio.TestPlatform.ObjectModel;
-
-namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution;
-
-///
-/// Reads and parses the TcmTestProperties in order to populate them in TestRunParameters.
-///
-internal static class TcmTestPropertiesProvider
-{
- ///
- /// Gets tcm properties from test case.
- ///
- /// Test case.
- /// Tcm properties.
- public static IDictionary GetTcmProperties(TestPlatformObjectModel.TestCase testCase)
- {
- var tcmProperties = new Dictionary();
-
- // Return empty properties when testCase is null or when test case id is zero.
- if (testCase == null ||
- testCase.GetPropertyValue(Constants.TestCaseIdProperty, default) == 0)
- {
- return tcmProperties;
- }
-
- // Step 1: Add common properties.
- tcmProperties[Constants.TestRunIdProperty] = testCase.GetPropertyValue(Constants.TestRunIdProperty, default);
- tcmProperties[Constants.TestPlanIdProperty] = testCase.GetPropertyValue(Constants.TestPlanIdProperty, default);
- tcmProperties[Constants.BuildConfigurationIdProperty] = testCase.GetPropertyValue(Constants.BuildConfigurationIdProperty, default);
- tcmProperties[Constants.BuildDirectoryProperty] = testCase.GetPropertyValue(Constants.BuildDirectoryProperty, default);
- tcmProperties[Constants.BuildFlavorProperty] = testCase.GetPropertyValue(Constants.BuildFlavorProperty, default);
- tcmProperties[Constants.BuildNumberProperty] = testCase.GetPropertyValue(Constants.BuildNumberProperty, default);
- tcmProperties[Constants.BuildPlatformProperty] = testCase.GetPropertyValue(Constants.BuildPlatformProperty, default);
- tcmProperties[Constants.BuildUriProperty] = testCase.GetPropertyValue(Constants.BuildUriProperty, default);
- tcmProperties[Constants.TfsServerCollectionUrlProperty] = testCase.GetPropertyValue(Constants.TfsServerCollectionUrlProperty, default);
- tcmProperties[Constants.TfsTeamProjectProperty] = testCase.GetPropertyValue(Constants.TfsTeamProjectProperty, default);
- tcmProperties[Constants.IsInLabEnvironmentProperty] = testCase.GetPropertyValue(Constants.IsInLabEnvironmentProperty, default);
-
- // Step 2: Add test case specific properties.
- tcmProperties[Constants.TestCaseIdProperty] = testCase.GetPropertyValue(Constants.TestCaseIdProperty, default);
- tcmProperties[Constants.TestConfigurationIdProperty] = testCase.GetPropertyValue(Constants.TestConfigurationIdProperty, default);
- tcmProperties[Constants.TestConfigurationNameProperty] = testCase.GetPropertyValue(Constants.TestConfigurationNameProperty, default);
- tcmProperties[Constants.TestPointIdProperty] = testCase.GetPropertyValue(Constants.TestPointIdProperty, default);
-
- return tcmProperties;
- }
-}
diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs
index 9df21eb37a..527291f949 100644
--- a/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs
+++ b/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs
@@ -438,8 +438,7 @@ private void ExecuteTestsWithTestRunner(
PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo("Executing test {0}", unitTestElement.TestMethod.Name);
// Run single test passing test context properties to it.
- IDictionary tcmProperties = TcmTestPropertiesProvider.GetTcmProperties(currentTest);
- Dictionary testContextProperties = GetTestContextProperties(tcmProperties, sourceLevelParameters);
+ Dictionary testContextProperties = GetTestContextProperties(sourceLevelParameters);
UnitTestResult[] unitTestResult = testRunner.RunSingleTest(unitTestElement.TestMethod, testContextProperties);
PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo("Executed test {0}", unitTestElement.TestMethod.Name);
@@ -479,21 +478,13 @@ private void ExecuteTestsWithTestRunner(
///
/// Get test context properties.
///
- /// Tcm properties.
/// Source level parameters.
/// Test context properties.
private static Dictionary GetTestContextProperties(
- IDictionary tcmProperties,
IDictionary sourceLevelParameters)
{
var testContextProperties = new Dictionary();
- // Add tcm properties.
- foreach (KeyValuePair propertyPair in tcmProperties)
- {
- testContextProperties[propertyPair.Key.Id] = propertyPair.Value;
- }
-
// Add source level parameters.
foreach (KeyValuePair propertyPair in sourceLevelParameters)
{
diff --git a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TcmTestPropertiesProviderTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/Execution/TcmTestPropertiesProviderTests.cs
deleted file mode 100644
index 1ac3dcbff9..0000000000
--- a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TcmTestPropertiesProviderTests.cs
+++ /dev/null
@@ -1,241 +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 Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution;
-using Microsoft.VisualStudio.TestPlatform.ObjectModel;
-
-using TestFramework.ForTestingMSTest;
-
-using TestAdapterConstants = Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Constants;
-
-namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.Execution;
-
-public class TcmTestPropertiesProviderTests : TestContainer
-{
- private readonly TestProperty[] _tcmKnownProperties =
- [
- TestAdapterConstants.TestRunIdProperty,
- TestAdapterConstants.TestPlanIdProperty,
- TestAdapterConstants.BuildConfigurationIdProperty,
- TestAdapterConstants.BuildDirectoryProperty,
- TestAdapterConstants.BuildFlavorProperty,
- TestAdapterConstants.BuildNumberProperty,
- TestAdapterConstants.BuildPlatformProperty,
- TestAdapterConstants.BuildUriProperty,
- TestAdapterConstants.TfsServerCollectionUrlProperty,
- TestAdapterConstants.TfsTeamProjectProperty,
- TestAdapterConstants.IsInLabEnvironmentProperty,
- TestAdapterConstants.TestCaseIdProperty,
- TestAdapterConstants.TestConfigurationIdProperty,
- TestAdapterConstants.TestConfigurationNameProperty,
- TestAdapterConstants.TestPointIdProperty,
- ];
-
- public void GetTcmPropertiesShouldReturnEmptyDictionaryIfTestCaseIsNull()
- {
- IDictionary tcmProperties = TcmTestPropertiesProvider.GetTcmProperties(null);
- Verify(tcmProperties.Count == 0);
- }
-
- public void GetTcmPropertiesShouldReturnEmptyDictionaryIfTestCaseIdIsZero()
- {
- var testCase = new TestCase("PassingTestFomTestCase", new Uri("http://sampleUri/"), "unittestproject1.dll");
- object[] propertiesValue =
- [
- 32,
- 534,
- 5,
- "sample build directory",
- "sample build flavor",
- "132456",
- "sample build platform",
- "http://sampleBuildUri/",
- "http://samplecollectionuri/",
- "sample team project",
- false,
- 0,
- 54,
- "sample configuration name",
- 345
- ];
- SetTestCaseProperties(testCase, propertiesValue);
-
- IDictionary tcmProperties = TcmTestPropertiesProvider.GetTcmProperties(testCase);
- Verify(tcmProperties.Count == 0);
- }
-
- public void GetTcmPropertiesShouldGetAllPropertiesFromTestCase()
- {
- var testCase = new TestCase("PassingTestFomTestCase", new Uri("http://sampleUri/"), "unittestproject1.dll");
- object[] propertiesValue =
- [
- 32,
- 534,
- 5,
- "sample build directory",
- "sample build flavor",
- "132456",
- "sample build platform",
- "http://sampleBuildUri/",
- "http://samplecollectionuri/",
- "sample team project",
- false,
- 1401,
- 54,
- "sample configuration name",
- 345
- ];
- SetTestCaseProperties(testCase, propertiesValue);
-
- IDictionary tcmProperties = TcmTestPropertiesProvider.GetTcmProperties(testCase);
-
- VerifyTcmProperties(tcmProperties, testCase);
- }
-
- public void GetTcmPropertiesShouldCopyMultiplePropertiesCorrectlyFromTestCase()
- {
- // Verify 1st call.
- var testCase1 = new TestCase("PassingTestFomTestCase", new Uri("http://sampleUri/"), "unittestproject1.dll");
- object[] propertiesValue1 =
- [
- 32,
- 534,
- 5,
- "sample build directory",
- "sample build flavor",
- "132456",
- "sample build platform",
- "http://sampleBuildUri/",
- "http://samplecollectionuri/",
- "sample team project",
- false,
- 1401,
- 54,
- "sample configuration name",
- 345
- ];
- SetTestCaseProperties(testCase1, propertiesValue1);
- IDictionary tcmProperties1 = TcmTestPropertiesProvider.GetTcmProperties(testCase1);
- VerifyTcmProperties(tcmProperties1, testCase1);
-
- // Verify 2nd call.
- var testCase2 = new TestCase("PassingTestFomTestCase2", new Uri("http://sampleUri2/"), "unittestproject2.dll");
- object[] propertiesValue2 =
- [
- 33,
- 535,
- 6,
- "sample build directory 2",
- "sample build flavor 2",
- "132457",
- "sample build platform 2",
- "http://sampleBuildUri2/",
- "http://samplecollectionuri2/",
- "sample team project",
- true,
- 1403,
- 55,
- "sample configuration name 2",
- 346
- ];
- SetTestCaseProperties(testCase2, propertiesValue2);
- IDictionary tcmProperties2 = TcmTestPropertiesProvider.GetTcmProperties(testCase2);
- VerifyTcmProperties(tcmProperties2, testCase2);
- }
-
- public void GetTcmPropertiesShouldHandleDuplicateTestsProperlyFromTestCase()
- {
- // Verify 1st call.
- var testCase1 = new TestCase("PassingTestFomTestCase", new Uri("http://sampleUri/"), "unittestproject1.dll");
- object[] propertiesValue1 =
- [
- 32,
- 534,
- 5,
- "sample build directory",
- "sample build flavor",
- "132456",
- "sample build platform",
- "http://sampleBuildUri/",
- "http://samplecollectionuri/",
- "sample team project",
- false,
- 1401,
- 54,
- "sample configuration name",
- 345
- ];
- SetTestCaseProperties(testCase1, propertiesValue1);
- IDictionary tcmProperties1 = TcmTestPropertiesProvider.GetTcmProperties(testCase1);
- VerifyTcmProperties(tcmProperties1, testCase1);
-
- // Verify 2nd call.
- var testCase2 = new TestCase("PassingTestFomTestCase", new Uri("http://sampleUri/"), "unittestproject1.dll");
- object[] propertiesValue2 =
- [
- 33,
- 535,
- 6,
- "sample build directory 2",
- "sample build flavor 2",
- "132457",
- "sample build platform 2",
- "http://sampleBuildUri2/",
- "http://samplecollectionuri2/",
- "sample team project",
- true,
- 1403,
- 55,
- "sample configuration name 2",
- 346
- ];
- SetTestCaseProperties(testCase2, propertiesValue2);
- IDictionary tcmProperties2 = TcmTestPropertiesProvider.GetTcmProperties(testCase2);
- VerifyTcmProperties(tcmProperties2, testCase2);
-
- // Verify 3rd call.
- var testCase3 = new TestCase("PassingTestFomTestCase2", new Uri("http://sampleUri/"), "unittestproject2.dll");
- object[] propertiesValue3 =
- [
- 34,
- 536,
- 7,
- "sample build directory 3",
- "sample build flavor 3",
- "132458",
- "sample build platform 3",
- "http://sampleBuildUri3/",
- "http://samplecollectionuri3/",
- "sample team project2",
- true,
- 1404,
- 55,
- "sample configuration name 3",
- 347
- ];
- SetTestCaseProperties(testCase3, propertiesValue3);
- IDictionary tcmProperties3 = TcmTestPropertiesProvider.GetTcmProperties(testCase3);
- VerifyTcmProperties(tcmProperties3, testCase3);
- }
-
- private void SetTestCaseProperties(TestCase testCase, object[] propertiesValue)
- {
- System.Collections.IEnumerator tcmKnownPropertiesEnumerator = _tcmKnownProperties.GetEnumerator();
-
- System.Collections.IEnumerator propertiesValueEnumerator = propertiesValue.GetEnumerator();
- while (tcmKnownPropertiesEnumerator.MoveNext() && propertiesValueEnumerator.MoveNext())
- {
- object property = tcmKnownPropertiesEnumerator.Current;
- object value = propertiesValueEnumerator.Current;
- testCase.SetPropertyValue(property as TestProperty, value);
- }
- }
-
- private void VerifyTcmProperties(IDictionary tcmProperties, TestCase testCase)
- {
- foreach (TestProperty property in _tcmKnownProperties)
- {
- Verify(testCase.GetPropertyValue(property).Equals(tcmProperties[property]));
- }
- }
-}
diff --git a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestExecutionManagerTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestExecutionManagerTests.cs
index 046f7d8ed8..27602243cd 100644
--- a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestExecutionManagerTests.cs
+++ b/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestExecutionManagerTests.cs
@@ -32,25 +32,6 @@ public class TestExecutionManagerTests : TestContainer
private readonly TestExecutionManager _testExecutionManager;
private readonly Mock _mockMessageLogger;
- private readonly TestProperty[] _tcmKnownProperties =
- [
- TestAdapterConstants.TestRunIdProperty,
- TestAdapterConstants.TestPlanIdProperty,
- TestAdapterConstants.BuildConfigurationIdProperty,
- TestAdapterConstants.BuildDirectoryProperty,
- TestAdapterConstants.BuildFlavorProperty,
- TestAdapterConstants.BuildNumberProperty,
- TestAdapterConstants.BuildPlatformProperty,
- TestAdapterConstants.BuildUriProperty,
- TestAdapterConstants.TfsServerCollectionUrlProperty,
- TestAdapterConstants.TfsTeamProjectProperty,
- TestAdapterConstants.IsInLabEnvironmentProperty,
- TestAdapterConstants.TestCaseIdProperty,
- TestAdapterConstants.TestConfigurationIdProperty,
- TestAdapterConstants.TestConfigurationNameProperty,
- TestAdapterConstants.TestPointIdProperty,
- ];
-
private TestableRunContextTestExecutionTests _runContext;
private List _callers;
private int _enqueuedParallelTestsCount;
@@ -282,27 +263,6 @@ public void RunTestsForTestShouldPassInTestRunParametersInformationAsPropertiesT
new KeyValuePair("webAppUrl", "http://localhost")));
}
- public void RunTestsForTestShouldPassInTcmPropertiesAsPropertiesToTheTest()
- {
- TestCase testCase = GetTestCase(typeof(DummyTestClass), "PassingTest");
- object[] propertiesValue = [32, 534, 5, "sample build directory", "sample build flavor", "132456", "sample build platform", "http://sampleBuildUti/", "http://samplecollectionuri/", "sample team project", false, 1401, 54, "sample configuration name", 345];
- SetTestCaseProperties(testCase, propertiesValue);
-
- TestCase[] tests = [testCase];
- _runContext.MockRunSettings.Setup(rs => rs.SettingsXml).Returns(
- """
-
-
- True
-
-
- """);
-
- _testExecutionManager.RunTests(tests, _runContext, _frameworkHandle, new TestRunCancellationToken());
-
- VerifyTcmProperties(DummyTestClass.TestContextProperties, testCase);
- }
-
public void RunTestsForTestShouldPassInDeploymentInformationAsPropertiesToTheTest()
{
TestCase testCase = GetTestCase(typeof(DummyTestClass), "PassingTest");
@@ -862,27 +822,6 @@ private void SetCaller(string caller)
_callers.Add(caller);
}
- private void VerifyTcmProperties(IDictionary tcmProperties, TestCase testCase)
- {
- foreach (TestProperty property in _tcmKnownProperties)
- {
- Verify(testCase.GetPropertyValue(property).Equals(tcmProperties[property.Id]));
- }
- }
-
- private void SetTestCaseProperties(TestCase testCase, object[] propertiesValue)
- {
- System.Collections.IEnumerator tcmKnownPropertiesEnumerator = _tcmKnownProperties.GetEnumerator();
-
- System.Collections.IEnumerator propertiesValueEnumerator = propertiesValue.GetEnumerator();
- while (tcmKnownPropertiesEnumerator.MoveNext() && propertiesValueEnumerator.MoveNext())
- {
- object property = tcmKnownPropertiesEnumerator.Current;
- object value = propertiesValueEnumerator.Current;
- testCase.SetPropertyValue(property as TestProperty, value);
- }
- }
-
#endregion
#region Dummy implementation