Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code #4314

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions src/Adapter/MSTest.TestAdapter/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never set a value for any of these properties. @Evangelink Could they be magically set by something else (not us)? Or is it really dead code?


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));
Expand Down Expand Up @@ -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
}

This file was deleted.

11 changes: 1 addition & 10 deletions src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TestProperty, object?> tcmProperties = TcmTestPropertiesProvider.GetTcmProperties(currentTest);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dictionary was always empty because we don't set TestCaseIdProperty anywhere, so GetTcmProperties returns an empty dictionary right away.

Dictionary<string, object?> testContextProperties = GetTestContextProperties(tcmProperties, sourceLevelParameters);
Dictionary<string, object?> testContextProperties = GetTestContextProperties(sourceLevelParameters);
UnitTestResult[] unitTestResult = testRunner.RunSingleTest(unitTestElement.TestMethod, testContextProperties);

PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo("Executed test {0}", unitTestElement.TestMethod.Name);
Expand Down Expand Up @@ -479,21 +478,13 @@ private void ExecuteTestsWithTestRunner(
/// <summary>
/// Get test context properties.
/// </summary>
/// <param name="tcmProperties">Tcm properties.</param>
/// <param name="sourceLevelParameters">Source level parameters.</param>
/// <returns>Test context properties.</returns>
private static Dictionary<string, object?> GetTestContextProperties(
IDictionary<TestProperty, object?> tcmProperties,
IDictionary<string, object> sourceLevelParameters)
{
var testContextProperties = new Dictionary<string, object?>();

// Add tcm properties.
foreach (KeyValuePair<TestProperty, object?> propertyPair in tcmProperties)
{
testContextProperties[propertyPair.Key.Id] = propertyPair.Value;
}

// Add source level parameters.
foreach (KeyValuePair<string, object> propertyPair in sourceLevelParameters)
{
Expand Down

This file was deleted.

Loading