From f6d11dcab0d1c8f5f8796b673116b25a3db70f51 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Wed, 16 May 2018 16:11:51 +0530 Subject: [PATCH 01/21] Migrator --- scripts/build.ps1 | 4 + src/SettingsMigrator/App.config | 6 + src/SettingsMigrator/Migrator.cs | 276 ++++++++++++++++++ src/SettingsMigrator/Program.cs | 49 ++++ .../Properties/AssemblyInfo.cs | 22 ++ .../Resources/Resources.Designer.cs | 1 + src/SettingsMigrator/Resources/Resources.resx | 123 ++++++++ .../Resources/xlf/Resources.cs.xlf | 30 ++ .../Resources/xlf/Resources.de.xlf | 30 ++ .../Resources/xlf/Resources.es.xlf | 30 ++ .../Resources/xlf/Resources.fr.xlf | 30 ++ .../Resources/xlf/Resources.it.xlf | 30 ++ .../Resources/xlf/Resources.ja.xlf | 30 ++ .../Resources/xlf/Resources.ko.xlf | 30 ++ .../Resources/xlf/Resources.pl.xlf | 30 ++ .../Resources/xlf/Resources.pt-BR.xlf | 30 ++ .../Resources/xlf/Resources.ru.xlf | 30 ++ .../Resources/xlf/Resources.tr.xlf | 30 ++ .../Resources/xlf/Resources.xlf | 12 + .../Resources/xlf/Resources.zh-Hans.xlf | 30 ++ .../Resources/xlf/Resources.zh-Hant.xlf | 30 ++ src/SettingsMigrator/SettingsMigrator.csproj | 43 +++ src/SettingsMigrator/app.manifest | 27 ++ .../nuspec/Microsoft.TestPlatform.nuspec | 15 + .../MigratorUnitTests.cs | 157 ++++++++++ .../SettingsMigrator.UnitTests.csproj | 30 ++ 26 files changed, 1155 insertions(+) create mode 100644 src/SettingsMigrator/App.config create mode 100644 src/SettingsMigrator/Migrator.cs create mode 100644 src/SettingsMigrator/Program.cs create mode 100644 src/SettingsMigrator/Properties/AssemblyInfo.cs create mode 100644 src/SettingsMigrator/Resources/Resources.Designer.cs create mode 100644 src/SettingsMigrator/Resources/Resources.resx create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.cs.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.de.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.es.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.fr.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.it.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.ja.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.ko.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.pl.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.ru.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.tr.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf create mode 100644 src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf create mode 100644 src/SettingsMigrator/SettingsMigrator.csproj create mode 100644 src/SettingsMigrator/app.manifest create mode 100644 test/SettingsMigrator.UnitTests/MigratorUnitTests.cs create mode 100644 test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 4b69291f40..17114fe9c6 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -233,6 +233,7 @@ function Publish-Package $testhostCorePackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkCore") $testhostNS1_4PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\Microsoft.TestPlatform.TestHost\$TPB_TargetFrameworkNS1_4") $vstestConsoleProject = Join-Path $env:TP_ROOT_DIR "src\vstest.console\vstest.console.csproj" + $settingsMigratorProject = Join-Path $env:TP_ROOT_DIR "src\SettingsMigrator\SettingsMigrator.csproj" $dataCollectorProject = Join-Path $env:TP_ROOT_DIR "src\datacollector\datacollector.csproj" Write-Log "Package: Publish src\package\package\package.csproj" @@ -245,6 +246,9 @@ function Publish-Package Write-Log "Package: Publish src\vstest.console\vstest.console.csproj" Publish-PackageInternal $vstestConsoleProject $TPB_TargetFramework $fullCLRPackageDir Publish-PackageInternal $vstestConsoleProject $TPB_TargetFrameworkCore20 $coreCLR20PackageDir + + Write-Log "Package: Publish src\SettingsMigrator\SettingsMigrator.csproj" + Publish-PackageInternal $settingsMigratorProject $TPB_TargetFramework $fullCLRPackageDir Write-Log "Package: Publish src\datacollector\datacollector.csproj" Publish-PackageInternal $dataCollectorProject $TPB_TargetFramework $fullCLRPackageDir diff --git a/src/SettingsMigrator/App.config b/src/SettingsMigrator/App.config new file mode 100644 index 0000000000..731f6de6c2 --- /dev/null +++ b/src/SettingsMigrator/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/SettingsMigrator/Migrator.cs b/src/SettingsMigrator/Migrator.cs new file mode 100644 index 0000000000..5343d7628b --- /dev/null +++ b/src/SettingsMigrator/Migrator.cs @@ -0,0 +1,276 @@ +// 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; +using System.IO; +using System.Xml; + +namespace Microsoft.VisualStudio.TestPlatform.CommandLine +{ + public class Migrator + { + /// + /// Given a runsettings with an embedded testsettings, converts it to runsettings. + /// + /// + /// + public void MigrateRunsettings(string oldRunsettingsPath, string newRunsettingsPath) + { + string testsettingsPath = null; + using (XmlTextReader reader = new XmlTextReader(oldRunsettingsPath)) + { + reader.Namespaces = false; + + var document = new XmlDocument(); + document.Load(reader); + var root = document.DocumentElement; + + var testsettingsNode = root.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); + + if (testsettingsNode != null) + { + testsettingsPath = testsettingsNode.InnerText; + } + if (!string.IsNullOrWhiteSpace(testsettingsPath)) + { + // Expand path relative to runsettings location. + if (!Path.IsPathRooted(testsettingsPath)) + { + testsettingsPath = Path.Combine(oldRunsettingsPath, testsettingsPath); + } + + MigrateTestsettings(testsettingsPath, newRunsettingsPath, File.ReadAllText(oldRunsettingsPath)); + } + else + { + Console.WriteLine("Runsettings does not contain an embedded testsettings, not migrating."); + } + } + } + + /// + /// Given a testsettings, converts it to runsettings + /// + /// + /// + /// + public void MigrateTestsettings(string testsettingsPath, string newRunsettingsPath, string oldRunSettingsContent = null) + { + using (XmlTextReader reader = new XmlTextReader(testsettingsPath)) + { + reader.Namespaces = false; + + var document = new XmlDocument(); + document.Load(reader); + var root = document.DocumentElement; + + // Select the interesting nodes from the xml. + var deploymentNode = root.SelectSingleNode(@"/TestSettings/Deployment"); + var scriptnode = root.SelectSingleNode(@"/TestSettings/Scripts"); + var websettingsNode = root.SelectSingleNode(@"/TestSettings/Execution/TestTypeSpecific/WebTestRunConfiguration"); + var oldDatacollectorNodes = root.SelectNodes(@"/TestSettings/AgentRule/DataCollectors/DataCollector"); + var timeoutNode = root.SelectSingleNode(@"/TestSettings/Execution/Timeouts"); + var assemblyresolutionNode = root.SelectSingleNode(@"/TestSettings/Execution/TestTypeSpecific/UnitTestRunConfig"); + var hostsNode = root.SelectSingleNode(@"/TestSettings/Execution/Hosts"); + var executionNode = root.SelectSingleNode(@"/TestSettings/Execution"); + + string testTimeout = null; + if (timeoutNode != null && timeoutNode.Attributes[TestTimeoutAttributeName] != null) + { + testTimeout = timeoutNode.Attributes[TestTimeoutAttributeName].Value; + } + + string runTimeout = null; + if (timeoutNode != null && timeoutNode.Attributes[RunTimeoutAttributeName] != null) + { + runTimeout = timeoutNode.Attributes[RunTimeoutAttributeName].Value; + } + + string parallelTestCount = null; + if (executionNode != null && executionNode.Attributes[ParallelTestCountAttributeName] != null) + { + parallelTestCount = executionNode.Attributes[ParallelTestCountAttributeName].Value; + } + + if(string.IsNullOrEmpty(oldRunSettingsContent)) + { + oldRunSettingsContent = sampleRunsettingsContent; + } + var newXmlDoc = new XmlDocument(); + newXmlDoc.LoadXml(oldRunSettingsContent); + + // Remove the embedded testsettings node if it exists. + RemoveEmbeddedTestsettings(newXmlDoc); + + // WebTestRunConfiguration node. + if (websettingsNode != null) + { + newXmlDoc.DocumentElement.AppendChild(newXmlDoc.ImportNode(websettingsNode, deep: true)); + } + + // LegacySettings node. + if (deploymentNode != null || scriptnode != null || assemblyresolutionNode != null || + !string.IsNullOrEmpty(parallelTestCount) || !string.IsNullOrEmpty(testTimeout) || hostsNode != null) + { + AddLegacyNodes(deploymentNode, scriptnode, testTimeout, assemblyresolutionNode, hostsNode, parallelTestCount, newXmlDoc); + } + + // TestSessionTimeout node. + if (!string.IsNullOrEmpty(runTimeout)) + { + AddRunTimeoutNode(runTimeout, newXmlDoc); + } + + // DataCollectors node. + if (oldDatacollectorNodes != null && oldDatacollectorNodes.Count > 0) + { + AddDataCollectorNodes(oldDatacollectorNodes, newXmlDoc); + } + + newXmlDoc.Save(newRunsettingsPath); + } + } + + /// + /// Removes the embedded testsettings node if present. + /// + /// + private void RemoveEmbeddedTestsettings(XmlDocument newXmlDoc) + { + var testsettingsNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); + if (testsettingsNode != null) + { + testsettingsNode.ParentNode.RemoveChild(testsettingsNode); + } + } + + + /// + /// Adds the legacy nodes to runsettings xml. + /// + /// + /// + /// + /// + /// + /// + /// + private void AddLegacyNodes(XmlNode deploymentNode, XmlNode scriptnode, string testTimeout, XmlNode assemblyresolutionNode, XmlNode hostsNode, string parallelTestCount, XmlDocument newXmlDoc) + { + //Remove if the legacy node already exists. + var legacyNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/LegacySettings"); + if (legacyNode != null) + { + legacyNode.ParentNode.RemoveChild(legacyNode); + } + + legacyNode = newXmlDoc.CreateNode(XmlNodeType.Element, LegacySettingsNodeName, null); + + if (deploymentNode != null) + { + legacyNode.AppendChild(newXmlDoc.ImportNode(deploymentNode, deep: true)); + } + if (scriptnode != null) + { + legacyNode.AppendChild(newXmlDoc.ImportNode(scriptnode, deep: true)); + } + + // Execution node. + if (assemblyresolutionNode != null || !string.IsNullOrEmpty(parallelTestCount) || !string.IsNullOrEmpty(testTimeout) || hostsNode != null) + { + var newExecutionNode = newXmlDoc.CreateNode(XmlNodeType.Element, ExecutionNodeName, null); + + if (string.IsNullOrEmpty(parallelTestCount)) + { + var paralellAttribute = newXmlDoc.CreateAttribute(ParallelTestCountAttributeName); + paralellAttribute.Value = parallelTestCount; + newExecutionNode.Attributes.Append(paralellAttribute); + } + if (!string.IsNullOrEmpty(testTimeout)) + { + var newTimeoutsNode = newXmlDoc.CreateNode(XmlNodeType.Element, TimeoutsNodeName, null); + var testtimeoutattribute = newXmlDoc.CreateAttribute(TestTimeoutAttributeName); + testtimeoutattribute.Value = testTimeout; + newTimeoutsNode.Attributes.Append(testtimeoutattribute); + newExecutionNode.AppendChild(newXmlDoc.ImportNode(newTimeoutsNode, deep: true)); + } + if (hostsNode != null) + { + newExecutionNode.AppendChild(newXmlDoc.ImportNode(hostsNode, deep: true)); + } + if (assemblyresolutionNode != null) + { + var testTypeSpecificNode = newXmlDoc.CreateNode(XmlNodeType.Element, TestTypeSpecificNodeName, null); + testTypeSpecificNode.AppendChild(newXmlDoc.ImportNode(assemblyresolutionNode, deep: true)); + newExecutionNode.AppendChild(newXmlDoc.ImportNode(testTypeSpecificNode, deep: true)); + } + legacyNode.AppendChild(newXmlDoc.ImportNode(newExecutionNode, deep: true)); + } + newXmlDoc.DocumentElement.AppendChild(legacyNode); + } + + + /// + /// Adds the datacollector nodes to the runsettings xml. + /// + /// + /// + private void AddDataCollectorNodes(XmlNodeList oldDatacollectorNodes, XmlDocument newXmlDoc) + { + var dataCollectionRunSettingsNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/DataCollectionRunSettings"); + if (dataCollectionRunSettingsNode == null) + { + dataCollectionRunSettingsNode = newXmlDoc.CreateNode(XmlNodeType.Element, DataCollectionRunSettingsNodeName, null); + } + + var dataCollectorsNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/DataCollectionRunSettings/DataCollectors"); + if (dataCollectorsNode == null) + { + dataCollectorsNode = newXmlDoc.CreateNode(XmlNodeType.Element, DataCollectorsNodeName, null); + dataCollectionRunSettingsNode.AppendChild(newXmlDoc.ImportNode(dataCollectorsNode, deep: true)); + dataCollectorsNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/DataCollectionRunSettings/DataCollectors"); + } + + foreach (XmlNode datacollector in oldDatacollectorNodes) + { + dataCollectorsNode.AppendChild(newXmlDoc.ImportNode(datacollector, deep: true)); + } + newXmlDoc.DocumentElement.AppendChild(dataCollectionRunSettingsNode); + } + + /// + /// Adds run session timeout node. + /// + /// + /// + private void AddRunTimeoutNode(string runTimeout, XmlDocument newXmlDoc) + { + var runConfigurationNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/RunConfiguration"); + if (runConfigurationNode == null) + { + runConfigurationNode = newXmlDoc.CreateNode(XmlNodeType.Element, RunConfigurationNodeName, null); + } + + var testSessionTimeoutNode = newXmlDoc.CreateNode(XmlNodeType.Element, TestSessionTimeoutNodeName, null); + testSessionTimeoutNode.InnerText = runTimeout; + runConfigurationNode.AppendChild(newXmlDoc.ImportNode(testSessionTimeoutNode, deep: true)); + + newXmlDoc.DocumentElement.AppendChild(runConfigurationNode); + } + + const string TestTimeoutAttributeName = "testTimeout"; + const string ParallelTestCountAttributeName = "testTimeout"; + const string RunTimeoutAttributeName = "runTimeout"; + const string LegacySettingsNodeName = "LegacySettings"; + const string ExecutionNodeName = "Execution"; + const string TimeoutsNodeName = "Timeouts"; + const string TestTypeSpecificNodeName = "TestTypeSpecific"; + const string RunConfigurationNodeName = "RunConfiguration"; + const string TestSessionTimeoutNodeName = "TestSessionTimeout"; + const string DataCollectionRunSettingsNodeName = "DataCollectionRunSettings"; + const string DataCollectorsNodeName = "DataCollectors"; + const string sampleRunsettingsContent = "" + + ""; + } +} + diff --git a/src/SettingsMigrator/Program.cs b/src/SettingsMigrator/Program.cs new file mode 100644 index 0000000000..69d23e8357 --- /dev/null +++ b/src/SettingsMigrator/Program.cs @@ -0,0 +1,49 @@ +// 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; +using System.IO; + +namespace Microsoft.VisualStudio.TestPlatform.CommandLine +{ + class Program + { + static void Main(string[] args) + { + if (args.Length != 2) + { + Console.WriteLine("Valid usage:\nSettingsMigrator.exe [Full path to testsettings file/runsettings file to be migrated] [Full path to new runsettings file]"); + return; + } + + string oldFilePath = args[0]; + string newFilePath = args[1]; + + if (!Path.IsPathRooted(oldFilePath) || !Path.IsPathRooted(newFilePath) || !string.Equals(Path.GetExtension(newFilePath), RunsettingsExtension)) + { + Console.WriteLine("Valid usage:\nSettingsMigrator.exe [Full path to testsettings file/runsettings file to be migrated] [Full path to new runsettings file]"); + return; + } + + var migrator = new Migrator(); + + if (string.Equals(Path.GetExtension(oldFilePath), TestsettingsExtension)) + { + migrator.MigrateTestsettings(oldFilePath, newFilePath); + } + else if (string.Equals(Path.GetExtension(oldFilePath), RunsettingsExtension)) + { + migrator.MigrateRunsettings(oldFilePath, newFilePath); + } + else + { + Console.WriteLine("Valid usage:\nSettingsMigrator.exe [Full path to testsettings file/runsettings file to be migrated] [Full path to new runsettings file]"); + return; + } + } + + const string RunsettingsExtension = ".runsettings"; + const string TestsettingsExtension = ".testsettings"; + } +} + diff --git a/src/SettingsMigrator/Properties/AssemblyInfo.cs b/src/SettingsMigrator/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..03f6bc2fbd --- /dev/null +++ b/src/SettingsMigrator/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +// 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("SettingsMigrator")] +[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("8193192e-8ead-4871-b626-8b832f8fa654")] diff --git a/src/SettingsMigrator/Resources/Resources.Designer.cs b/src/SettingsMigrator/Resources/Resources.Designer.cs new file mode 100644 index 0000000000..5f282702bb --- /dev/null +++ b/src/SettingsMigrator/Resources/Resources.Designer.cs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/SettingsMigrator/Resources/Resources.resx b/src/SettingsMigrator/Resources/Resources.resx new file mode 100644 index 0000000000..9464b58fd3 --- /dev/null +++ b/src/SettingsMigrator/Resources/Resources.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + \ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf b/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf new file mode 100644 index 0000000000..87ee60c31a --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.de.xlf b/src/SettingsMigrator/Resources/xlf/Resources.de.xlf new file mode 100644 index 0000000000..2bd4739a2a --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.de.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.es.xlf b/src/SettingsMigrator/Resources/xlf/Resources.es.xlf new file mode 100644 index 0000000000..aa2a558675 --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.es.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf b/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf new file mode 100644 index 0000000000..5506da0d0f --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.it.xlf b/src/SettingsMigrator/Resources/xlf/Resources.it.xlf new file mode 100644 index 0000000000..f2c6c4ac53 --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.it.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf b/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf new file mode 100644 index 0000000000..92644a4650 --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf b/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf new file mode 100644 index 0000000000..a804409b81 --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf b/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf new file mode 100644 index 0000000000..02e8d2fbfa --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf b/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf new file mode 100644 index 0000000000..ab2206c4af --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf b/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf new file mode 100644 index 0000000000..cb823c7d77 --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf b/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf new file mode 100644 index 0000000000..92e7e3cfa8 --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.xlf b/src/SettingsMigrator/Resources/xlf/Resources.xlf new file mode 100644 index 0000000000..0a59b0c85c --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.xlf @@ -0,0 +1,12 @@ + + + + + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + + + \ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf new file mode 100644 index 0000000000..375d9b98ab --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf new file mode 100644 index 0000000000..5d78eef487 --- /dev/null +++ b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf @@ -0,0 +1,30 @@ + + + +
+ + 1766 + 1498.1 + 1498.1 + 1.25 + 0 + + + 0 + 0 + 0 + 0 + 0 + 1761 + 5 + +
+ + + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + + + +
+
\ No newline at end of file diff --git a/src/SettingsMigrator/SettingsMigrator.csproj b/src/SettingsMigrator/SettingsMigrator.csproj new file mode 100644 index 0000000000..824453cf1a --- /dev/null +++ b/src/SettingsMigrator/SettingsMigrator.csproj @@ -0,0 +1,43 @@ + + + + ..\..\ + + + + SettingsMigrator + net451 + true + Exe + AnyCPU + true + app.manifest + + + win7-x64 + + + + + + + + + + + + + + True + True + Resources.resx + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + diff --git a/src/SettingsMigrator/app.manifest b/src/SettingsMigrator/app.manifest new file mode 100644 index 0000000000..9952698906 --- /dev/null +++ b/src/SettingsMigrator/app.manifest @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/package/nuspec/Microsoft.TestPlatform.nuspec b/src/package/nuspec/Microsoft.TestPlatform.nuspec index 150d15354f..8b20197e93 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.nuspec +++ b/src/package/nuspec/Microsoft.TestPlatform.nuspec @@ -174,6 +174,8 @@ + + @@ -188,6 +190,7 @@ + @@ -199,6 +202,7 @@ + @@ -210,6 +214,7 @@ + @@ -274,6 +279,7 @@ + @@ -285,6 +291,7 @@ + @@ -296,6 +303,7 @@ + @@ -307,6 +315,7 @@ + @@ -318,6 +327,7 @@ + @@ -329,6 +339,7 @@ + @@ -340,6 +351,7 @@ + @@ -351,6 +363,7 @@ + @@ -366,6 +379,7 @@ + @@ -377,6 +391,7 @@ + diff --git a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs new file mode 100644 index 0000000000..3661f08a6e --- /dev/null +++ b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs @@ -0,0 +1,157 @@ +// 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.VisualStudio.TestPlatform.CommandLine.UnitTests +{ + using System.IO; + using System.Xml; + using Microsoft.VisualStudio.TestPlatform.CommandLine; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class MigratorUnitTests + { + [TestMethod] + public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() + { + var migrator = new Migrator(); + string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); + string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); + string oldRunsettingsPath = Path.Combine(Path.GetTempPath(), "oldRunsettings.runsettings"); + + File.WriteAllText(oldTestsettingsPath, oldtestsettings); + File.WriteAllText(newRunsettingsPath, ""); + + var doc = new XmlDocument(); + doc.LoadXml(oldrunsettings); + var settingsnode = doc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); + settingsnode.InnerText = oldTestsettingsPath; + File.WriteAllText(oldRunsettingsPath, doc.InnerXml); + + migrator.MigrateRunsettings(oldRunsettingsPath, newRunsettingsPath); + + Assert.IsTrue(File.Exists(newRunsettingsPath), "Run settings should be generated."); + + using (XmlTextReader reader = new XmlTextReader(newRunsettingsPath)) + { + reader.Namespaces = false; + + var document = new XmlDocument(); + document.Load(reader); + var root = document.DocumentElement; + + Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/WebTestRunConfiguration/Browser/Headers/Header"), "There should be a WebTestRunConfiguration node"); + Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings"), "There should be a LegacySettings node"); + Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings/Deployment/DeploymentItem"), "There should be a DeploymentItem node"); + + var scriptNode = root.SelectSingleNode(@"/RunSettings/LegacySettings/Scripts"); + Assert.IsNotNull(scriptNode, "There should be a WebTestRunConfiguration node"); + Assert.AreEqual(".\\setup.bat", scriptNode.Attributes["setupScript"].Value, "setupScript does not match."); + Assert.AreEqual(".\\cleanup.bat", scriptNode.Attributes["cleanupScript"].Value, "cleanupScript does not match."); + + var timeoutNode = root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution/Timeouts"); + Assert.IsNotNull(timeoutNode, "There should be a Timeouts node"); + Assert.AreEqual("120000", timeoutNode.Attributes["testTimeout"].Value, "testTimeout value does not match."); + + Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution/TestTypeSpecific/UnitTestRunConfig/AssemblyResolution/TestDirectory"), "There should be a Assembly resolution node"); + + var testSessionTimeoutNode = root.SelectSingleNode(@"/RunSettings/RunConfiguration/TestSessionTimeout"); + Assert.IsNotNull(testSessionTimeoutNode, "There should be a TestSessionTimeout node"); + Assert.AreEqual(testSessionTimeoutNode.InnerText, "60000", "Timeout value does not match."); + } + + File.Delete(oldRunsettingsPath); + File.Delete(newRunsettingsPath); + File.Delete(oldTestsettingsPath); + } + + + [TestMethod] + public void MigratorGeneratesCorrectRunsettingsForTestSettings() + { + var migrator = new Migrator(); + string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); + string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); + //File.Create(oldTestsettingsPath); + //File.Create(newRunsettingsPath); + File.WriteAllText(oldTestsettingsPath, oldtestsettings); + File.WriteAllText(newRunsettingsPath, ""); + + migrator.MigrateTestsettings(oldTestsettingsPath, newRunsettingsPath); + + Assert.IsTrue(File.Exists(newRunsettingsPath), "Run settings should be generated."); + + using (XmlTextReader reader = new XmlTextReader(newRunsettingsPath)) + { + reader.Namespaces = false; + + var document = new XmlDocument(); + document.Load(reader); + var root = document.DocumentElement; + + Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/WebTestRunConfiguration/Browser/Headers/Header"), "There should be a WebTestRunConfiguration node"); + Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings"), "There should be a LegacySettings node"); + Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings/Deployment/DeploymentItem"), "There should be a DeploymentItem node"); + + var scriptNode = root.SelectSingleNode(@"/RunSettings/LegacySettings/Scripts"); + Assert.IsNotNull(scriptNode, "There should be a WebTestRunConfiguration node"); + Assert.AreEqual(".\\setup.bat", scriptNode.Attributes["setupScript"].Value, "setupScript does not match."); + Assert.AreEqual(".\\cleanup.bat", scriptNode.Attributes["cleanupScript"].Value, "cleanupScript does not match."); + + var timeoutNode = root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution/Timeouts"); + Assert.IsNotNull(timeoutNode, "There should be a Timeouts node"); + Assert.AreEqual("120000", timeoutNode.Attributes["testTimeout"].Value, "testTimeout value does not match."); + + Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution/TestTypeSpecific/UnitTestRunConfig/AssemblyResolution/TestDirectory"), "There should be a Assembly resolution node"); + + var testSessionTimeoutNode = root.SelectSingleNode(@"/RunSettings/RunConfiguration/TestSessionTimeout"); + Assert.IsNotNull(testSessionTimeoutNode, "There should be a TestSessionTimeout node"); + Assert.AreEqual(testSessionTimeoutNode.InnerText, "60000", "Timeout value does not match."); + } + + File.Delete(newRunsettingsPath); + File.Delete(oldTestsettingsPath); + } + + const string oldrunsettings = "" + + "" + + "true" + + "" + + "" + + ""; + + const string oldtestsettings = "" + + "" + + "These are default test settings for a local test run." + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "
" + + "
" + + "
" + + "
" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + } + + +} diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj new file mode 100644 index 0000000000..7460da6c9f --- /dev/null +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -0,0 +1,30 @@ + + + + ..\..\ + true + + + + Exe + net451 + SettingsMigrator.UnitTests + + + + + true + + + true + + + + + + + + + + + From 2188d5c89f60fbc45067dd05e80ddfb5881a3c70 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Wed, 16 May 2018 16:12:43 +0530 Subject: [PATCH 02/21] Adding project to sln --- TestPlatform.sln | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/TestPlatform.sln b/TestPlatform.sln index 852d3c11e7..3849fef928 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -166,6 +166,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Trac EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.TraceDataCollector.UnitTests", "test\DataCollectors\TraceDataCollector.UnitTests\Microsoft.TestPlatform.TraceDataCollector.UnitTests.csproj", "{A7E2261B-B2E6-4CBF-983F-E3A3FF8E52E3}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SettingsMigrator", "src\SettingsMigrator\SettingsMigrator.csproj", "{69F5FF81-5615-4F06-B83C-FCF979BB84CA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SettingsMigrator.UnitTests", "test\SettingsMigrator.UnitTests\SettingsMigrator.UnitTests.csproj", "{E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -824,6 +828,30 @@ Global {A7E2261B-B2E6-4CBF-983F-E3A3FF8E52E3}.Release|x64.Build.0 = Release|Any CPU {A7E2261B-B2E6-4CBF-983F-E3A3FF8E52E3}.Release|x86.ActiveCfg = Release|Any CPU {A7E2261B-B2E6-4CBF-983F-E3A3FF8E52E3}.Release|x86.Build.0 = Release|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Debug|x64.ActiveCfg = Debug|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Debug|x64.Build.0 = Debug|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Debug|x86.ActiveCfg = Debug|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Debug|x86.Build.0 = Debug|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Release|Any CPU.Build.0 = Release|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Release|x64.ActiveCfg = Release|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Release|x64.Build.0 = Release|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Release|x86.ActiveCfg = Release|Any CPU + {69F5FF81-5615-4F06-B83C-FCF979BB84CA}.Release|x86.Build.0 = Release|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Debug|x64.ActiveCfg = Debug|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Debug|x64.Build.0 = Debug|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Debug|x86.ActiveCfg = Debug|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Debug|x86.Build.0 = Debug|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Release|Any CPU.Build.0 = Release|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Release|x64.ActiveCfg = Release|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Release|x64.Build.0 = Release|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Release|x86.ActiveCfg = Release|Any CPU + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -895,6 +923,8 @@ Global {24C7683D-2607-4901-B8EB-83A57E49E93D} = {376C19DE-31E2-4FF6-88FC-0D0D6233C999} {32BD96BD-16FB-43F0-B952-E7EEDB6DD813} = {B705537C-B82C-4A30-AFA5-6244D9A7DAEB} {A7E2261B-B2E6-4CBF-983F-E3A3FF8E52E3} = {D9A30E32-D466-4EC5-B4F2-62E17562279B} + {69F5FF81-5615-4F06-B83C-FCF979BB84CA} = {ED0C35EB-7F31-4841-A24F-8EB708FFA959} + {E7D4921C-F12D-4E1C-85AC-8B7F91C59B0E} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0541B30C-FF51-4E28-B172-83F5F3934BCD} From 6922920b4aa2a4be6d30a2dd2ad1dee7dc6f6bf1 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Thu, 17 May 2018 10:23:56 +0530 Subject: [PATCH 03/21] Refactoring --- src/SettingsMigrator/Migrator.cs | 215 +++++++++--------- src/SettingsMigrator/Program.cs | 22 +- .../Resources/Resources.Designer.cs | 85 ++++++- src/SettingsMigrator/TestSettingsNodes.cs | 21 ++ .../MigratorUnitTests.cs | 4 +- 5 files changed, 232 insertions(+), 115 deletions(-) create mode 100644 src/SettingsMigrator/TestSettingsNodes.cs diff --git a/src/SettingsMigrator/Migrator.cs b/src/SettingsMigrator/Migrator.cs index 5343d7628b..aac59aac4b 100644 --- a/src/SettingsMigrator/Migrator.cs +++ b/src/SettingsMigrator/Migrator.cs @@ -10,143 +10,155 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine public class Migrator { /// - /// Given a runsettings with an embedded testsettings, converts it to runsettings. + /// Given a runSettings with an embedded testSettings, converts it to runSettings. /// - /// - /// - public void MigrateRunsettings(string oldRunsettingsPath, string newRunsettingsPath) + /// + /// + public void MigrateRunSettings(string oldRunSettingsPath, string newRunSettingsPath) { - string testsettingsPath = null; - using (XmlTextReader reader = new XmlTextReader(oldRunsettingsPath)) + string testSettingsPath = null; + using (XmlTextReader reader = new XmlTextReader(oldRunSettingsPath)) { reader.Namespaces = false; - var document = new XmlDocument(); - document.Load(reader); - var root = document.DocumentElement; + var runSettingsXmlDoc = new XmlDocument(); + runSettingsXmlDoc.Load(reader); + var root = runSettingsXmlDoc.DocumentElement; - var testsettingsNode = root.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); + var testSettingsNode = root.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); - if (testsettingsNode != null) + if (testSettingsNode != null) { - testsettingsPath = testsettingsNode.InnerText; + testSettingsPath = testSettingsNode.InnerText; } - if (!string.IsNullOrWhiteSpace(testsettingsPath)) + if (!string.IsNullOrWhiteSpace(testSettingsPath)) { - // Expand path relative to runsettings location. - if (!Path.IsPathRooted(testsettingsPath)) + // Expand path relative to runSettings location. + if (!Path.IsPathRooted(testSettingsPath)) { - testsettingsPath = Path.Combine(oldRunsettingsPath, testsettingsPath); + testSettingsPath = Path.Combine(oldRunSettingsPath, testSettingsPath); } - MigrateTestsettings(testsettingsPath, newRunsettingsPath, File.ReadAllText(oldRunsettingsPath)); + MigrateTestSettingsNodesToRunSettings(testSettingsPath, runSettingsXmlDoc); + + runSettingsXmlDoc.Save(newRunSettingsPath); } else { - Console.WriteLine("Runsettings does not contain an embedded testsettings, not migrating."); + Console.WriteLine("RunSettings does not contain an embedded testSettings, not migrating."); } } } + + public void MigrateTestSettings(string oldTestSettingsPath, string newRunSettingsPath) + { + var runSettingsXmlDoc = new XmlDocument(); + runSettingsXmlDoc.LoadXml(sampleRunSettingsContent); + + MigrateTestSettingsNodesToRunSettings(oldTestSettingsPath, runSettingsXmlDoc); + + runSettingsXmlDoc.Save(newRunSettingsPath); + } + /// - /// Given a testsettings, converts it to runsettings + /// Given a testSettings, converts it to runSettings /// - /// - /// + /// + /// /// - public void MigrateTestsettings(string testsettingsPath, string newRunsettingsPath, string oldRunSettingsContent = null) + public void MigrateTestSettingsNodesToRunSettings(string testSettingsPath, XmlDocument runSettingsXmlDoc) { - using (XmlTextReader reader = new XmlTextReader(testsettingsPath)) + var testSettingsNodes = ReadTestSettingsNodes(testSettingsPath); + + string testTimeout = null; + if (testSettingsNodes.Timeout != null && testSettingsNodes.Timeout.Attributes[TestTimeoutAttributeName] != null) { - reader.Namespaces = false; + testTimeout = testSettingsNodes.Timeout.Attributes[TestTimeoutAttributeName].Value; + } - var document = new XmlDocument(); - document.Load(reader); - var root = document.DocumentElement; + string runTimeout = null; + if (testSettingsNodes.Timeout != null && testSettingsNodes.Timeout.Attributes[RunTimeoutAttributeName] != null) + { + runTimeout = testSettingsNodes.Timeout.Attributes[RunTimeoutAttributeName].Value; + } - // Select the interesting nodes from the xml. - var deploymentNode = root.SelectSingleNode(@"/TestSettings/Deployment"); - var scriptnode = root.SelectSingleNode(@"/TestSettings/Scripts"); - var websettingsNode = root.SelectSingleNode(@"/TestSettings/Execution/TestTypeSpecific/WebTestRunConfiguration"); - var oldDatacollectorNodes = root.SelectNodes(@"/TestSettings/AgentRule/DataCollectors/DataCollector"); - var timeoutNode = root.SelectSingleNode(@"/TestSettings/Execution/Timeouts"); - var assemblyresolutionNode = root.SelectSingleNode(@"/TestSettings/Execution/TestTypeSpecific/UnitTestRunConfig"); - var hostsNode = root.SelectSingleNode(@"/TestSettings/Execution/Hosts"); - var executionNode = root.SelectSingleNode(@"/TestSettings/Execution"); - - string testTimeout = null; - if (timeoutNode != null && timeoutNode.Attributes[TestTimeoutAttributeName] != null) - { - testTimeout = timeoutNode.Attributes[TestTimeoutAttributeName].Value; - } + string parallelTestCount = null; + if (testSettingsNodes.Execution != null && testSettingsNodes.Execution.Attributes[ParallelTestCountAttributeName] != null) + { + parallelTestCount = testSettingsNodes.Execution.Attributes[ParallelTestCountAttributeName].Value; + } - string runTimeout = null; - if (timeoutNode != null && timeoutNode.Attributes[RunTimeoutAttributeName] != null) - { - runTimeout = timeoutNode.Attributes[RunTimeoutAttributeName].Value; - } + // Remove the embedded testSettings node if it exists. + RemoveEmbeddedTestSettings(runSettingsXmlDoc); - string parallelTestCount = null; - if (executionNode != null && executionNode.Attributes[ParallelTestCountAttributeName] != null) - { - parallelTestCount = executionNode.Attributes[ParallelTestCountAttributeName].Value; - } + // WebTestRunConfiguration node. + if (testSettingsNodes.WebSettings != null) + { + runSettingsXmlDoc.DocumentElement.AppendChild(runSettingsXmlDoc.ImportNode(testSettingsNodes.WebSettings, deep: true)); + } - if(string.IsNullOrEmpty(oldRunSettingsContent)) - { - oldRunSettingsContent = sampleRunsettingsContent; - } - var newXmlDoc = new XmlDocument(); - newXmlDoc.LoadXml(oldRunSettingsContent); + // LegacySettings node. + if (testSettingsNodes.Deployment != null || testSettingsNodes.Script != null || testSettingsNodes.UnitTestConfig != null || + !string.IsNullOrEmpty(parallelTestCount) || !string.IsNullOrEmpty(testTimeout) || testSettingsNodes.Hosts != null) + { + AddLegacyNodes(testSettingsNodes, testTimeout, parallelTestCount, runSettingsXmlDoc); + } - // Remove the embedded testsettings node if it exists. - RemoveEmbeddedTestsettings(newXmlDoc); + // TestSessionTimeout node. + if (!string.IsNullOrEmpty(runTimeout)) + { + AddRunTimeoutNode(runTimeout, runSettingsXmlDoc); + } - // WebTestRunConfiguration node. - if (websettingsNode != null) - { - newXmlDoc.DocumentElement.AppendChild(newXmlDoc.ImportNode(websettingsNode, deep: true)); - } + // DataCollectors node. + if (testSettingsNodes.Datacollectors != null && testSettingsNodes.Datacollectors.Count > 0) + { + AddDataCollectorNodes(testSettingsNodes.Datacollectors, runSettingsXmlDoc); + } + } - // LegacySettings node. - if (deploymentNode != null || scriptnode != null || assemblyresolutionNode != null || - !string.IsNullOrEmpty(parallelTestCount) || !string.IsNullOrEmpty(testTimeout) || hostsNode != null) - { - AddLegacyNodes(deploymentNode, scriptnode, testTimeout, assemblyresolutionNode, hostsNode, parallelTestCount, newXmlDoc); - } + private TestSettingsNodes ReadTestSettingsNodes(string testSettingsPath) + { + var testSettingsNodes = new TestSettingsNodes(); - // TestSessionTimeout node. - if (!string.IsNullOrEmpty(runTimeout)) - { - AddRunTimeoutNode(runTimeout, newXmlDoc); - } + using (XmlTextReader reader = new XmlTextReader(testSettingsPath)) + { + reader.Namespaces = false; - // DataCollectors node. - if (oldDatacollectorNodes != null && oldDatacollectorNodes.Count > 0) - { - AddDataCollectorNodes(oldDatacollectorNodes, newXmlDoc); - } + var testSettingsXmlDoc = new XmlDocument(); + testSettingsXmlDoc.Load(reader); + var testSettingsRoot = testSettingsXmlDoc.DocumentElement; - newXmlDoc.Save(newRunsettingsPath); + // Select the interesting nodes from the xml. + testSettingsNodes.Deployment = testSettingsRoot.SelectSingleNode(@"/TestSettings/Deployment"); + testSettingsNodes.Script = testSettingsRoot.SelectSingleNode(@"/TestSettings/Scripts"); + testSettingsNodes.WebSettings = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/TestTypeSpecific/WebTestRunConfiguration"); + testSettingsNodes.Datacollectors = testSettingsRoot.SelectNodes(@"/TestSettings/AgentRule/DataCollectors/DataCollector"); + testSettingsNodes.Timeout = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/Timeouts"); + testSettingsNodes.UnitTestConfig = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/TestTypeSpecific/UnitTestRunConfig"); + testSettingsNodes.Hosts = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/Hosts"); + testSettingsNodes.Execution = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution"); } + + return testSettingsNodes; } /// - /// Removes the embedded testsettings node if present. + /// Removes the embedded testSettings node if present. /// /// - private void RemoveEmbeddedTestsettings(XmlDocument newXmlDoc) + private void RemoveEmbeddedTestSettings(XmlDocument newXmlDoc) { - var testsettingsNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); - if (testsettingsNode != null) + var testSettingsNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); + if (testSettingsNode != null) { - testsettingsNode.ParentNode.RemoveChild(testsettingsNode); + testSettingsNode.ParentNode.RemoveChild(testSettingsNode); } } - /// - /// Adds the legacy nodes to runsettings xml. + /// Adds the legacy nodes to runSettings xml. /// /// /// @@ -155,7 +167,7 @@ private void RemoveEmbeddedTestsettings(XmlDocument newXmlDoc) /// /// /// - private void AddLegacyNodes(XmlNode deploymentNode, XmlNode scriptnode, string testTimeout, XmlNode assemblyresolutionNode, XmlNode hostsNode, string parallelTestCount, XmlDocument newXmlDoc) + private void AddLegacyNodes(TestSettingsNodes testSettingsNodes, string testTimeout, string parallelTestCount, XmlDocument newXmlDoc) { //Remove if the legacy node already exists. var legacyNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/LegacySettings"); @@ -166,17 +178,17 @@ private void AddLegacyNodes(XmlNode deploymentNode, XmlNode scriptnode, string t legacyNode = newXmlDoc.CreateNode(XmlNodeType.Element, LegacySettingsNodeName, null); - if (deploymentNode != null) + if (testSettingsNodes.Deployment != null) { - legacyNode.AppendChild(newXmlDoc.ImportNode(deploymentNode, deep: true)); + legacyNode.AppendChild(newXmlDoc.ImportNode(testSettingsNodes.Deployment, deep: true)); } - if (scriptnode != null) + if (testSettingsNodes.Script != null) { - legacyNode.AppendChild(newXmlDoc.ImportNode(scriptnode, deep: true)); + legacyNode.AppendChild(newXmlDoc.ImportNode(testSettingsNodes.Script, deep: true)); } // Execution node. - if (assemblyresolutionNode != null || !string.IsNullOrEmpty(parallelTestCount) || !string.IsNullOrEmpty(testTimeout) || hostsNode != null) + if (testSettingsNodes.UnitTestConfig != null || !string.IsNullOrEmpty(parallelTestCount) || !string.IsNullOrEmpty(testTimeout) || testSettingsNodes.Hosts != null) { var newExecutionNode = newXmlDoc.CreateNode(XmlNodeType.Element, ExecutionNodeName, null); @@ -194,14 +206,14 @@ private void AddLegacyNodes(XmlNode deploymentNode, XmlNode scriptnode, string t newTimeoutsNode.Attributes.Append(testtimeoutattribute); newExecutionNode.AppendChild(newXmlDoc.ImportNode(newTimeoutsNode, deep: true)); } - if (hostsNode != null) + if (testSettingsNodes.Hosts != null) { - newExecutionNode.AppendChild(newXmlDoc.ImportNode(hostsNode, deep: true)); + newExecutionNode.AppendChild(newXmlDoc.ImportNode(testSettingsNodes.Hosts, deep: true)); } - if (assemblyresolutionNode != null) + if (testSettingsNodes.UnitTestConfig != null) { var testTypeSpecificNode = newXmlDoc.CreateNode(XmlNodeType.Element, TestTypeSpecificNodeName, null); - testTypeSpecificNode.AppendChild(newXmlDoc.ImportNode(assemblyresolutionNode, deep: true)); + testTypeSpecificNode.AppendChild(newXmlDoc.ImportNode(testSettingsNodes.UnitTestConfig, deep: true)); newExecutionNode.AppendChild(newXmlDoc.ImportNode(testTypeSpecificNode, deep: true)); } legacyNode.AppendChild(newXmlDoc.ImportNode(newExecutionNode, deep: true)); @@ -209,9 +221,8 @@ private void AddLegacyNodes(XmlNode deploymentNode, XmlNode scriptnode, string t newXmlDoc.DocumentElement.AppendChild(legacyNode); } - /// - /// Adds the datacollector nodes to the runsettings xml. + /// Adds the datacollector nodes to the runSettings xml. /// /// /// @@ -269,7 +280,7 @@ private void AddRunTimeoutNode(string runTimeout, XmlDocument newXmlDoc) const string TestSessionTimeoutNodeName = "TestSessionTimeout"; const string DataCollectionRunSettingsNodeName = "DataCollectionRunSettings"; const string DataCollectorsNodeName = "DataCollectors"; - const string sampleRunsettingsContent = "" + + const string sampleRunSettingsContent = "" + ""; } } diff --git a/src/SettingsMigrator/Program.cs b/src/SettingsMigrator/Program.cs index 69d23e8357..426527500c 100644 --- a/src/SettingsMigrator/Program.cs +++ b/src/SettingsMigrator/Program.cs @@ -2,7 +2,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Globalization; using System.IO; +using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; namespace Microsoft.VisualStudio.TestPlatform.CommandLine { @@ -12,38 +14,38 @@ static void Main(string[] args) { if (args.Length != 2) { - Console.WriteLine("Valid usage:\nSettingsMigrator.exe [Full path to testsettings file/runsettings file to be migrated] [Full path to new runsettings file]"); + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); return; } string oldFilePath = args[0]; string newFilePath = args[1]; - if (!Path.IsPathRooted(oldFilePath) || !Path.IsPathRooted(newFilePath) || !string.Equals(Path.GetExtension(newFilePath), RunsettingsExtension)) + if (!Path.IsPathRooted(oldFilePath) || !Path.IsPathRooted(newFilePath) || !string.Equals(Path.GetExtension(newFilePath), RunSettingsExtension)) { - Console.WriteLine("Valid usage:\nSettingsMigrator.exe [Full path to testsettings file/runsettings file to be migrated] [Full path to new runsettings file]"); + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); return; } var migrator = new Migrator(); - if (string.Equals(Path.GetExtension(oldFilePath), TestsettingsExtension)) + if (string.Equals(Path.GetExtension(oldFilePath), TestSettingsExtension)) { - migrator.MigrateTestsettings(oldFilePath, newFilePath); + migrator.MigrateTestSettings(oldFilePath, newFilePath); } - else if (string.Equals(Path.GetExtension(oldFilePath), RunsettingsExtension)) + else if (string.Equals(Path.GetExtension(oldFilePath), RunSettingsExtension)) { - migrator.MigrateRunsettings(oldFilePath, newFilePath); + migrator.MigrateRunSettings(oldFilePath, newFilePath); } else { - Console.WriteLine("Valid usage:\nSettingsMigrator.exe [Full path to testsettings file/runsettings file to be migrated] [Full path to new runsettings file]"); + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); return; } } - const string RunsettingsExtension = ".runsettings"; - const string TestsettingsExtension = ".testsettings"; + const string RunSettingsExtension = ".runsettings"; + const string TestSettingsExtension = ".testsettings"; } } diff --git a/src/SettingsMigrator/Resources/Resources.Designer.cs b/src/SettingsMigrator/Resources/Resources.Designer.cs index 5f282702bb..5d67840b9f 100644 --- a/src/SettingsMigrator/Resources/Resources.Designer.cs +++ b/src/SettingsMigrator/Resources/Resources.Designer.cs @@ -1 +1,84 @@ - \ No newline at end of file +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Resources +{ + using System; + using System.Reflection; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SettingsMigrator.Resources.Resources", typeof(Resources).GetTypeInfo().Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Valid usage: SettingsMigrator.exe + /// + public static string ValidUsage + { + get + { + return ResourceManager.GetString("ValidUsage", resourceCulture); + } + } + } +} diff --git a/src/SettingsMigrator/TestSettingsNodes.cs b/src/SettingsMigrator/TestSettingsNodes.cs new file mode 100644 index 0000000000..825b0eb8e2 --- /dev/null +++ b/src/SettingsMigrator/TestSettingsNodes.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace Microsoft.VisualStudio.TestPlatform.CommandLine +{ + public class TestSettingsNodes + { + public XmlNode Deployment { get; set; } + public XmlNode Script { get; set; } + public XmlNode WebSettings { get; set; } + public XmlNodeList Datacollectors { get; set; } + public XmlNode Timeout { get; set; } + public XmlNode UnitTestConfig { get; set; } + public XmlNode Hosts { get; set; } + public XmlNode Execution { get; set; } + } +} diff --git a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs index 3661f08a6e..97d3d706ef 100644 --- a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs +++ b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs @@ -28,7 +28,7 @@ public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() settingsnode.InnerText = oldTestsettingsPath; File.WriteAllText(oldRunsettingsPath, doc.InnerXml); - migrator.MigrateRunsettings(oldRunsettingsPath, newRunsettingsPath); + migrator.MigrateRunSettings(oldRunsettingsPath, newRunsettingsPath); Assert.IsTrue(File.Exists(newRunsettingsPath), "Run settings should be generated."); @@ -77,7 +77,7 @@ public void MigratorGeneratesCorrectRunsettingsForTestSettings() File.WriteAllText(oldTestsettingsPath, oldtestsettings); File.WriteAllText(newRunsettingsPath, ""); - migrator.MigrateTestsettings(oldTestsettingsPath, newRunsettingsPath); + migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); Assert.IsTrue(File.Exists(newRunsettingsPath), "Run settings should be generated."); From dab18beaffe77ed2102d7ef9472f471eba154b61 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Thu, 17 May 2018 14:18:45 +0530 Subject: [PATCH 04/21] PR comments --- src/SettingsMigrator/Migrator.cs | 31 +++++++++++++++---- src/SettingsMigrator/Program.cs | 17 +++++++--- .../Resources/Resources.Designer.cs | 22 +++++++++++++ src/SettingsMigrator/Resources/Resources.resx | 6 ++++ src/SettingsMigrator/TestSettingsNodes.cs | 13 ++++---- 5 files changed, 72 insertions(+), 17 deletions(-) diff --git a/src/SettingsMigrator/Migrator.cs b/src/SettingsMigrator/Migrator.cs index aac59aac4b..e189b22dea 100644 --- a/src/SettingsMigrator/Migrator.cs +++ b/src/SettingsMigrator/Migrator.cs @@ -1,12 +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. -using System; -using System.IO; -using System.Xml; - namespace Microsoft.VisualStudio.TestPlatform.CommandLine { + using System; + using System.IO; + using System.Xml; + using System.Globalization; + using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; + + /// + /// Migrator used to migrate test settings and run settings with embedded testsettings to run settings. + /// public class Migrator { /// @@ -50,7 +55,11 @@ public void MigrateRunSettings(string oldRunSettingsPath, string newRunSettingsP } } - + /// + /// Given a testSettings, converts it to runSettings. + /// + /// + /// public void MigrateTestSettings(string oldTestSettingsPath, string newRunSettingsPath) { var runSettingsXmlDoc = new XmlDocument(); @@ -67,7 +76,7 @@ public void MigrateTestSettings(string oldTestSettingsPath, string newRunSetting /// /// /// - public void MigrateTestSettingsNodesToRunSettings(string testSettingsPath, XmlDocument runSettingsXmlDoc) + private void MigrateTestSettingsNodesToRunSettings(string testSettingsPath, XmlDocument runSettingsXmlDoc) { var testSettingsNodes = ReadTestSettingsNodes(testSettingsPath); @@ -139,6 +148,12 @@ private TestSettingsNodes ReadTestSettingsNodes(string testSettingsPath) testSettingsNodes.UnitTestConfig = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/TestTypeSpecific/UnitTestRunConfig"); testSettingsNodes.Hosts = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/Hosts"); testSettingsNodes.Execution = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution"); + + if (testSettingsNodes.Timeout != null && (testSettingsNodes.Timeout.Attributes[TestTimeoutAttributeName] != null || + testSettingsNodes.Timeout.Attributes[TestTimeoutAttributeName] != null || testSettingsNodes.Timeout.Attributes[TestTimeoutAttributeName] != null)) + { + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); + } } return testSettingsNodes; @@ -173,6 +188,7 @@ private void AddLegacyNodes(TestSettingsNodes testSettingsNodes, string testTime var legacyNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/LegacySettings"); if (legacyNode != null) { + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.IgnoringLegacySettings)); legacyNode.ParentNode.RemoveChild(legacyNode); } @@ -282,6 +298,9 @@ private void AddRunTimeoutNode(string runTimeout, XmlDocument newXmlDoc) const string DataCollectorsNodeName = "DataCollectors"; const string sampleRunSettingsContent = "" + ""; + const string agentNotRespondingTimeout = "agentNotRespondingTimeout"; + const string DeploymentTimeout = "deploymentTimeout"; + const string ScriptTimeout = "scriptTimeout"; } } diff --git a/src/SettingsMigrator/Program.cs b/src/SettingsMigrator/Program.cs index 426527500c..daa8fbe9aa 100644 --- a/src/SettingsMigrator/Program.cs +++ b/src/SettingsMigrator/Program.cs @@ -1,15 +1,22 @@ // 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; -using System.Globalization; -using System.IO; -using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; - namespace Microsoft.VisualStudio.TestPlatform.CommandLine { + using System; + using System.Globalization; + using System.IO; + using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; + + /// + /// Entry point for SettingsMigrator. + /// class Program { + /// + /// Main entry point. Hands off execution to Migrator. + /// + /// Arguments provided on the command line. static void Main(string[] args) { if (args.Length != 2) diff --git a/src/SettingsMigrator/Resources/Resources.Designer.cs b/src/SettingsMigrator/Resources/Resources.Designer.cs index 5d67840b9f..3fc7ff5f6a 100644 --- a/src/SettingsMigrator/Resources/Resources.Designer.cs +++ b/src/SettingsMigrator/Resources/Resources.Designer.cs @@ -70,6 +70,17 @@ public Resources() } } + /// + /// Looks up a localized string similar to Any LegacySettings node already present in the runsettings will be removed. + /// + public static string IgnoringLegacySettings + { + get + { + return ResourceManager.GetString("IgnoringLegacySettings", resourceCulture); + } + } + /// /// Looks up a localized string similar to Valid usage: SettingsMigrator.exe /// @@ -80,5 +91,16 @@ public static string ValidUsage return ResourceManager.GetString("ValidUsage", resourceCulture); } } + + /// + /// Looks up a localized string similar to The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + /// + public static string UnsupportedAttributes + { + get + { + return ResourceManager.GetString("UnsupportedAttributes", resourceCulture); + } + } } } diff --git a/src/SettingsMigrator/Resources/Resources.resx b/src/SettingsMigrator/Resources/Resources.resx index 9464b58fd3..0fecc686c4 100644 --- a/src/SettingsMigrator/Resources/Resources.resx +++ b/src/SettingsMigrator/Resources/Resources.resx @@ -117,6 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Any LegacySettings node already present in the runsettings will be removed. + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> diff --git a/src/SettingsMigrator/TestSettingsNodes.cs b/src/SettingsMigrator/TestSettingsNodes.cs index 825b0eb8e2..93c31c05eb 100644 --- a/src/SettingsMigrator/TestSettingsNodes.cs +++ b/src/SettingsMigrator/TestSettingsNodes.cs @@ -1,12 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml; +// 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.VisualStudio.TestPlatform.CommandLine { + using System.Xml; + + /// + /// Contains the test settings nodes that need to be converted. + /// public class TestSettingsNodes { public XmlNode Deployment { get; set; } From 528f31a820f2602bd283c6889dd540345af1afb0 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Thu, 17 May 2018 14:39:25 +0530 Subject: [PATCH 05/21] More UTs --- .../MigratorUnitTests.cs | 60 ++++++++++++++----- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs index 97d3d706ef..f066dc2cca 100644 --- a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs +++ b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs @@ -19,11 +19,11 @@ public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); string oldRunsettingsPath = Path.Combine(Path.GetTempPath(), "oldRunsettings.runsettings"); - File.WriteAllText(oldTestsettingsPath, oldtestsettings); + File.WriteAllText(oldTestsettingsPath, OldTestSettings); File.WriteAllText(newRunsettingsPath, ""); var doc = new XmlDocument(); - doc.LoadXml(oldrunsettings); + doc.LoadXml(OldRunSettings); var settingsnode = doc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); settingsnode.InnerText = oldTestsettingsPath; File.WriteAllText(oldRunsettingsPath, doc.InnerXml); @@ -72,9 +72,8 @@ public void MigratorGeneratesCorrectRunsettingsForTestSettings() var migrator = new Migrator(); string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); - //File.Create(oldTestsettingsPath); - //File.Create(newRunsettingsPath); - File.WriteAllText(oldTestsettingsPath, oldtestsettings); + + File.WriteAllText(oldTestsettingsPath, OldTestSettings); File.WriteAllText(newRunsettingsPath, ""); migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); @@ -113,14 +112,47 @@ public void MigratorGeneratesCorrectRunsettingsForTestSettings() File.Delete(oldTestsettingsPath); } - const string oldrunsettings = "" + - "" + - "true" + - "" + - "" + - ""; + [TestMethod] + [ExpectedException(typeof(XmlException))] + public void InvalidSettingsThrowsException() + { + var migrator = new Migrator(); + string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); + string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); + + File.WriteAllText(oldTestsettingsPath, InvalidSettings); + File.WriteAllText(newRunsettingsPath, ""); + + migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); - const string oldtestsettings = "" + + File.Delete(oldTestsettingsPath); + } + + [TestMethod] + [ExpectedException(typeof(DirectoryNotFoundException))] + public void InvalidPathThrowsException() + { + var migrator = new Migrator(); + string newRunsettingsPath = @"X:\generatedRunsettings.runsettings"; + string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); + + File.WriteAllText(oldTestsettingsPath, OldTestSettings); + File.WriteAllText(newRunsettingsPath, ""); + + migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); + + File.Delete(oldTestsettingsPath); + } + + const string InvalidSettings = ""; + const string OldRunSettings = "" + + "" + + "true" + + "" + + "" + + ""; + + const string OldTestSettings = "" + "" + "These are default test settings for a local test run." + "" + @@ -151,7 +183,5 @@ public void MigratorGeneratesCorrectRunsettingsForTestSettings() "" + "" + ""; - } - - + } } From 29649c1a1b60874905f3e3db31e4893be89f4752 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Thu, 17 May 2018 15:10:12 +0530 Subject: [PATCH 06/21] Fixing message --- src/SettingsMigrator/Migrator.cs | 12 ++++++------ src/SettingsMigrator/Resources/Resources.resx | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/SettingsMigrator/Migrator.cs b/src/SettingsMigrator/Migrator.cs index e189b22dea..9c7323b81d 100644 --- a/src/SettingsMigrator/Migrator.cs +++ b/src/SettingsMigrator/Migrator.cs @@ -149,10 +149,10 @@ private TestSettingsNodes ReadTestSettingsNodes(string testSettingsPath) testSettingsNodes.Hosts = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/Hosts"); testSettingsNodes.Execution = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution"); - if (testSettingsNodes.Timeout != null && (testSettingsNodes.Timeout.Attributes[TestTimeoutAttributeName] != null || - testSettingsNodes.Timeout.Attributes[TestTimeoutAttributeName] != null || testSettingsNodes.Timeout.Attributes[TestTimeoutAttributeName] != null)) + if (testSettingsNodes.Timeout != null && (testSettingsNodes.Timeout.Attributes[AgentNotRespondingTimeoutAttribute] != null || + testSettingsNodes.Timeout.Attributes[DeploymentTimeoutAttribute] != null || testSettingsNodes.Timeout.Attributes[ScriptTimeoutAttribute] != null)) { - Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.UnsupportedAttributes)); } } @@ -298,9 +298,9 @@ private void AddRunTimeoutNode(string runTimeout, XmlDocument newXmlDoc) const string DataCollectorsNodeName = "DataCollectors"; const string sampleRunSettingsContent = "" + ""; - const string agentNotRespondingTimeout = "agentNotRespondingTimeout"; - const string DeploymentTimeout = "deploymentTimeout"; - const string ScriptTimeout = "scriptTimeout"; + const string AgentNotRespondingTimeoutAttribute = "agentNotRespondingTimeout"; + const string DeploymentTimeoutAttribute = "deploymentTimeout"; + const string ScriptTimeoutAttribute = "scriptTimeout"; } } diff --git a/src/SettingsMigrator/Resources/Resources.resx b/src/SettingsMigrator/Resources/Resources.resx index 0fecc686c4..91a261771b 100644 --- a/src/SettingsMigrator/Resources/Resources.resx +++ b/src/SettingsMigrator/Resources/Resources.resx @@ -124,6 +124,7 @@ The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings \ No newline at end of file From d67f77b62f06cf049cdacf7378cce8ad51abde8f Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Thu, 17 May 2018 15:45:04 +0530 Subject: [PATCH 07/21] Fixing datacollector node --- src/SettingsMigrator/Migrator.cs | 4 ++-- .../MigratorUnitTests.cs | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/SettingsMigrator/Migrator.cs b/src/SettingsMigrator/Migrator.cs index 9c7323b81d..2b76681aef 100644 --- a/src/SettingsMigrator/Migrator.cs +++ b/src/SettingsMigrator/Migrator.cs @@ -143,7 +143,7 @@ private TestSettingsNodes ReadTestSettingsNodes(string testSettingsPath) testSettingsNodes.Deployment = testSettingsRoot.SelectSingleNode(@"/TestSettings/Deployment"); testSettingsNodes.Script = testSettingsRoot.SelectSingleNode(@"/TestSettings/Scripts"); testSettingsNodes.WebSettings = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/TestTypeSpecific/WebTestRunConfiguration"); - testSettingsNodes.Datacollectors = testSettingsRoot.SelectNodes(@"/TestSettings/AgentRule/DataCollectors/DataCollector"); + testSettingsNodes.Datacollectors = testSettingsRoot.SelectNodes(@"/TestSettings/Execution/AgentRule/DataCollectors/DataCollector"); testSettingsNodes.Timeout = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/Timeouts"); testSettingsNodes.UnitTestConfig = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/TestTypeSpecific/UnitTestRunConfig"); testSettingsNodes.Hosts = testSettingsRoot.SelectSingleNode(@"/TestSettings/Execution/Hosts"); @@ -255,6 +255,7 @@ private void AddDataCollectorNodes(XmlNodeList oldDatacollectorNodes, XmlDocumen { dataCollectorsNode = newXmlDoc.CreateNode(XmlNodeType.Element, DataCollectorsNodeName, null); dataCollectionRunSettingsNode.AppendChild(newXmlDoc.ImportNode(dataCollectorsNode, deep: true)); + newXmlDoc.DocumentElement.AppendChild(dataCollectionRunSettingsNode); dataCollectorsNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/DataCollectionRunSettings/DataCollectors"); } @@ -262,7 +263,6 @@ private void AddDataCollectorNodes(XmlNodeList oldDatacollectorNodes, XmlDocumen { dataCollectorsNode.AppendChild(newXmlDoc.ImportNode(datacollector, deep: true)); } - newXmlDoc.DocumentElement.AppendChild(dataCollectionRunSettingsNode); } /// diff --git a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs index f066dc2cca..7b1163a717 100644 --- a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs +++ b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs @@ -58,6 +58,10 @@ public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() var testSessionTimeoutNode = root.SelectSingleNode(@"/RunSettings/RunConfiguration/TestSessionTimeout"); Assert.IsNotNull(testSessionTimeoutNode, "There should be a TestSessionTimeout node"); Assert.AreEqual(testSessionTimeoutNode.InnerText, "60000", "Timeout value does not match."); + + var dataCollectorNode = root.SelectSingleNode(@"/RunSettings/DataCollectionRunSettings/DataCollectors/DataCollector"); + Assert.IsNotNull(dataCollectorNode, "There should be a DataCollector node"); + Assert.AreEqual("Event Log", dataCollectorNode.Attributes["friendlyName"].Value, "Data collector does not match."); } File.Delete(oldRunsettingsPath); @@ -106,6 +110,10 @@ public void MigratorGeneratesCorrectRunsettingsForTestSettings() var testSessionTimeoutNode = root.SelectSingleNode(@"/RunSettings/RunConfiguration/TestSessionTimeout"); Assert.IsNotNull(testSessionTimeoutNode, "There should be a TestSessionTimeout node"); Assert.AreEqual(testSessionTimeoutNode.InnerText, "60000", "Timeout value does not match."); + + var dataCollectorNode = root.SelectSingleNode(@"/RunSettings/DataCollectionRunSettings/DataCollectors/DataCollector"); + Assert.IsNotNull(dataCollectorNode, "There should be a DataCollector node"); + Assert.AreEqual("Event Log", dataCollectorNode.Attributes["friendlyName"].Value, "Data collector does not match."); } File.Delete(newRunsettingsPath); @@ -148,7 +156,7 @@ public void InvalidPathThrowsException() const string OldRunSettings = "" + "" + "true" + - "" + + "" + "" + ""; @@ -179,6 +187,10 @@ public void InvalidPathThrowsException() "" + "" + "" + + "" + + "" + + "" + + "" + "" + "" + "" + From 2e1b3182b1cfadc14eb36260614fd9e0636d21e8 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Fri, 18 May 2018 12:33:22 +0530 Subject: [PATCH 08/21] PR comments --- src/SettingsMigrator/Migrator.cs | 138 ++++++++------ src/SettingsMigrator/Program.cs | 26 +-- .../Resources/Resources.Designer.cs | 24 ++- src/SettingsMigrator/Resources/Resources.resx | 9 +- src/SettingsMigrator/SettingsMigrator.csproj | 11 +- src/SettingsMigrator/TestSettingsNodes.cs | 9 +- src/SettingsMigrator/app.manifest | 27 --- .../MigratorUnitTests.cs | 172 +++++++----------- .../SettingsMigrator.UnitTests.csproj | 16 +- .../oldRunSettings.runsettings | 6 + ...ldRunSettingsWithDataCollector.runsettings | 11 ++ .../oldTestSettings.testsettings | 42 +++++ 12 files changed, 272 insertions(+), 219 deletions(-) delete mode 100644 src/SettingsMigrator/app.manifest create mode 100644 test/SettingsMigrator.UnitTests/oldRunSettings.runsettings create mode 100644 test/SettingsMigrator.UnitTests/oldRunSettingsWithDataCollector.runsettings create mode 100644 test/SettingsMigrator.UnitTests/oldTestSettings.testsettings diff --git a/src/SettingsMigrator/Migrator.cs b/src/SettingsMigrator/Migrator.cs index 2b76681aef..edce5b7eb6 100644 --- a/src/SettingsMigrator/Migrator.cs +++ b/src/SettingsMigrator/Migrator.cs @@ -1,24 +1,55 @@ // 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.VisualStudio.TestPlatform.CommandLine +namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator { using System; + using System.Globalization; using System.IO; using System.Xml; - using System.Globalization; - using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; + using CommandLineResources = Resources.Resources; /// /// Migrator used to migrate test settings and run settings with embedded testsettings to run settings. /// public class Migrator { + private const string TestTimeoutAttributeName = "testTimeout"; + + private const string ParallelTestCountAttributeName = "parallelTestCount"; + + private const string RunTimeoutAttributeName = "runTimeout"; + + private const string LegacySettingsNodeName = "LegacySettings"; + + private const string ExecutionNodeName = "Execution"; + + private const string TimeoutsNodeName = "Timeouts"; + + private const string TestTypeSpecificNodeName = "TestTypeSpecific"; + + private const string RunConfigurationNodeName = "RunConfiguration"; + + private const string TestSessionTimeoutNodeName = "TestSessionTimeout"; + + private const string DataCollectionRunSettingsNodeName = "DataCollectionRunSettings"; + + private const string DataCollectorsNodeName = "DataCollectors"; + + private const string SampleRunSettingsContent = "" + + ""; + + private const string AgentNotRespondingTimeoutAttribute = "agentNotRespondingTimeout"; + + private const string DeploymentTimeoutAttribute = "deploymentTimeout"; + + private const string ScriptTimeoutAttribute = "scriptTimeout"; + /// /// Given a runSettings with an embedded testSettings, converts it to runSettings. /// - /// - /// + /// Path to old runsettings. + /// Path to new runsettings. public void MigrateRunSettings(string oldRunSettingsPath, string newRunSettingsPath) { string testSettingsPath = null; @@ -36,21 +67,26 @@ public void MigrateRunSettings(string oldRunSettingsPath, string newRunSettingsP { testSettingsPath = testSettingsNode.InnerText; } + if (!string.IsNullOrWhiteSpace(testSettingsPath)) { // Expand path relative to runSettings location. if (!Path.IsPathRooted(testSettingsPath)) { - testSettingsPath = Path.Combine(oldRunSettingsPath, testSettingsPath); + testSettingsPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(oldRunSettingsPath), testSettingsPath)); } - MigrateTestSettingsNodesToRunSettings(testSettingsPath, runSettingsXmlDoc); + // Remove the embedded testSettings node if it exists. + this.RemoveEmbeddedTestSettings(runSettingsXmlDoc); + + this.MigrateTestSettingsNodesToRunSettings(testSettingsPath, runSettingsXmlDoc); runSettingsXmlDoc.Save(newRunSettingsPath); + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.RunSettingsCreated, newRunSettingsPath)); } else { - Console.WriteLine("RunSettings does not contain an embedded testSettings, not migrating."); + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.NoEmbeddedSettings)); } } } @@ -58,27 +94,27 @@ public void MigrateRunSettings(string oldRunSettingsPath, string newRunSettingsP /// /// Given a testSettings, converts it to runSettings. /// - /// - /// + /// Path to old testsettings. + /// Path to new runsettings. public void MigrateTestSettings(string oldTestSettingsPath, string newRunSettingsPath) { var runSettingsXmlDoc = new XmlDocument(); - runSettingsXmlDoc.LoadXml(sampleRunSettingsContent); + runSettingsXmlDoc.LoadXml(SampleRunSettingsContent); - MigrateTestSettingsNodesToRunSettings(oldTestSettingsPath, runSettingsXmlDoc); + this.MigrateTestSettingsNodesToRunSettings(oldTestSettingsPath, runSettingsXmlDoc); runSettingsXmlDoc.Save(newRunSettingsPath); + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.RunSettingsCreated, newRunSettingsPath)); } /// /// Given a testSettings, converts it to runSettings /// - /// - /// - /// + /// Path to test settings + /// Runsettings Xml private void MigrateTestSettingsNodesToRunSettings(string testSettingsPath, XmlDocument runSettingsXmlDoc) { - var testSettingsNodes = ReadTestSettingsNodes(testSettingsPath); + var testSettingsNodes = this.ReadTestSettingsNodes(testSettingsPath); string testTimeout = null; if (testSettingsNodes.Timeout != null && testSettingsNodes.Timeout.Attributes[TestTimeoutAttributeName] != null) @@ -98,9 +134,6 @@ private void MigrateTestSettingsNodesToRunSettings(string testSettingsPath, XmlD parallelTestCount = testSettingsNodes.Execution.Attributes[ParallelTestCountAttributeName].Value; } - // Remove the embedded testSettings node if it exists. - RemoveEmbeddedTestSettings(runSettingsXmlDoc); - // WebTestRunConfiguration node. if (testSettingsNodes.WebSettings != null) { @@ -108,22 +141,18 @@ private void MigrateTestSettingsNodesToRunSettings(string testSettingsPath, XmlD } // LegacySettings node. - if (testSettingsNodes.Deployment != null || testSettingsNodes.Script != null || testSettingsNodes.UnitTestConfig != null || - !string.IsNullOrEmpty(parallelTestCount) || !string.IsNullOrEmpty(testTimeout) || testSettingsNodes.Hosts != null) - { - AddLegacyNodes(testSettingsNodes, testTimeout, parallelTestCount, runSettingsXmlDoc); - } + this.AddLegacyNodes(testSettingsNodes, testTimeout, parallelTestCount, runSettingsXmlDoc); // TestSessionTimeout node. if (!string.IsNullOrEmpty(runTimeout)) { - AddRunTimeoutNode(runTimeout, runSettingsXmlDoc); + this.AddRunTimeoutNode(runTimeout, runSettingsXmlDoc); } // DataCollectors node. if (testSettingsNodes.Datacollectors != null && testSettingsNodes.Datacollectors.Count > 0) { - AddDataCollectorNodes(testSettingsNodes.Datacollectors, runSettingsXmlDoc); + this.AddDataCollectorNodes(testSettingsNodes.Datacollectors, runSettingsXmlDoc); } } @@ -162,7 +191,7 @@ private TestSettingsNodes ReadTestSettingsNodes(string testSettingsPath) /// /// Removes the embedded testSettings node if present. /// - /// + /// Xml doc to process private void RemoveEmbeddedTestSettings(XmlDocument newXmlDoc) { var testSettingsNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); @@ -175,16 +204,19 @@ private void RemoveEmbeddedTestSettings(XmlDocument newXmlDoc) /// /// Adds the legacy nodes to runSettings xml. /// - /// - /// - /// - /// - /// - /// - /// + /// testSettingsNodes + /// testTimeout + /// parallelTestCount + /// newXmlDoc private void AddLegacyNodes(TestSettingsNodes testSettingsNodes, string testTimeout, string parallelTestCount, XmlDocument newXmlDoc) { - //Remove if the legacy node already exists. + if (!(testSettingsNodes.Deployment != null || testSettingsNodes.Script != null || testSettingsNodes.UnitTestConfig != null || + !string.IsNullOrEmpty(parallelTestCount) || !string.IsNullOrEmpty(testTimeout) || testSettingsNodes.Hosts != null)) + { + return; + } + + // Remove if the legacy node already exists. var legacyNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/LegacySettings"); if (legacyNode != null) { @@ -198,6 +230,7 @@ private void AddLegacyNodes(TestSettingsNodes testSettingsNodes, string testTime { legacyNode.AppendChild(newXmlDoc.ImportNode(testSettingsNodes.Deployment, deep: true)); } + if (testSettingsNodes.Script != null) { legacyNode.AppendChild(newXmlDoc.ImportNode(testSettingsNodes.Script, deep: true)); @@ -208,12 +241,13 @@ private void AddLegacyNodes(TestSettingsNodes testSettingsNodes, string testTime { var newExecutionNode = newXmlDoc.CreateNode(XmlNodeType.Element, ExecutionNodeName, null); - if (string.IsNullOrEmpty(parallelTestCount)) + if (!string.IsNullOrEmpty(parallelTestCount)) { var paralellAttribute = newXmlDoc.CreateAttribute(ParallelTestCountAttributeName); paralellAttribute.Value = parallelTestCount; newExecutionNode.Attributes.Append(paralellAttribute); } + if (!string.IsNullOrEmpty(testTimeout)) { var newTimeoutsNode = newXmlDoc.CreateNode(XmlNodeType.Element, TimeoutsNodeName, null); @@ -222,26 +256,30 @@ private void AddLegacyNodes(TestSettingsNodes testSettingsNodes, string testTime newTimeoutsNode.Attributes.Append(testtimeoutattribute); newExecutionNode.AppendChild(newXmlDoc.ImportNode(newTimeoutsNode, deep: true)); } + if (testSettingsNodes.Hosts != null) { newExecutionNode.AppendChild(newXmlDoc.ImportNode(testSettingsNodes.Hosts, deep: true)); } + if (testSettingsNodes.UnitTestConfig != null) { var testTypeSpecificNode = newXmlDoc.CreateNode(XmlNodeType.Element, TestTypeSpecificNodeName, null); testTypeSpecificNode.AppendChild(newXmlDoc.ImportNode(testSettingsNodes.UnitTestConfig, deep: true)); newExecutionNode.AppendChild(newXmlDoc.ImportNode(testTypeSpecificNode, deep: true)); } + legacyNode.AppendChild(newXmlDoc.ImportNode(newExecutionNode, deep: true)); } + newXmlDoc.DocumentElement.AppendChild(legacyNode); } /// /// Adds the datacollector nodes to the runSettings xml. /// - /// - /// + /// Datacollector Nodes + /// Xml doc to process private void AddDataCollectorNodes(XmlNodeList oldDatacollectorNodes, XmlDocument newXmlDoc) { var dataCollectionRunSettingsNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/DataCollectionRunSettings"); @@ -268,8 +306,8 @@ private void AddDataCollectorNodes(XmlNodeList oldDatacollectorNodes, XmlDocumen /// /// Adds run session timeout node. /// - /// - /// + /// Run Timeout + /// Xml doc to process private void AddRunTimeoutNode(string runTimeout, XmlDocument newXmlDoc) { var runConfigurationNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/RunConfiguration"); @@ -284,23 +322,5 @@ private void AddRunTimeoutNode(string runTimeout, XmlDocument newXmlDoc) newXmlDoc.DocumentElement.AppendChild(runConfigurationNode); } - - const string TestTimeoutAttributeName = "testTimeout"; - const string ParallelTestCountAttributeName = "testTimeout"; - const string RunTimeoutAttributeName = "runTimeout"; - const string LegacySettingsNodeName = "LegacySettings"; - const string ExecutionNodeName = "Execution"; - const string TimeoutsNodeName = "Timeouts"; - const string TestTypeSpecificNodeName = "TestTypeSpecific"; - const string RunConfigurationNodeName = "RunConfiguration"; - const string TestSessionTimeoutNodeName = "TestSessionTimeout"; - const string DataCollectionRunSettingsNodeName = "DataCollectionRunSettings"; - const string DataCollectorsNodeName = "DataCollectors"; - const string sampleRunSettingsContent = "" + - ""; - const string AgentNotRespondingTimeoutAttribute = "agentNotRespondingTimeout"; - const string DeploymentTimeoutAttribute = "deploymentTimeout"; - const string ScriptTimeoutAttribute = "scriptTimeout"; } -} - +} \ No newline at end of file diff --git a/src/SettingsMigrator/Program.cs b/src/SettingsMigrator/Program.cs index daa8fbe9aa..21f4359702 100644 --- a/src/SettingsMigrator/Program.cs +++ b/src/SettingsMigrator/Program.cs @@ -1,39 +1,45 @@ // 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.VisualStudio.TestPlatform.CommandLine +namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator { using System; using System.Globalization; using System.IO; - using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; + using CommandLineResources = Resources.Resources; /// /// Entry point for SettingsMigrator. /// - class Program + public static class Program { + private const string RunSettingsExtension = ".runsettings"; + + private const string TestSettingsExtension = ".testsettings"; + /// /// Main entry point. Hands off execution to Migrator. /// /// Arguments provided on the command line. - static void Main(string[] args) + public static void Main(string[] args) { - if (args.Length != 2) + if (args.Length != 1) { Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); return; } string oldFilePath = args[0]; - string newFilePath = args[1]; - if (!Path.IsPathRooted(oldFilePath) || !Path.IsPathRooted(newFilePath) || !string.Equals(Path.GetExtension(newFilePath), RunSettingsExtension)) + if (!Path.IsPathRooted(oldFilePath)) { Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); return; } + var newFileName = string.Concat(Guid.NewGuid().ToString(), RunSettingsExtension); + string newFilePath = Path.Combine(Path.GetDirectoryName(oldFilePath), newFileName); + var migrator = new Migrator(); if (string.Equals(Path.GetExtension(oldFilePath), TestSettingsExtension)) @@ -50,9 +56,5 @@ static void Main(string[] args) return; } } - - const string RunSettingsExtension = ".runsettings"; - const string TestSettingsExtension = ".testsettings"; } -} - +} \ No newline at end of file diff --git a/src/SettingsMigrator/Resources/Resources.Designer.cs b/src/SettingsMigrator/Resources/Resources.Designer.cs index 3fc7ff5f6a..8636032416 100644 --- a/src/SettingsMigrator/Resources/Resources.Designer.cs +++ b/src/SettingsMigrator/Resources/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Resources +namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator.Resources { using System; using System.Reflection; @@ -81,6 +81,28 @@ public static string IgnoringLegacySettings } } + /// + /// Looks up a localized string similar to RunSettings does not contain an embedded testSettings, not migrating. + /// + public static string NoEmbeddedSettings + { + get + { + return ResourceManager.GetString("NoEmbeddedSettings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The migrated RunSettings file has been created at + /// + public static string RunSettingsCreated + { + get + { + return ResourceManager.GetString("RunSettingsCreated", resourceCulture); + } + } + /// /// Looks up a localized string similar to Valid usage: SettingsMigrator.exe /// diff --git a/src/SettingsMigrator/Resources/Resources.resx b/src/SettingsMigrator/Resources/Resources.resx index 91a261771b..64f19199cf 100644 --- a/src/SettingsMigrator/Resources/Resources.resx +++ b/src/SettingsMigrator/Resources/Resources.resx @@ -120,11 +120,18 @@ Any LegacySettings node already present in the runsettings will be removed. + + RunSettings does not contain an embedded testSettings, not migrating. + + + The migrated RunSettings file has been created at: {0} + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings \ No newline at end of file diff --git a/src/SettingsMigrator/SettingsMigrator.csproj b/src/SettingsMigrator/SettingsMigrator.csproj index 824453cf1a..675d6c1963 100644 --- a/src/SettingsMigrator/SettingsMigrator.csproj +++ b/src/SettingsMigrator/SettingsMigrator.csproj @@ -6,14 +6,15 @@ SettingsMigrator - net451 + net451 + true + true true Exe - AnyCPU - true - app.manifest + AnyCPU + true - + win7-x64 diff --git a/src/SettingsMigrator/TestSettingsNodes.cs b/src/SettingsMigrator/TestSettingsNodes.cs index 93c31c05eb..c0e3271366 100644 --- a/src/SettingsMigrator/TestSettingsNodes.cs +++ b/src/SettingsMigrator/TestSettingsNodes.cs @@ -1,7 +1,7 @@ // 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.VisualStudio.TestPlatform.CommandLine +namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator { using System.Xml; @@ -11,12 +11,19 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine public class TestSettingsNodes { public XmlNode Deployment { get; set; } + public XmlNode Script { get; set; } + public XmlNode WebSettings { get; set; } + public XmlNodeList Datacollectors { get; set; } + public XmlNode Timeout { get; set; } + public XmlNode UnitTestConfig { get; set; } + public XmlNode Hosts { get; set; } + public XmlNode Execution { get; set; } } } diff --git a/src/SettingsMigrator/app.manifest b/src/SettingsMigrator/app.manifest deleted file mode 100644 index 9952698906..0000000000 --- a/src/SettingsMigrator/app.manifest +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs index 7b1163a717..0cc63d9aab 100644 --- a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs +++ b/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs @@ -1,11 +1,11 @@ // 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.VisualStudio.TestPlatform.CommandLine.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator.UnitTests { using System.IO; using System.Xml; - using Microsoft.VisualStudio.TestPlatform.CommandLine; + using Microsoft.VisualStudio.TestPlatform.SettingsMigrator; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] @@ -16,11 +16,8 @@ public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() { var migrator = new Migrator(); string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); - string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); + string oldTestsettingsPath = Path.GetFullPath(Path.Combine(".", "oldTestsettings.testsettings")); string oldRunsettingsPath = Path.Combine(Path.GetTempPath(), "oldRunsettings.runsettings"); - - File.WriteAllText(oldTestsettingsPath, OldTestSettings); - File.WriteAllText(newRunsettingsPath, ""); var doc = new XmlDocument(); doc.LoadXml(OldRunSettings); @@ -30,58 +27,90 @@ public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() migrator.MigrateRunSettings(oldRunsettingsPath, newRunsettingsPath); - Assert.IsTrue(File.Exists(newRunsettingsPath), "Run settings should be generated."); + Validate(newRunsettingsPath); + + File.Delete(oldRunsettingsPath); + File.Delete(newRunsettingsPath); + } + + [TestMethod] + public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettingsOfRelativePath() + { + var migrator = new Migrator(); + string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); + string oldRunsettingsPath = Path.GetFullPath(Path.Combine(".", "oldRunsettings.runsettings")); + + migrator.MigrateRunSettings(oldRunsettingsPath, newRunsettingsPath); + Validate(newRunsettingsPath); + + File.Delete(newRunsettingsPath); + } + + [TestMethod] + public void MigratorGeneratesCorrectRunsettingsWithDC() + { + var migrator = new Migrator(); + string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); + string oldRunsettingsPath = Path.GetFullPath(Path.Combine(".", "oldRunSettingsWithDataCollector.runsettings")); + + migrator.MigrateRunSettings(oldRunsettingsPath, newRunsettingsPath); using (XmlTextReader reader = new XmlTextReader(newRunsettingsPath)) { reader.Namespaces = false; - var document = new XmlDocument(); document.Load(reader); var root = document.DocumentElement; + var dataCollectorNode = root.SelectNodes(@"/RunSettings/DataCollectionRunSettings/DataCollectors/DataCollector"); + Assert.AreEqual(2, dataCollectorNode.Count, "Data collector is missing"); + } - Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/WebTestRunConfiguration/Browser/Headers/Header"), "There should be a WebTestRunConfiguration node"); - Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings"), "There should be a LegacySettings node"); - Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings/Deployment/DeploymentItem"), "There should be a DeploymentItem node"); - - var scriptNode = root.SelectSingleNode(@"/RunSettings/LegacySettings/Scripts"); - Assert.IsNotNull(scriptNode, "There should be a WebTestRunConfiguration node"); - Assert.AreEqual(".\\setup.bat", scriptNode.Attributes["setupScript"].Value, "setupScript does not match."); - Assert.AreEqual(".\\cleanup.bat", scriptNode.Attributes["cleanupScript"].Value, "cleanupScript does not match."); - - var timeoutNode = root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution/Timeouts"); - Assert.IsNotNull(timeoutNode, "There should be a Timeouts node"); - Assert.AreEqual("120000", timeoutNode.Attributes["testTimeout"].Value, "testTimeout value does not match."); + File.Delete(newRunsettingsPath); + } - Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution/TestTypeSpecific/UnitTestRunConfig/AssemblyResolution/TestDirectory"), "There should be a Assembly resolution node"); + [TestMethod] + public void MigratorGeneratesCorrectRunsettingsForTestSettings() + { + var migrator = new Migrator(); + string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); + string oldTestsettingsPath = Path.GetFullPath(Path.Combine(".", "oldTestsettings.testsettings")); - var testSessionTimeoutNode = root.SelectSingleNode(@"/RunSettings/RunConfiguration/TestSessionTimeout"); - Assert.IsNotNull(testSessionTimeoutNode, "There should be a TestSessionTimeout node"); - Assert.AreEqual(testSessionTimeoutNode.InnerText, "60000", "Timeout value does not match."); + migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); - var dataCollectorNode = root.SelectSingleNode(@"/RunSettings/DataCollectionRunSettings/DataCollectors/DataCollector"); - Assert.IsNotNull(dataCollectorNode, "There should be a DataCollector node"); - Assert.AreEqual("Event Log", dataCollectorNode.Attributes["friendlyName"].Value, "Data collector does not match."); - } + Validate(newRunsettingsPath); - File.Delete(oldRunsettingsPath); File.Delete(newRunsettingsPath); - File.Delete(oldTestsettingsPath); } - [TestMethod] - public void MigratorGeneratesCorrectRunsettingsForTestSettings() + [ExpectedException(typeof(XmlException))] + public void InvalidSettingsThrowsException() { var migrator = new Migrator(); string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); - File.WriteAllText(oldTestsettingsPath, OldTestSettings); + File.WriteAllText(oldTestsettingsPath, InvalidSettings); File.WriteAllText(newRunsettingsPath, ""); migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); + File.Delete(oldTestsettingsPath); + } + + [TestMethod] + [ExpectedException(typeof(DirectoryNotFoundException))] + public void InvalidPathThrowsException() + { + var migrator = new Migrator(); + string newRunsettingsPath = @"X:\generatedRunsettings.runsettings"; + string oldTestsettingsPath = @"X:\generatedRunsettings.runsettings"; + + migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); + } + + private static void Validate(string newRunsettingsPath) + { Assert.IsTrue(File.Exists(newRunsettingsPath), "Run settings should be generated."); using (XmlTextReader reader = new XmlTextReader(newRunsettingsPath)) @@ -101,6 +130,12 @@ public void MigratorGeneratesCorrectRunsettingsForTestSettings() Assert.AreEqual(".\\setup.bat", scriptNode.Attributes["setupScript"].Value, "setupScript does not match."); Assert.AreEqual(".\\cleanup.bat", scriptNode.Attributes["cleanupScript"].Value, "cleanupScript does not match."); + var executionNode = root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution"); + Assert.IsNotNull(executionNode, "There should be a Execution node"); + Assert.AreEqual("2", executionNode.Attributes["parallelTestCount"].Value, "parallelTestCount value does not match."); + + Assert.IsNotNull(root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution/Hosts"), "There should be a Hosts node"); + var timeoutNode = root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution/Timeouts"); Assert.IsNotNull(timeoutNode, "There should be a Timeouts node"); Assert.AreEqual("120000", timeoutNode.Attributes["testTimeout"].Value, "testTimeout value does not match."); @@ -115,41 +150,6 @@ public void MigratorGeneratesCorrectRunsettingsForTestSettings() Assert.IsNotNull(dataCollectorNode, "There should be a DataCollector node"); Assert.AreEqual("Event Log", dataCollectorNode.Attributes["friendlyName"].Value, "Data collector does not match."); } - - File.Delete(newRunsettingsPath); - File.Delete(oldTestsettingsPath); - } - - [TestMethod] - [ExpectedException(typeof(XmlException))] - public void InvalidSettingsThrowsException() - { - var migrator = new Migrator(); - string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); - string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); - - File.WriteAllText(oldTestsettingsPath, InvalidSettings); - File.WriteAllText(newRunsettingsPath, ""); - - migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); - - File.Delete(oldTestsettingsPath); - } - - [TestMethod] - [ExpectedException(typeof(DirectoryNotFoundException))] - public void InvalidPathThrowsException() - { - var migrator = new Migrator(); - string newRunsettingsPath = @"X:\generatedRunsettings.runsettings"; - string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); - - File.WriteAllText(oldTestsettingsPath, OldTestSettings); - File.WriteAllText(newRunsettingsPath, ""); - - migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); - - File.Delete(oldTestsettingsPath); } const string InvalidSettings = ""; @@ -159,41 +159,5 @@ public void InvalidPathThrowsException() "" + "" + ""; - - const string OldTestSettings = "" + - "" + - "These are default test settings for a local test run." + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "
" + - "
" + - "
" + - "
" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - ""; } } diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj index 7460da6c9f..6e9aa33fb5 100644 --- a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -6,20 +6,18 @@ - Exe - net451 + net451 SettingsMigrator.UnitTests - - true - - - true - - + + + + + + diff --git a/test/SettingsMigrator.UnitTests/oldRunSettings.runsettings b/test/SettingsMigrator.UnitTests/oldRunSettings.runsettings new file mode 100644 index 0000000000..510c693ede --- /dev/null +++ b/test/SettingsMigrator.UnitTests/oldRunSettings.runsettings @@ -0,0 +1,6 @@ + + + true + .\oldTestsettings.testsettings + + \ No newline at end of file diff --git a/test/SettingsMigrator.UnitTests/oldRunSettingsWithDataCollector.runsettings b/test/SettingsMigrator.UnitTests/oldRunSettingsWithDataCollector.runsettings new file mode 100644 index 0000000000..539396df11 --- /dev/null +++ b/test/SettingsMigrator.UnitTests/oldRunSettingsWithDataCollector.runsettings @@ -0,0 +1,11 @@ + + + true + .\oldTestsettings.testsettings + + + + + + + \ No newline at end of file diff --git a/test/SettingsMigrator.UnitTests/oldTestSettings.testsettings b/test/SettingsMigrator.UnitTests/oldTestSettings.testsettings new file mode 100644 index 0000000000..f83a5d86f0 --- /dev/null +++ b/test/SettingsMigrator.UnitTests/oldTestSettings.testsettings @@ -0,0 +1,42 @@ + + + These are default test settings for a local test run. + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + \ No newline at end of file From acce98bcd3b3032a17dcba1d6a434fb5fc03a2fd Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Fri, 18 May 2018 13:43:27 +0530 Subject: [PATCH 09/21] Resx changes --- .../Resources/Resources.Designer.cs | 100 +++++++----------- .../Resources/xlf/Resources.cs.xlf | 28 ++++- .../Resources/xlf/Resources.de.xlf | 28 ++++- .../Resources/xlf/Resources.es.xlf | 28 ++++- .../Resources/xlf/Resources.fr.xlf | 28 ++++- .../Resources/xlf/Resources.it.xlf | 28 ++++- .../Resources/xlf/Resources.ja.xlf | 28 ++++- .../Resources/xlf/Resources.ko.xlf | 28 ++++- .../Resources/xlf/Resources.pl.xlf | 28 ++++- .../Resources/xlf/Resources.pt-BR.xlf | 28 ++++- .../Resources/xlf/Resources.ru.xlf | 28 ++++- .../Resources/xlf/Resources.tr.xlf | 28 ++++- .../Resources/xlf/Resources.xlf | 28 ++++- .../Resources/xlf/Resources.zh-Hans.xlf | 28 ++++- .../Resources/xlf/Resources.zh-Hant.xlf | 28 ++++- 15 files changed, 405 insertions(+), 87 deletions(-) diff --git a/src/SettingsMigrator/Resources/Resources.Designer.cs b/src/SettingsMigrator/Resources/Resources.Designer.cs index 8636032416..897ea5ce35 100644 --- a/src/SettingsMigrator/Resources/Resources.Designer.cs +++ b/src/SettingsMigrator/Resources/Resources.Designer.cs @@ -8,12 +8,10 @@ // //------------------------------------------------------------------------------ -namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator.Resources -{ +namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator.Resources { using System; - using System.Reflection; - - + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -21,107 +19,91 @@ namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator.Resources // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager - { - get - { - if (object.ReferenceEquals(resourceMan, null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SettingsMigrator.Resources.Resources", typeof(Resources).GetTypeInfo().Assembly); + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SettingsMigrator.Resources.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } - + /// - /// Looks up a localized string similar to Any LegacySettings node already present in the runsettings will be removed. + /// Looks up a localized string similar to Any LegacySettings node already present in the runsettings will be removed.. /// - public static string IgnoringLegacySettings - { - get - { + internal static string IgnoringLegacySettings { + get { return ResourceManager.GetString("IgnoringLegacySettings", resourceCulture); } } - + /// - /// Looks up a localized string similar to RunSettings does not contain an embedded testSettings, not migrating. + /// Looks up a localized string similar to RunSettings does not contain an embedded testSettings, not migrating.. /// - public static string NoEmbeddedSettings - { - get - { + internal static string NoEmbeddedSettings { + get { return ResourceManager.GetString("NoEmbeddedSettings", resourceCulture); } } /// - /// Looks up a localized string similar to The migrated RunSettings file has been created at + /// Looks up a localized string similar to The migrated RunSettings file has been created at: {0}. /// - public static string RunSettingsCreated - { - get - { + internal static string RunSettingsCreated { + get { return ResourceManager.GetString("RunSettingsCreated", resourceCulture); } } - + /// - /// Looks up a localized string similar to Valid usage: SettingsMigrator.exe + /// Looks up a localized string similar to The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated.. /// - public static string ValidUsage - { - get - { - return ResourceManager.GetString("ValidUsage", resourceCulture); + internal static string UnsupportedAttributes { + get { + return ResourceManager.GetString("UnsupportedAttributes", resourceCulture); } } - + /// - /// Looks up a localized string similar to The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + /// Looks up a localized string similar to Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + ///Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings + ///Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings. /// - public static string UnsupportedAttributes - { - get - { - return ResourceManager.GetString("UnsupportedAttributes", resourceCulture); + internal static string ValidUsage { + get { + return ResourceManager.GetString("ValidUsage", resourceCulture); } } } diff --git a/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf b/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf index 87ee60c31a..956a3628fc 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.de.xlf b/src/SettingsMigrator/Resources/xlf/Resources.de.xlf index 2bd4739a2a..bb1ff9e3d7 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.de.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.de.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.es.xlf b/src/SettingsMigrator/Resources/xlf/Resources.es.xlf index aa2a558675..4f2245342a 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.es.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.es.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf b/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf index 5506da0d0f..b155439a7b 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.it.xlf b/src/SettingsMigrator/Resources/xlf/Resources.it.xlf index f2c6c4ac53..4632917471 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.it.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.it.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf b/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf index 92644a4650..53917518dd 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf b/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf index a804409b81..76ea470e28 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf b/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf index 02e8d2fbfa..c452c3659b 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf b/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf index ab2206c4af..78edb18fac 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf b/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf index cb823c7d77..f8496645f4 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf b/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf index 92e7e3cfa8..7d63f8fda0 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.xlf b/src/SettingsMigrator/Resources/xlf/Resources.xlf index 0a59b0c85c..830e5a8fb8 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.xlf @@ -2,9 +2,33 @@ + + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf index 375d9b98ab..899099fdbe 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf @@ -20,9 +20,33 @@
+ + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf index 5d78eef487..6fea6ce0c8 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf @@ -20,9 +20,33 @@ + + Any LegacySettings node already present in the runsettings will be removed. + Any LegacySettings node already present in the runsettings will be removed. + + + + RunSettings does not contain an embedded testSettings, not migrating. + RunSettings does not contain an embedded testSettings, not migrating. + + + + The migrated RunSettings file has been created at: {0} + The migrated RunSettings file has been created at: {0} + + + + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + + - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings From 3aaa2fb110de9f665271ce850c11f9c6674fd668 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Fri, 18 May 2018 17:40:14 +0530 Subject: [PATCH 10/21] PR comments --- src/SettingsMigrator/App.config | 6 -- src/SettingsMigrator/Migrator.cs | 53 +++++++++++++++++- src/SettingsMigrator/Program.cs | 31 ++--------- src/SettingsMigrator/Resources/Resources.resx | 8 +-- .../Resources/xlf/Resources.cs.xlf | 8 +-- .../Resources/xlf/Resources.de.xlf | 8 +-- .../Resources/xlf/Resources.es.xlf | 8 +-- .../Resources/xlf/Resources.fr.xlf | 8 +-- .../Resources/xlf/Resources.it.xlf | 8 +-- .../Resources/xlf/Resources.ja.xlf | 8 +-- .../Resources/xlf/Resources.ko.xlf | 8 +-- .../Resources/xlf/Resources.pl.xlf | 8 +-- .../Resources/xlf/Resources.pt-BR.xlf | 8 +-- .../Resources/xlf/Resources.ru.xlf | 8 +-- .../Resources/xlf/Resources.tr.xlf | 8 +-- .../Resources/xlf/Resources.xlf | 8 +-- .../Resources/xlf/Resources.zh-Hans.xlf | 8 +-- .../Resources/xlf/Resources.zh-Hant.xlf | 8 +-- ...{MigratorUnitTests.cs => MigratorTests.cs} | 55 ++++++++++++------- .../ProgramTests.cs | 21 +++++++ .../SettingsMigrator.UnitTests.csproj | 8 +-- ...nSettingsWithEmbeddedSettings.runsettings} | 0 22 files changed, 177 insertions(+), 117 deletions(-) delete mode 100644 src/SettingsMigrator/App.config rename test/SettingsMigrator.UnitTests/{MigratorUnitTests.cs => MigratorTests.cs} (82%) create mode 100644 test/SettingsMigrator.UnitTests/ProgramTests.cs rename test/SettingsMigrator.UnitTests/{oldRunSettings.runsettings => oldRunSettingsWithEmbeddedSettings.runsettings} (100%) diff --git a/src/SettingsMigrator/App.config b/src/SettingsMigrator/App.config deleted file mode 100644 index 731f6de6c2..0000000000 --- a/src/SettingsMigrator/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/SettingsMigrator/Migrator.cs b/src/SettingsMigrator/Migrator.cs index edce5b7eb6..50bcd94f39 100644 --- a/src/SettingsMigrator/Migrator.cs +++ b/src/SettingsMigrator/Migrator.cs @@ -22,6 +22,10 @@ public class Migrator private const string LegacySettingsNodeName = "LegacySettings"; + private const string MSTestNodeName = "MSTest"; + + private const string ForcedLegacyModeName = "ForcedLegacyMode"; + private const string ExecutionNodeName = "Execution"; private const string TimeoutsNodeName = "Timeouts"; @@ -45,12 +49,37 @@ public class Migrator private const string ScriptTimeoutAttribute = "scriptTimeout"; + private const string TestSettingsExtension = ".testsettings"; + + private const string RunSettingsExtension = ".runsettings"; + + public void Migrate(string oldFilePath, string newFilePath) + { + if (!Path.IsPathRooted(oldFilePath)) + { + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); + } + + if (string.Equals(Path.GetExtension(oldFilePath), TestSettingsExtension)) + { + this.MigrateTestSettings(oldFilePath, newFilePath); + } + else if (string.Equals(Path.GetExtension(oldFilePath), RunSettingsExtension)) + { + this.MigrateRunSettings(oldFilePath, newFilePath); + } + else + { + Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); + } + } + /// /// Given a runSettings with an embedded testSettings, converts it to runSettings. /// /// Path to old runsettings. /// Path to new runsettings. - public void MigrateRunSettings(string oldRunSettingsPath, string newRunSettingsPath) + private void MigrateRunSettings(string oldRunSettingsPath, string newRunSettingsPath) { string testSettingsPath = null; using (XmlTextReader reader = new XmlTextReader(oldRunSettingsPath)) @@ -96,7 +125,7 @@ public void MigrateRunSettings(string oldRunSettingsPath, string newRunSettingsP /// /// Path to old testsettings. /// Path to new runsettings. - public void MigrateTestSettings(string oldTestSettingsPath, string newRunSettingsPath) + private void MigrateTestSettings(string oldTestSettingsPath, string newRunSettingsPath) { var runSettingsXmlDoc = new XmlDocument(); runSettingsXmlDoc.LoadXml(SampleRunSettingsContent); @@ -216,6 +245,26 @@ private void AddLegacyNodes(TestSettingsNodes testSettingsNodes, string testTime return; } + // Add ForcedLegacy node. + var mstestNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest"); + XmlNode forcedLegacyNode; + if (mstestNode == null) + { + mstestNode = newXmlDoc.CreateNode(XmlNodeType.Element, MSTestNodeName, null); + newXmlDoc.DocumentElement.AppendChild(mstestNode); + mstestNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest"); + } + + forcedLegacyNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/ForcedLegacyMode"); + if (forcedLegacyNode == null) + { + forcedLegacyNode = newXmlDoc.CreateNode(XmlNodeType.Element, ForcedLegacyModeName, null); + mstestNode.AppendChild(newXmlDoc.ImportNode(forcedLegacyNode, deep: true)); + forcedLegacyNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/ForcedLegacyMode"); + } + + forcedLegacyNode.InnerText = "true"; + // Remove if the legacy node already exists. var legacyNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/LegacySettings"); if (legacyNode != null) diff --git a/src/SettingsMigrator/Program.cs b/src/SettingsMigrator/Program.cs index 21f4359702..613b196a2b 100644 --- a/src/SettingsMigrator/Program.cs +++ b/src/SettingsMigrator/Program.cs @@ -15,46 +15,27 @@ public static class Program { private const string RunSettingsExtension = ".runsettings"; - private const string TestSettingsExtension = ".testsettings"; - /// /// Main entry point. Hands off execution to Migrator. /// - /// Arguments provided on the command line. - public static void Main(string[] args) + /// Arguments on the commandline + /// Exit code + public static int Main(string[] args) { if (args.Length != 1) { Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); - return; + return 1; } string oldFilePath = args[0]; - - if (!Path.IsPathRooted(oldFilePath)) - { - Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); - return; - } - var newFileName = string.Concat(Guid.NewGuid().ToString(), RunSettingsExtension); string newFilePath = Path.Combine(Path.GetDirectoryName(oldFilePath), newFileName); var migrator = new Migrator(); + migrator.Migrate(oldFilePath, newFilePath); - if (string.Equals(Path.GetExtension(oldFilePath), TestSettingsExtension)) - { - migrator.MigrateTestSettings(oldFilePath, newFilePath); - } - else if (string.Equals(Path.GetExtension(oldFilePath), RunSettingsExtension)) - { - migrator.MigrateRunSettings(oldFilePath, newFilePath); - } - else - { - Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage)); - return; - } + return 0; } } } \ No newline at end of file diff --git a/src/SettingsMigrator/Resources/Resources.resx b/src/SettingsMigrator/Resources/Resources.resx index 64f19199cf..f0a8f58abb 100644 --- a/src/SettingsMigrator/Resources/Resources.resx +++ b/src/SettingsMigrator/Resources/Resources.resx @@ -127,11 +127,11 @@ The migrated RunSettings file has been created at: {0} - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings \ No newline at end of file diff --git a/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf b/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf index 956a3628fc..0bced29b92 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.cs.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.de.xlf b/src/SettingsMigrator/Resources/xlf/Resources.de.xlf index bb1ff9e3d7..70ea25c890 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.de.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.de.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.es.xlf b/src/SettingsMigrator/Resources/xlf/Resources.es.xlf index 4f2245342a..08353aa034 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.es.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.es.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf b/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf index b155439a7b..26c3ee6292 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.fr.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.it.xlf b/src/SettingsMigrator/Resources/xlf/Resources.it.xlf index 4632917471..fe8fef440d 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.it.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.it.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf b/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf index 53917518dd..6c7ea4bf95 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.ja.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf b/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf index 76ea470e28..ecd43596b7 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.ko.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf b/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf index c452c3659b..4bf5e47a33 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.pl.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf b/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf index 78edb18fac..3a21422cda 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.pt-BR.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf b/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf index f8496645f4..579d7911ca 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.ru.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf b/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf index 7d63f8fda0..ff16900c9e 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.tr.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.xlf b/src/SettingsMigrator/Resources/xlf/Resources.xlf index 830e5a8fb8..f14ebefd57 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.xlf @@ -18,14 +18,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf index 899099fdbe..d769555315 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hans.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf index 6fea6ce0c8..09327abc38 100644 --- a/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/SettingsMigrator/Resources/xlf/Resources.zh-Hant.xlf @@ -36,14 +36,14 @@ - The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. + The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout of Timeouts node are not supported, so these will not be migrated. The attributes agentNotRespondingTimeout, deploymentTimeout, scriptTimeout are not supported, so these will not be migrated. - Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> -Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings -Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings + Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> +Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings +Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings Valid usage: SettingsMigrator.exe <Full path to testsettings file or runsettings file to be migrated> <Full path to new runsettings file> Example: SettingsMigrator.exe E:\MyTest\MyTestSettings.testsettings E:\MyTest\MyRunSettings.runsettings Example: SettingsMigrator.exe E:\MyTest\MyOldRunSettings.runsettings E:\MyTest\MyRunSettings.runsettings diff --git a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs b/test/SettingsMigrator.UnitTests/MigratorTests.cs similarity index 82% rename from test/SettingsMigrator.UnitTests/MigratorUnitTests.cs rename to test/SettingsMigrator.UnitTests/MigratorTests.cs index 0cc63d9aab..9f23ceace8 100644 --- a/test/SettingsMigrator.UnitTests/MigratorUnitTests.cs +++ b/test/SettingsMigrator.UnitTests/MigratorTests.cs @@ -9,8 +9,27 @@ namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator.UnitTests using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] - public class MigratorUnitTests + public class MigratorTests { + private const string InvalidSettings = ""; + + private const string OldRunSettings = "" + + "" + + "true" + + "" + + "" + + ""; + + [TestMethod] + public void NonRootedPathIsNotMigrator() + { + var migrator = new Migrator(); + string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); + migrator.Migrate("asda", newRunsettingsPath); + + Assert.IsFalse(File.Exists(newRunsettingsPath), "Run settings should not be generated."); + } + [TestMethod] public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() { @@ -25,7 +44,7 @@ public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() settingsnode.InnerText = oldTestsettingsPath; File.WriteAllText(oldRunsettingsPath, doc.InnerXml); - migrator.MigrateRunSettings(oldRunsettingsPath, newRunsettingsPath); + migrator.Migrate(oldRunsettingsPath, newRunsettingsPath); Validate(newRunsettingsPath); @@ -38,9 +57,9 @@ public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettingsOfRelative { var migrator = new Migrator(); string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); - string oldRunsettingsPath = Path.GetFullPath(Path.Combine(".", "oldRunsettings.runsettings")); + string oldRunsettingsPath = Path.GetFullPath(Path.Combine(".", "oldRunSettingsWithEmbeddedSettings.runsettings")); - migrator.MigrateRunSettings(oldRunsettingsPath, newRunsettingsPath); + migrator.Migrate(oldRunsettingsPath, newRunsettingsPath); Validate(newRunsettingsPath); File.Delete(newRunsettingsPath); @@ -53,7 +72,7 @@ public void MigratorGeneratesCorrectRunsettingsWithDC() string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); string oldRunsettingsPath = Path.GetFullPath(Path.Combine(".", "oldRunSettingsWithDataCollector.runsettings")); - migrator.MigrateRunSettings(oldRunsettingsPath, newRunsettingsPath); + migrator.Migrate(oldRunsettingsPath, newRunsettingsPath); using (XmlTextReader reader = new XmlTextReader(newRunsettingsPath)) { @@ -75,7 +94,7 @@ public void MigratorGeneratesCorrectRunsettingsForTestSettings() string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); string oldTestsettingsPath = Path.GetFullPath(Path.Combine(".", "oldTestsettings.testsettings")); - migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); + migrator.Migrate(oldTestsettingsPath, newRunsettingsPath); Validate(newRunsettingsPath); @@ -89,11 +108,11 @@ public void InvalidSettingsThrowsException() var migrator = new Migrator(); string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); - + File.WriteAllText(oldTestsettingsPath, InvalidSettings); - File.WriteAllText(newRunsettingsPath, ""); + File.WriteAllText(newRunsettingsPath, string.Empty); - migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); + migrator.Migrate(oldTestsettingsPath, newRunsettingsPath); File.Delete(oldTestsettingsPath); } @@ -106,7 +125,7 @@ public void InvalidPathThrowsException() string newRunsettingsPath = @"X:\generatedRunsettings.runsettings"; string oldTestsettingsPath = @"X:\generatedRunsettings.runsettings"; - migrator.MigrateTestSettings(oldTestsettingsPath, newRunsettingsPath); + migrator.Migrate(oldTestsettingsPath, newRunsettingsPath); } private static void Validate(string newRunsettingsPath) @@ -130,7 +149,11 @@ private static void Validate(string newRunsettingsPath) Assert.AreEqual(".\\setup.bat", scriptNode.Attributes["setupScript"].Value, "setupScript does not match."); Assert.AreEqual(".\\cleanup.bat", scriptNode.Attributes["cleanupScript"].Value, "cleanupScript does not match."); - var executionNode = root.SelectSingleNode(@"/RunSettings/LegacySettings/Execution"); + var forcedLegacyNode = root.SelectSingleNode(@"/RunSettings/MSTest/ForcedLegacyMode"); + Assert.IsNotNull(forcedLegacyNode, "ForcedLegacy node should be present"); + Assert.AreEqual("true", forcedLegacyNode.InnerText, "Forced legacy should be true"); + + var executionNode = root.SelectSingleNode(@" / RunSettings/LegacySettings/Execution"); Assert.IsNotNull(executionNode, "There should be a Execution node"); Assert.AreEqual("2", executionNode.Attributes["parallelTestCount"].Value, "parallelTestCount value does not match."); @@ -151,13 +174,5 @@ private static void Validate(string newRunsettingsPath) Assert.AreEqual("Event Log", dataCollectorNode.Attributes["friendlyName"].Value, "Data collector does not match."); } } - - const string InvalidSettings = ""; - const string OldRunSettings = "" + - "" + - "true" + - "" + - "" + - ""; - } + } } diff --git a/test/SettingsMigrator.UnitTests/ProgramTests.cs b/test/SettingsMigrator.UnitTests/ProgramTests.cs new file mode 100644 index 0000000000..f71bb971f9 --- /dev/null +++ b/test/SettingsMigrator.UnitTests/ProgramTests.cs @@ -0,0 +1,21 @@ +// 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.VisualStudio.TestPlatform.SettingsMigrator.UnitTests +{ + using System.IO; + using System.Xml; + using Microsoft.VisualStudio.TestPlatform.SettingsMigrator; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class ProgramTests + { + [TestMethod] + public void OnlyOneArgumentShouldBeAccepted() + { + int returnCode = Program.Main(new string[] { "asd", "asd" }); + Assert.AreEqual(1, returnCode, "Only one argument should be accepted."); + } + } +} \ No newline at end of file diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj index 6e9aa33fb5..376dbe0e01 100644 --- a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -7,6 +7,8 @@ net451 + true + true SettingsMigrator.UnitTests @@ -14,15 +16,13 @@ - + - - + - diff --git a/test/SettingsMigrator.UnitTests/oldRunSettings.runsettings b/test/SettingsMigrator.UnitTests/oldRunSettingsWithEmbeddedSettings.runsettings similarity index 100% rename from test/SettingsMigrator.UnitTests/oldRunSettings.runsettings rename to test/SettingsMigrator.UnitTests/oldRunSettingsWithEmbeddedSettings.runsettings From 645273c1525dac9ff66b0b91c165428de78e3cde Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Fri, 18 May 2018 17:46:39 +0530 Subject: [PATCH 11/21] Comments --- src/SettingsMigrator/Migrator.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/SettingsMigrator/Migrator.cs b/src/SettingsMigrator/Migrator.cs index 50bcd94f39..4f0cf6d364 100644 --- a/src/SettingsMigrator/Migrator.cs +++ b/src/SettingsMigrator/Migrator.cs @@ -53,6 +53,11 @@ public class Migrator private const string RunSettingsExtension = ".runsettings"; + /// + /// Migrates the nodes from given settings to run settings format. + /// + /// Path to old file + /// Path to new file public void Migrate(string oldFilePath, string newFilePath) { if (!Path.IsPathRooted(oldFilePath)) From 09226c51b98126a2f455c05417fc04757f7fd333 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Fri, 18 May 2018 18:19:22 +0530 Subject: [PATCH 12/21] PR comments --- .../MigratorTests.cs | 85 +++++++++---------- .../SettingsMigrator.UnitTests.csproj | 1 - 2 files changed, 41 insertions(+), 45 deletions(-) diff --git a/test/SettingsMigrator.UnitTests/MigratorTests.cs b/test/SettingsMigrator.UnitTests/MigratorTests.cs index 9f23ceace8..36c34283f0 100644 --- a/test/SettingsMigrator.UnitTests/MigratorTests.cs +++ b/test/SettingsMigrator.UnitTests/MigratorTests.cs @@ -20,61 +20,66 @@ public class MigratorTests "" + ""; + private Migrator migrator; + private string newRunsettingsPath; + private string oldTestsettingsPath; + private string oldRunsettingsPath; + + [TestInitialize] + public void TestInit() + { + this.migrator = new Migrator(); + this.newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); + this.oldTestsettingsPath = Path.GetFullPath(Path.Combine(".", "oldTestsettings.testsettings")); + this.oldRunsettingsPath = Path.Combine(Path.GetTempPath(), "oldRunsettings.runsettings"); + } + [TestMethod] public void NonRootedPathIsNotMigrator() { - var migrator = new Migrator(); - string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); - migrator.Migrate("asda", newRunsettingsPath); + this.migrator.Migrate("asda", this.newRunsettingsPath); - Assert.IsFalse(File.Exists(newRunsettingsPath), "Run settings should not be generated."); + Assert.IsFalse(File.Exists(this.newRunsettingsPath), "Run settings should not be generated."); } [TestMethod] public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() { - var migrator = new Migrator(); - string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); - string oldTestsettingsPath = Path.GetFullPath(Path.Combine(".", "oldTestsettings.testsettings")); - string oldRunsettingsPath = Path.Combine(Path.GetTempPath(), "oldRunsettings.runsettings"); + this.oldRunsettingsPath = Path.Combine(Path.GetTempPath(), "oldRunsettings.runsettings"); var doc = new XmlDocument(); doc.LoadXml(OldRunSettings); var settingsnode = doc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); - settingsnode.InnerText = oldTestsettingsPath; - File.WriteAllText(oldRunsettingsPath, doc.InnerXml); + settingsnode.InnerText = this.oldTestsettingsPath; + File.WriteAllText(this.oldRunsettingsPath, doc.InnerXml); - migrator.Migrate(oldRunsettingsPath, newRunsettingsPath); + this.migrator.Migrate(this.oldRunsettingsPath, this.newRunsettingsPath); - Validate(newRunsettingsPath); + Validate(this.newRunsettingsPath); - File.Delete(oldRunsettingsPath); - File.Delete(newRunsettingsPath); + File.Delete(this.oldRunsettingsPath); + File.Delete(this.newRunsettingsPath); } [TestMethod] public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettingsOfRelativePath() { - var migrator = new Migrator(); - string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); - string oldRunsettingsPath = Path.GetFullPath(Path.Combine(".", "oldRunSettingsWithEmbeddedSettings.runsettings")); + this.oldRunsettingsPath = Path.GetFullPath(Path.Combine(".", "oldRunSettingsWithEmbeddedSettings.runsettings")); - migrator.Migrate(oldRunsettingsPath, newRunsettingsPath); - Validate(newRunsettingsPath); + this.migrator.Migrate(this.oldRunsettingsPath, this.newRunsettingsPath); + Validate(this.newRunsettingsPath); - File.Delete(newRunsettingsPath); + File.Delete(this.newRunsettingsPath); } [TestMethod] public void MigratorGeneratesCorrectRunsettingsWithDC() { - var migrator = new Migrator(); - string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); - string oldRunsettingsPath = Path.GetFullPath(Path.Combine(".", "oldRunSettingsWithDataCollector.runsettings")); + this.oldRunsettingsPath = Path.GetFullPath(Path.Combine(".", "oldRunSettingsWithDataCollector.runsettings")); - migrator.Migrate(oldRunsettingsPath, newRunsettingsPath); + this.migrator.Migrate(this.oldRunsettingsPath, this.newRunsettingsPath); - using (XmlTextReader reader = new XmlTextReader(newRunsettingsPath)) + using (XmlTextReader reader = new XmlTextReader(this.newRunsettingsPath)) { reader.Namespaces = false; var document = new XmlDocument(); @@ -84,48 +89,40 @@ public void MigratorGeneratesCorrectRunsettingsWithDC() Assert.AreEqual(2, dataCollectorNode.Count, "Data collector is missing"); } - File.Delete(newRunsettingsPath); + File.Delete(this.newRunsettingsPath); } [TestMethod] public void MigratorGeneratesCorrectRunsettingsForTestSettings() { - var migrator = new Migrator(); - string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); - string oldTestsettingsPath = Path.GetFullPath(Path.Combine(".", "oldTestsettings.testsettings")); - - migrator.Migrate(oldTestsettingsPath, newRunsettingsPath); + this.migrator.Migrate(this.oldTestsettingsPath, this.newRunsettingsPath); - Validate(newRunsettingsPath); + Validate(this.newRunsettingsPath); - File.Delete(newRunsettingsPath); + File.Delete(this.newRunsettingsPath); } [TestMethod] [ExpectedException(typeof(XmlException))] public void InvalidSettingsThrowsException() { - var migrator = new Migrator(); - string newRunsettingsPath = Path.Combine(Path.GetTempPath(), "generatedRunsettings.runsettings"); - string oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); + this.oldTestsettingsPath = Path.Combine(Path.GetTempPath(), "oldTestsettings.testsettings"); - File.WriteAllText(oldTestsettingsPath, InvalidSettings); - File.WriteAllText(newRunsettingsPath, string.Empty); + File.WriteAllText(this.oldTestsettingsPath, InvalidSettings); + File.WriteAllText(this.newRunsettingsPath, string.Empty); - migrator.Migrate(oldTestsettingsPath, newRunsettingsPath); + this.migrator.Migrate(this.oldTestsettingsPath, this.newRunsettingsPath); - File.Delete(oldTestsettingsPath); + File.Delete(this.oldTestsettingsPath); } [TestMethod] [ExpectedException(typeof(DirectoryNotFoundException))] public void InvalidPathThrowsException() { - var migrator = new Migrator(); - string newRunsettingsPath = @"X:\generatedRunsettings.runsettings"; - string oldTestsettingsPath = @"X:\generatedRunsettings.runsettings"; + string oldTestsettingsPath = @"X:\generatedRun,settings.runsettings"; - migrator.Migrate(oldTestsettingsPath, newRunsettingsPath); + this.migrator.Migrate(oldTestsettingsPath, this.newRunsettingsPath); } private static void Validate(string newRunsettingsPath) diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj index 376dbe0e01..cee2d51b13 100644 --- a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -21,7 +21,6 @@ - From 4c5d7c38fb0a94b98fb097ec08a96f49d0e47cec Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Fri, 18 May 2018 18:20:48 +0530 Subject: [PATCH 13/21] Fix --- test/SettingsMigrator.UnitTests/MigratorTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/SettingsMigrator.UnitTests/MigratorTests.cs b/test/SettingsMigrator.UnitTests/MigratorTests.cs index 36c34283f0..ce0cf95b19 100644 --- a/test/SettingsMigrator.UnitTests/MigratorTests.cs +++ b/test/SettingsMigrator.UnitTests/MigratorTests.cs @@ -45,8 +45,6 @@ public void NonRootedPathIsNotMigrator() [TestMethod] public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() { - this.oldRunsettingsPath = Path.Combine(Path.GetTempPath(), "oldRunsettings.runsettings"); - var doc = new XmlDocument(); doc.LoadXml(OldRunSettings); var settingsnode = doc.DocumentElement.SelectSingleNode(@"/RunSettings/MSTest/SettingsFile"); From 67f2cd38c1881b5255093bd544b7115a7c85a014 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Mon, 21 May 2018 13:54:18 +0530 Subject: [PATCH 14/21] Signproj --- src/package/sign/sign.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/package/sign/sign.proj b/src/package/sign/sign.proj index 23070a4bc5..989f1e2235 100644 --- a/src/package/sign/sign.proj +++ b/src/package/sign/sign.proj @@ -170,6 +170,7 @@ + From 07a5ba7c1e007cf1bde59f4570f9a8a4bf8f95d2 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Mon, 21 May 2018 14:17:44 +0530 Subject: [PATCH 15/21] Required reference --- .../SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj index cee2d51b13..e307621240 100644 --- a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -21,6 +21,7 @@ + From e38c75b9cacde0bcbcff9a4cd480118e3636c332 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Mon, 21 May 2018 14:44:37 +0530 Subject: [PATCH 16/21] Nuspec update --- src/package/nuspec/Microsoft.TestPlatform.nuspec | 1 - 1 file changed, 1 deletion(-) diff --git a/src/package/nuspec/Microsoft.TestPlatform.nuspec b/src/package/nuspec/Microsoft.TestPlatform.nuspec index 8b20197e93..3546ef9cf8 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.nuspec +++ b/src/package/nuspec/Microsoft.TestPlatform.nuspec @@ -175,7 +175,6 @@ - From c7ce3c41918794f2d391adab732afacb4e22cdcd Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Mon, 21 May 2018 15:56:39 +0530 Subject: [PATCH 17/21] References --- .../SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj index e307621240..329aa260ff 100644 --- a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -22,6 +22,7 @@ + From fc16f53be93456a8565939e0c070e3e947f9bd51 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Mon, 21 May 2018 17:05:14 +0530 Subject: [PATCH 18/21] Fix reference --- .../SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj index 329aa260ff..aa9868f2fc 100644 --- a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -21,6 +21,7 @@ + From 204fa47b8c16fa5de4670f32b180947d807fc6e0 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Mon, 21 May 2018 17:55:21 +0530 Subject: [PATCH 19/21] Fix references --- .../SettingsMigrator.UnitTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj index aa9868f2fc..038ae2f4be 100644 --- a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -22,7 +22,7 @@ - + From b31a07a9e9c27ae0c9f654155402645b9719ee11 Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Wed, 23 May 2018 11:38:24 +0530 Subject: [PATCH 20/21] Refactor --- .../MigratorTests.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/SettingsMigrator.UnitTests/MigratorTests.cs b/test/SettingsMigrator.UnitTests/MigratorTests.cs index ce0cf95b19..c57cbb7ed1 100644 --- a/test/SettingsMigrator.UnitTests/MigratorTests.cs +++ b/test/SettingsMigrator.UnitTests/MigratorTests.cs @@ -34,8 +34,17 @@ public void TestInit() this.oldRunsettingsPath = Path.Combine(Path.GetTempPath(), "oldRunsettings.runsettings"); } + [TestCleanup] + public void TestCleanup() + { + if (File.Exists(this.newRunsettingsPath)) + { + File.Delete(this.newRunsettingsPath); + } + } + [TestMethod] - public void NonRootedPathIsNotMigrator() + public void NonRootedPathIsNotMigrated() { this.migrator.Migrate("asda", this.newRunsettingsPath); @@ -56,7 +65,6 @@ public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettings() Validate(this.newRunsettingsPath); File.Delete(this.oldRunsettingsPath); - File.Delete(this.newRunsettingsPath); } [TestMethod] @@ -66,8 +74,6 @@ public void MigratorGeneratesCorrectRunsettingsForEmbeddedTestSettingsOfRelative this.migrator.Migrate(this.oldRunsettingsPath, this.newRunsettingsPath); Validate(this.newRunsettingsPath); - - File.Delete(this.newRunsettingsPath); } [TestMethod] @@ -86,8 +92,6 @@ public void MigratorGeneratesCorrectRunsettingsWithDC() var dataCollectorNode = root.SelectNodes(@"/RunSettings/DataCollectionRunSettings/DataCollectors/DataCollector"); Assert.AreEqual(2, dataCollectorNode.Count, "Data collector is missing"); } - - File.Delete(this.newRunsettingsPath); } [TestMethod] @@ -96,8 +100,6 @@ public void MigratorGeneratesCorrectRunsettingsForTestSettings() this.migrator.Migrate(this.oldTestsettingsPath, this.newRunsettingsPath); Validate(this.newRunsettingsPath); - - File.Delete(this.newRunsettingsPath); } [TestMethod] From 5d6715215dc3f98c8e8ac5a67e505750cc8364af Mon Sep 17 00:00:00 2001 From: Kavipriya Adhinarayanan Date: Wed, 23 May 2018 15:27:34 +0530 Subject: [PATCH 21/21] Fixing file count --- scripts/verify-nupkgs.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/verify-nupkgs.ps1 b/scripts/verify-nupkgs.ps1 index 446bac4ff0..75199580bc 100644 --- a/scripts/verify-nupkgs.ps1 +++ b/scripts/verify-nupkgs.ps1 @@ -14,7 +14,7 @@ function Verify-Nuget-Packages($packageDirectory) Write-Log "Starting Verify-Nuget-Packages." $expectedNumOfFiles = @{"Microsoft.CodeCoverage" = 28; "Microsoft.NET.Test.Sdk" = 10; - "Microsoft.TestPlatform" = 406; + "Microsoft.TestPlatform" = 420; "Microsoft.TestPlatform.Build" = 19; "Microsoft.TestPlatform.CLI" = 302; "Microsoft.TestPlatform.ObjectModel" = 65;