From be41d624cf66d4f9210caf2ea6f85858b59daa85 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Wed, 14 Aug 2019 17:31:28 +0530 Subject: [PATCH 01/20] Changes being committed for #2071 --- src/vstest.console/CommandLine/Executor.cs | 17 +++++-- .../Utilities/ArgumentProcessorFactory.cs | 1 + .../Resources/Resources.Designer.cs | 47 ++++++++++--------- src/vstest.console/Resources/Resources.resx | 4 ++ .../Resources/xlf/Resources.cs.xlf | 7 +++ .../Resources/xlf/Resources.de.xlf | 7 +++ .../Resources/xlf/Resources.es.xlf | 7 +++ .../Resources/xlf/Resources.fr.xlf | 7 +++ .../Resources/xlf/Resources.it.xlf | 7 +++ .../Resources/xlf/Resources.ja.xlf | 7 +++ .../Resources/xlf/Resources.ko.xlf | 7 +++ .../Resources/xlf/Resources.pl.xlf | 7 +++ .../Resources/xlf/Resources.pt-BR.xlf | 7 +++ .../Resources/xlf/Resources.ru.xlf | 7 +++ .../Resources/xlf/Resources.tr.xlf | 7 +++ .../Resources/xlf/Resources.xlf | 7 +++ .../Resources/xlf/Resources.zh-Hans.xlf | 7 +++ .../Resources/xlf/Resources.zh-Hant.xlf | 7 +++ 18 files changed, 143 insertions(+), 24 deletions(-) diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index dee43d0cf3..88506210f5 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -30,6 +30,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine using System.Globalization; using System.IO; using System.Linq; + using System.Threading; using Microsoft.VisualStudio.TestPlatform.CommandLine.Internal; using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors; @@ -40,8 +41,8 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.Utilities; - using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; + /// /// Performs the execution based on the arguments provided. @@ -172,6 +173,7 @@ internal int Execute(params string[] args) [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "processorInstance", Justification = "Done on purpose to force the instances to be created")] private int GetArgumentProcessors(string[] args, out List processors) { + processors = new List(); int result = 0; @@ -188,7 +190,7 @@ private int GetArgumentProcessors(string[] args, out List pr processors.Add(cliRunSettingsProcessor); break; } - + var processor = processorFactory.CreateArgumentProcessor(arg); if (processor != null) @@ -225,6 +227,7 @@ private int GetArgumentProcessors(string[] args, out List pr processors.Sort((p1, p2) => Comparer.Default.Compare(p1.Metadata.Value.Priority, p2.Metadata.Value.Priority)); foreach (var processor in processors) { + IArgumentExecutor executorInstance; try { @@ -236,8 +239,16 @@ private int GetArgumentProcessors(string[] args, out List pr { if (ex is CommandLineException || ex is TestPlatformException) { - this.Output.Error(false, ex.Message); + //gets the provided CommandName/Type + string invalidCommandName = processor.Metadata.Value.CommandName; + + + this.Output.Error(false, CommandLineResources.InvalidArgument, invalidCommandName); + + // the /help options - display : off + this.showHelp = false; result = 1; + break; } else if (ex is SettingsException) { diff --git a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs index f2bd53a696..75fbae9bdc 100644 --- a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs +++ b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs @@ -158,6 +158,7 @@ public IArgumentProcessor CreateArgumentProcessor(string argument) } return argumentProcessor; + } /// diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index ac592cc5b3..f33b2b77fe 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Resources -{ +{ using System; using System.Reflection; @@ -21,7 +21,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.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", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -38,19 +38,16 @@ internal class 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("vstest.console.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("vstest.console.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. @@ -685,6 +682,16 @@ internal class Resources { } } + /// + /// Looks up a localized string similar to The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + ///Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options. + /// + internal static string InvalidArgument { + get { + return ResourceManager.GetString("InvalidArgument", resourceCulture); + } + } + /// /// Looks up a localized string similar to Invalid batch size {0}. The batch size should be greater than zero. Example: /BatchSize:10. /// @@ -1147,17 +1154,6 @@ internal class Resources { } } - /// - /// Looks up a localized string similar to Test run in progress. - /// - public static string ProgressIndicatorString - { - get - { - return ResourceManager.GetString("ProgressIndicatorString", resourceCulture); - } - } - /// /// Looks up a localized string similar to --Port|/Port:<Port> /// The Port for socket connection and receiving the event messages.. @@ -1168,6 +1164,15 @@ public static string ProgressIndicatorString } } + /// + /// Looks up a localized string similar to Test run in progress. + /// + internal static string ProgressIndicatorString { + get { + return ResourceManager.GetString("ProgressIndicatorString", resourceCulture); + } + } + /// /// Looks up a localized string similar to The Path {0} does not exist.. /// diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index dcd46707d8..5719219b09 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -730,4 +730,8 @@ Test run in progress + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index daddd18995..712f0fb571 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1653,6 +1653,13 @@ Přeskočené: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 953c18ca7d..e117865ba7 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1653,6 +1653,13 @@ Übersprungen: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 94c4f15cb5..d8b12e7985 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1655,6 +1655,13 @@ Omitido: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 788e5c23c8..32568ef1ee 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1653,6 +1653,13 @@ Ignoré(s) : {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index bb6c835e05..6900dfd0bf 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1653,6 +1653,13 @@ Ignorati: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 8511a9f746..e4110a97c0 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1653,6 +1653,13 @@ スキップ: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index e3e9bc8c15..ccd2341fdd 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1653,6 +1653,13 @@ 건너뜀: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index 9872a4ce0f..084e2d50b2 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1653,6 +1653,13 @@ Pominięte: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 7ae7dd4987..61397dccac 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1653,6 +1653,13 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a Ignorados: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 7f87be0933..37b7456d2b 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1653,6 +1653,13 @@ Пропущено: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index df8b4901f5..4a42a9b733 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1653,6 +1653,13 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin Atlandı: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index cdaa74fa6a..17c4650abf 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -840,6 +840,13 @@ Skipped: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 0f597fdba8..c5510a5c16 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1652,6 +1652,13 @@ 跳过数: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 89ea9c6c11..2d6a8e9f20 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1654,6 +1654,13 @@ 跳過: {0} + + The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args +Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + + \ No newline at end of file From c280d9fc94c918ecf44b2f21c98de0a94b22b8c8 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Mon, 19 Aug 2019 10:39:46 +0530 Subject: [PATCH 02/20] executor file got updated #2071 --- src/vstest.console/CommandLine/Executor.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index 88506210f5..2884c12e9d 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -175,7 +175,7 @@ private int GetArgumentProcessors(string[] args, out List pr { processors = new List(); - + int result = 0; var processorFactory = ArgumentProcessorFactory.Create(); @@ -237,12 +237,14 @@ private int GetArgumentProcessors(string[] args, out List pr } catch (Exception ex) { + + if (ex is CommandLineException || ex is TestPlatformException) { - //gets the provided CommandName/Type - string invalidCommandName = processor.Metadata.Value.CommandName; - + //gets the CommandName/Type + string invalidCommandName = processor.Metadata.Value.CommandName; + this.Output.Error(false, CommandLineResources.InvalidArgument, invalidCommandName); // the /help options - display : off From 4d2222cf7d0c61770a3bd4a132b9d071c2a576c6 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Mon, 19 Aug 2019 18:03:32 +0530 Subject: [PATCH 03/20] improved error message to specify the invalid argument #2071 --- .../CommandLine/CommandLineOptions.cs | 12 +++++++++- src/vstest.console/CommandLine/Executor.cs | 9 +++++--- .../Resources/Resources.Designer.cs | 22 +++++++++---------- src/vstest.console/Resources/Resources.resx | 2 +- .../Resources/xlf/Resources.cs.xlf | 2 +- .../Resources/xlf/Resources.de.xlf | 2 +- .../Resources/xlf/Resources.es.xlf | 2 +- .../Resources/xlf/Resources.fr.xlf | 2 +- .../Resources/xlf/Resources.it.xlf | 2 +- .../Resources/xlf/Resources.ja.xlf | 2 +- .../Resources/xlf/Resources.ko.xlf | 2 +- .../Resources/xlf/Resources.pl.xlf | 2 +- .../Resources/xlf/Resources.pt-BR.xlf | 2 +- .../Resources/xlf/Resources.ru.xlf | 2 +- .../Resources/xlf/Resources.tr.xlf | 2 +- .../Resources/xlf/Resources.xlf | 2 +- .../Resources/xlf/Resources.zh-Hans.xlf | 2 +- .../Resources/xlf/Resources.zh-Hant.xlf | 2 +- 18 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/vstest.console/CommandLine/CommandLineOptions.cs b/src/vstest.console/CommandLine/CommandLineOptions.cs index 04e3c7e392..f84972ac5b 100644 --- a/src/vstest.console/CommandLine/CommandLineOptions.cs +++ b/src/vstest.console/CommandLine/CommandLineOptions.cs @@ -15,6 +15,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; using System.IO; using vstest.console.Internal; + using System.Globalization; /// /// Provides access to the command-line options. @@ -282,17 +283,26 @@ internal Framework TargetFrameworkVersion /// Path to source file to look for tests in. public void AddSource(string source) { + var extnList = new List() { ".dll", ".exe" }; if (String.IsNullOrWhiteSpace(source)) { throw new CommandLineException(CommandLineResources.CannotBeNullOrEmpty); } source = source.Trim(); - + // Convert the relative path to absolute path if (!Path.IsPathRooted(source)) { + if (!extnList.Contains(source)) + { + throw new CommandLineException( + string.Format(CultureInfo.CurrentUICulture, CommandLineResources.InvalidArgument, source)); + } + else + { source = Path.Combine(FileHelper.GetCurrentDirectory(), source); + } } // Get matching files from file pattern parser diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index 2884c12e9d..b08f7ff594 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -241,13 +241,16 @@ private int GetArgumentProcessors(string[] args, out List pr if (ex is CommandLineException || ex is TestPlatformException) { + + //string invalidParam = ex.Message.Split('\\').Last().ToString(); - //gets the CommandName/Type - string invalidCommandName = processor.Metadata.Value.CommandName; + ////gets the CommandName/Type + //string invalidCommandName = processor.Metadata.Value.CommandName; - this.Output.Error(false, CommandLineResources.InvalidArgument, invalidCommandName); + //this.Output.Error(false, CommandLineResources.InvalidArgument, invalidParam, invalidCommandName); // the /help options - display : off + this.Output.Error(false, ex.Message); this.showHelp = false; result = 1; break; diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index b0cfe844dc..288de1f50b 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -674,7 +674,7 @@ internal class Resources { } /// - /// Looks up a localized string similar to The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + /// Looks up a localized string similar to The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args ///Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options. /// internal static string InvalidArgument { @@ -1264,10 +1264,11 @@ internal class Resources { /// /// Looks up a localized string similar to [TestFileNames] - /// Run tests from the specified files. Separate multiple test file names - /// by spaces. + /// Run tests from the specified files or wild card pattern. Separate multiple test file names or pattern + /// by spaces. Set console logger verbosity to detailed to view matched test files. /// Examples: mytestproject.dll - /// mytestproject.dll myothertestproject.exe. + /// mytestproject.dll myothertestproject.exe + /// testproject*.dll my*project.dll. /// internal static string RunTestsArgumentHelp { get { @@ -1612,19 +1613,16 @@ internal class Resources { return ResourceManager.GetString("TestSourceFileNotFound", resourceCulture); } } - + /// - /// Looks up a localized string similar to A total of {0} test source files are discovered.. + /// Looks up a localized string similar to A total of {0} test files matched the specified pattern.. /// - internal static string TestSourcesDiscovered - { - get - { + internal static string TestSourcesDiscovered { + get { return ResourceManager.GetString("TestSourcesDiscovered", resourceCulture); } } - - + /// /// Looks up a localized string similar to Time elapsed :. /// diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 3a70482286..50cbe6b6f6 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -729,7 +729,7 @@ Test run in progress - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 89ddcc4c6b..a4d4822787 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1646,7 +1646,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 7722c8df38..ab6409c92e 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1646,7 +1646,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 285696400e..52a9523576 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1648,7 +1648,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index 57d5ac0db0..fb4ce1905a 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1646,7 +1646,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index bad502cf70..5a381beda5 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1646,7 +1646,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index ec797ca849..9ec667395d 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1646,7 +1646,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 6aa60594d0..689d7cbfbb 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1646,7 +1646,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index e2cee104f3..f6cd46ec0d 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1646,7 +1646,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index efad82daf1..2ca9338f24 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1646,7 +1646,7 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index acc963c385..d131ba626d 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1646,7 +1646,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 30270c2c4c..9743e6afe7 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1646,7 +1646,7 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 1cf6f1619a..fd9a367413 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -838,7 +838,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index ee9bcc2662..615ce43093 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1645,7 +1645,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index b607addceb..6517e37fb3 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1647,7 +1647,7 @@ - The given argument {0} is incorrect or invalid. Kindly use /help option to check the valid args + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options The given argument {0} . Kindly use /help option to know more about the valid args Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options From cd5215ed8ae163acc6f56ee400ce6d3dc8b87b6a Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Tue, 20 Aug 2019 12:42:38 +0530 Subject: [PATCH 04/20] updated #2071 --- src/vstest.console/CommandLine/CommandLineOptions.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/vstest.console/CommandLine/CommandLineOptions.cs b/src/vstest.console/CommandLine/CommandLineOptions.cs index f84972ac5b..2360b78437 100644 --- a/src/vstest.console/CommandLine/CommandLineOptions.cs +++ b/src/vstest.console/CommandLine/CommandLineOptions.cs @@ -283,7 +283,7 @@ internal Framework TargetFrameworkVersion /// Path to source file to look for tests in. public void AddSource(string source) { - var extnList = new List() { ".dll", ".exe" }; + var extnList = new List() { ".xap",".appx",".dll", ".exe" }; if (String.IsNullOrWhiteSpace(source)) { throw new CommandLineException(CommandLineResources.CannotBeNullOrEmpty); @@ -299,10 +299,9 @@ public void AddSource(string source) throw new CommandLineException( string.Format(CultureInfo.CurrentUICulture, CommandLineResources.InvalidArgument, source)); } - else - { + source = Path.Combine(FileHelper.GetCurrentDirectory(), source); - } + } // Get matching files from file pattern parser From 02985daf42aa47dcc5d56a5ac0cd01f3a95a8b8f Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Tue, 20 Aug 2019 15:04:45 +0530 Subject: [PATCH 05/20] updated #2071 --- .../CommandLine/CommandLineOptions.cs | 46 +++++++++++-------- src/vstest.console/CommandLine/Executor.cs | 35 ++++---------- .../Resources/Resources.Designer.cs | 3 +- src/vstest.console/Resources/Resources.resx | 3 +- .../Resources/xlf/Resources.cs.xlf | 6 +-- .../Resources/xlf/Resources.de.xlf | 6 +-- .../Resources/xlf/Resources.es.xlf | 6 +-- .../Resources/xlf/Resources.fr.xlf | 6 +-- .../Resources/xlf/Resources.it.xlf | 6 +-- .../Resources/xlf/Resources.ja.xlf | 6 +-- .../Resources/xlf/Resources.ko.xlf | 6 +-- .../Resources/xlf/Resources.pl.xlf | 6 +-- .../Resources/xlf/Resources.pt-BR.xlf | 6 +-- .../Resources/xlf/Resources.ru.xlf | 6 +-- .../Resources/xlf/Resources.tr.xlf | 6 +-- .../Resources/xlf/Resources.xlf | 6 +-- .../Resources/xlf/Resources.zh-Hans.xlf | 6 +-- .../Resources/xlf/Resources.zh-Hant.xlf | 6 +-- 18 files changed, 65 insertions(+), 106 deletions(-) diff --git a/src/vstest.console/CommandLine/CommandLineOptions.cs b/src/vstest.console/CommandLine/CommandLineOptions.cs index 2360b78437..9a500cb708 100644 --- a/src/vstest.console/CommandLine/CommandLineOptions.cs +++ b/src/vstest.console/CommandLine/CommandLineOptions.cs @@ -23,7 +23,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine internal class CommandLineOptions { #region Constants/Readonly - + /// /// The default batch size. /// @@ -38,14 +38,14 @@ internal class CommandLineOptions /// The default use vsix extensions value. /// public const bool DefaultUseVsixExtensionsValue = false; - + /// /// The default retrieval timeout for fetching of test results or test cases /// - private readonly TimeSpan DefaultRetrievalTimeout = new TimeSpan(0, 0, 0, 1, 500); - + private readonly TimeSpan DefaultRetrievalTimeout = new TimeSpan(0, 0, 0, 1, 500); + #endregion - + #region PrivateMembers private static CommandLineOptions instance; @@ -53,7 +53,7 @@ internal class CommandLineOptions private List sources = new List(); private Architecture architecture; - + private Framework frameworkVersion; #endregion @@ -90,7 +90,7 @@ protected CommandLineOptions() #endif } -#endregion + #endregion #region Properties @@ -159,7 +159,7 @@ public IEnumerable Sources /// Directory containing the binaries to run /// public string Output { get; set; } - + /// /// Specifies the frequency of the runStats/discoveredTests event /// @@ -195,7 +195,7 @@ public bool HasPhoneContext return !string.IsNullOrEmpty(TargetDevice); } } - + /// /// Specifies the target platform type for test run. /// @@ -231,7 +231,7 @@ public bool ShouldCollectSourceInformation { return IsDesignMode; } - } + } /// /// Specifies if /Platform has been specified on command line or not. @@ -283,25 +283,33 @@ internal Framework TargetFrameworkVersion /// Path to source file to look for tests in. public void AddSource(string source) { - var extnList = new List() { ".xap",".appx",".dll", ".exe" }; + var extnList = new List() { ".xap", ".appx", ".dll", ".exe" }; if (String.IsNullOrWhiteSpace(source)) { throw new CommandLineException(CommandLineResources.CannotBeNullOrEmpty); } - + source = source.Trim(); + //verify whether the given argument is source type if not process further + int count = 0; + foreach (string extension in extnList) + { + if (source.Contains(extension)) + { + count += 1; + } + } + if (count == 0) + { + throw new CommandLineException( + string.Format(CultureInfo.CurrentUICulture, CommandLineResources.InvalidArgument, source)); + } + // Convert the relative path to absolute path if (!Path.IsPathRooted(source)) { - if (!extnList.Contains(source)) - { - throw new CommandLineException( - string.Format(CultureInfo.CurrentUICulture, CommandLineResources.InvalidArgument, source)); - } - source = Path.Combine(FileHelper.GetCurrentDirectory(), source); - } // Get matching files from file pattern parser diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index b08f7ff594..e15f43b73c 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -31,7 +31,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine using System.IO; using System.Linq; using System.Threading; - using Microsoft.VisualStudio.TestPlatform.CommandLine.Internal; using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors; using Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers; @@ -41,8 +40,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.Utilities; - using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; - + using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; /// /// Performs the execution based on the arguments provided. @@ -172,25 +170,20 @@ internal int Execute(params string[] args) /// 0 if all of the processors were created successfully and 1 otherwise. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "processorInstance", Justification = "Done on purpose to force the instances to be created")] private int GetArgumentProcessors(string[] args, out List processors) - { - - processors = new List(); - + { + processors = new List(); int result = 0; var processorFactory = ArgumentProcessorFactory.Create(); - for (var index = 0; index < args.Length; index++) { var arg = args[index]; - // If argument is '--', following arguments are key=value pairs for run settings. if (arg.Equals("--")) { var cliRunSettingsProcessor = processorFactory.CreateArgumentProcessor(arg, args.Skip(index + 1).ToArray()); processors.Add(cliRunSettingsProcessor); break; - } - + } var processor = processorFactory.CreateArgumentProcessor(arg); if (processor != null) @@ -226,8 +219,7 @@ private int GetArgumentProcessors(string[] args, out List pr // Instantiate and initialize the processors in priority order. processors.Sort((p1, p2) => Comparer.Default.Compare(p1.Metadata.Value.Priority, p2.Metadata.Value.Priority)); foreach (var processor in processors) - { - + { IArgumentExecutor executorInstance; try { @@ -236,21 +228,12 @@ private int GetArgumentProcessors(string[] args, out List pr executorInstance = processor.Executor.Value; } catch (Exception ex) - { - - + { if (ex is CommandLineException || ex is TestPlatformException) - { - - //string invalidParam = ex.Message.Split('\\').Last().ToString(); - - ////gets the CommandName/Type - //string invalidCommandName = processor.Metadata.Value.CommandName; - - //this.Output.Error(false, CommandLineResources.InvalidArgument, invalidParam, invalidCommandName); + { + this.Output.Error(false, ex.Message); // the /help options - display : off - this.Output.Error(false, ex.Message); this.showHelp = false; result = 1; break; @@ -314,7 +297,6 @@ private int IdentifyDuplicateArguments(IEnumerable argumentP } } } - return result; } @@ -389,7 +371,6 @@ private bool ExecuteArgumentProcessor(IArgumentProcessor processor, ref int exit { continueExecution = false; } - return continueExecution; } diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 288de1f50b..c321d4241f 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -674,8 +674,7 @@ internal class Resources { } /// - /// Looks up a localized string similar to The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args - ///Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options. + /// Looks up a localized string similar to The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options. /// internal static string InvalidArgument { get { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index 50cbe6b6f6..ffd97459e7 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -729,8 +729,7 @@ Test run in progress - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options A total of {0} test files matched the specified pattern. diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index a4d4822787..11bd49c08f 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1646,10 +1646,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index ab6409c92e..c0d8f44439 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1646,10 +1646,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 52a9523576..b630b948de 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1648,10 +1648,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index fb4ce1905a..ffc906ecc0 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1646,10 +1646,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 5a381beda5..36e5c704be 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1646,10 +1646,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 9ec667395d..3f971150a0 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1646,10 +1646,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 689d7cbfbb..a8257d69c3 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1646,10 +1646,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index f6cd46ec0d..9590005bcb 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1646,10 +1646,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 2ca9338f24..aa69169aa7 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1646,10 +1646,8 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index d131ba626d..fda1857d6b 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1646,10 +1646,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 9743e6afe7..d26a7c357b 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1646,10 +1646,8 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index fd9a367413..4008f52285 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -838,10 +838,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 615ce43093..363e6650a4 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1645,10 +1645,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 6517e37fb3..3cb5164df3 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1647,10 +1647,8 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options - The given argument {0} . Kindly use /help option to know more about the valid args -Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options From 74ac29ea663b1d6250a99cfbc9f5e5430d3f6d45 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Tue, 20 Aug 2019 19:15:42 +0530 Subject: [PATCH 06/20] code updated for #2071 --- .../CommandLine/CommandLineOptions.cs | 28 +++++++++++-------- src/vstest.console/CommandLine/Executor.cs | 7 ++--- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/vstest.console/CommandLine/CommandLineOptions.cs b/src/vstest.console/CommandLine/CommandLineOptions.cs index 9a500cb708..36b9896e04 100644 --- a/src/vstest.console/CommandLine/CommandLineOptions.cs +++ b/src/vstest.console/CommandLine/CommandLineOptions.cs @@ -16,6 +16,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine using System.IO; using vstest.console.Internal; using System.Globalization; + using System.Collections; /// /// Provides access to the command-line options. @@ -44,6 +45,19 @@ internal class CommandLineOptions /// private readonly TimeSpan DefaultRetrievalTimeout = new TimeSpan(0, 0, 0, 1, 500); + /// + /// The supported extension types for test source + /// + public static readonly IEnumerable extnList = new List() + { + ".xap" , + ".appx" , + ".dll", + ".exe", + "*.appxrecipe" + }; + + #endregion #region PrivateMembers @@ -283,7 +297,6 @@ internal Framework TargetFrameworkVersion /// Path to source file to look for tests in. public void AddSource(string source) { - var extnList = new List() { ".xap", ".appx", ".dll", ".exe" }; if (String.IsNullOrWhiteSpace(source)) { throw new CommandLineException(CommandLineResources.CannotBeNullOrEmpty); @@ -291,16 +304,9 @@ public void AddSource(string source) source = source.Trim(); - //verify whether the given argument is source type if not process further - int count = 0; - foreach (string extension in extnList) - { - if (source.Contains(extension)) - { - count += 1; - } - } - if (count == 0) + //verify whether the given argument is source type + bool isEntensionMatched = extnList.Any(a => a == Path.GetExtension(source)); + if (!isEntensionMatched) { throw new CommandLineException( string.Format(CultureInfo.CurrentUICulture, CommandLineResources.InvalidArgument, source)); diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index e15f43b73c..039677d92c 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -171,7 +171,7 @@ internal int Execute(params string[] args) [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "processorInstance", Justification = "Done on purpose to force the instances to be created")] private int GetArgumentProcessors(string[] args, out List processors) { - processors = new List(); + processors = new List(); int result = 0; var processorFactory = ArgumentProcessorFactory.Create(); for (var index = 0; index < args.Length; index++) @@ -228,11 +228,10 @@ private int GetArgumentProcessors(string[] args, out List pr executorInstance = processor.Executor.Value; } catch (Exception ex) - { + { if (ex is CommandLineException || ex is TestPlatformException) - { + { this.Output.Error(false, ex.Message); - // the /help options - display : off this.showHelp = false; result = 1; From 9267738b4b7471640332b6384f6af5bf6f314277 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Wed, 21 Aug 2019 16:24:22 +0530 Subject: [PATCH 07/20] files updated for #2071 --- ...orException.cs => CommandLineException.cs} | 2 +- .../CommandLine/CommandLineOptions.cs | 28 +++++++-------- src/vstest.console/CommandLine/Executor.cs | 10 +++--- .../CommandLine/TestSourceException.cs | 34 +++++++++++++++++++ .../Internal/FilePatternParser.cs | 10 ++++-- .../Utilities/ArgumentProcessorFactory.cs | 1 - .../Resources/Resources.Designer.cs | 2 +- src/vstest.console/Resources/Resources.resx | 2 +- 8 files changed, 63 insertions(+), 26 deletions(-) rename src/vstest.console/CommandLine/{CommandLineErrorException.cs => CommandLineException.cs} (96%) create mode 100644 src/vstest.console/CommandLine/TestSourceException.cs diff --git a/src/vstest.console/CommandLine/CommandLineErrorException.cs b/src/vstest.console/CommandLine/CommandLineException.cs similarity index 96% rename from src/vstest.console/CommandLine/CommandLineErrorException.cs rename to src/vstest.console/CommandLine/CommandLineException.cs index 437b650f90..4defc252ba 100644 --- a/src/vstest.console/CommandLine/CommandLineErrorException.cs +++ b/src/vstest.console/CommandLine/CommandLineException.cs @@ -35,7 +35,7 @@ public CommandLineException(string message) /// Message for the exception. /// The inner exception. public CommandLineException(string message, Exception innerException) - : base (message, innerException) + : base(message, innerException) { } diff --git a/src/vstest.console/CommandLine/CommandLineOptions.cs b/src/vstest.console/CommandLine/CommandLineOptions.cs index 36b9896e04..c4a46a8de5 100644 --- a/src/vstest.console/CommandLine/CommandLineOptions.cs +++ b/src/vstest.console/CommandLine/CommandLineOptions.cs @@ -54,7 +54,7 @@ internal class CommandLineOptions ".appx" , ".dll", ".exe", - "*.appxrecipe" + ".appxrecipe" }; @@ -299,28 +299,26 @@ public void AddSource(string source) { if (String.IsNullOrWhiteSpace(source)) { - throw new CommandLineException(CommandLineResources.CannotBeNullOrEmpty); + throw new TestSourceException(CommandLineResources.CannotBeNullOrEmpty); } source = source.Trim(); - //verify whether the given argument is source type - bool isEntensionMatched = extnList.Any(a => a == Path.GetExtension(source)); - if (!isEntensionMatched) + List matchingFiles; + try { - throw new CommandLineException( - string.Format(CultureInfo.CurrentUICulture, CommandLineResources.InvalidArgument, source)); + // Get matching files from file pattern parser + matchingFiles = FilePatternParser.GetMatchingFiles(source); } - - // Convert the relative path to absolute path - if (!Path.IsPathRooted(source)) + catch(TestSourceException ex) { - source = Path.Combine(FileHelper.GetCurrentDirectory(), source); + if(source.StartsWith("-") || source.StartsWith("/")) + { + throw new TestSourceException( + string.Format(CultureInfo.CurrentUICulture, CommandLineResources.InvalidArgument, source)); + } + throw ex; } - - // Get matching files from file pattern parser - var matchingFiles = FilePatternParser.GetMatchingFiles(source); - // Add the matching files to source list this.sources = this.sources.Union(matchingFiles).ToList(); } diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index 039677d92c..ee64958e30 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -229,19 +229,19 @@ private int GetArgumentProcessors(string[] args, out List pr } catch (Exception ex) { - if (ex is CommandLineException || ex is TestPlatformException) + if (ex is CommandLineException || ex is TestPlatformException || ex is SettingsException) { this.Output.Error(false, ex.Message); - // the /help options - display : off - this.showHelp = false; result = 1; - break; + this.showHelp = false; } - else if (ex is SettingsException) + else if(ex is TestSourceException) { this.Output.Error(false, ex.Message); result = 1; this.showHelp = false; + break; + } else { diff --git a/src/vstest.console/CommandLine/TestSourceException.cs b/src/vstest.console/CommandLine/TestSourceException.cs new file mode 100644 index 0000000000..0cb6903b17 --- /dev/null +++ b/src/vstest.console/CommandLine/TestSourceException.cs @@ -0,0 +1,34 @@ +// 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; + + /// + /// Exception thrown by argument processors when they encounter an error with test source + /// arguments. + /// + public class TestSourceException : Exception + { + #region Constructors + + /// + /// Creates a new TestSourceException + /// + public TestSourceException() + { + } + + /// + /// Initializes with the message. + /// + /// Message for the exception. + public TestSourceException(string message) + : base(message) + { + } + + #endregion + } +} diff --git a/src/vstest.console/Internal/FilePatternParser.cs b/src/vstest.console/Internal/FilePatternParser.cs index 923a96a252..59a418420e 100644 --- a/src/vstest.console/Internal/FilePatternParser.cs +++ b/src/vstest.console/Internal/FilePatternParser.cs @@ -45,15 +45,21 @@ public List GetMatchingFiles(string filePattern) { var matchingFiles = new List(); + // Convert the relative path to absolute path + if (!Path.IsPathRooted(filePattern)) + { + filePattern = Path.Combine(this.fileHelper.GetCurrentDirectory(), filePattern); + } + // If there is no wildcard simply add the file to the list of matching files. - if(filePattern.IndexOfAny(wildCardCharacters) == -1) + if (filePattern.IndexOfAny(wildCardCharacters) == -1) { EqtTrace.Info($"FilePatternParser: The given file {filePattern} is a full path."); // Check if the file exists. if (!this.fileHelper.Exists(filePattern)) { - throw new CommandLineException( + throw new TestSourceException( string.Format(CultureInfo.CurrentUICulture, CommandLineResources.TestSourceFileNotFound, filePattern)); } diff --git a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs index 75fbae9bdc..5bddd827c4 100644 --- a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs +++ b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs @@ -373,7 +373,6 @@ private void BuildCommandMaps() throw; } } - return instance; }, System.Threading.LazyThreadSafetyMode.PublicationOnly); processor.Executor = lazyArgumentProcessor; diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index c321d4241f..3a1dc095db 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -674,7 +674,7 @@ internal class Resources { } /// - /// Looks up a localized string similar to The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options. + /// Looks up a localized string similar to The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Learn more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options. /// internal static string InvalidArgument { get { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index ffd97459e7..b992e5036f 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -729,7 +729,7 @@ Test run in progress - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Learn more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options A total of {0} test files matched the specified pattern. From 5a4be7b8eb9b24d3f5f1756f3c24fa00678e6cc1 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Wed, 21 Aug 2019 17:41:03 +0530 Subject: [PATCH 08/20] files updated for #2071 --- .../CommandLine/CommandLineOptions.cs | 13 ------------- src/vstest.console/CommandLine/Executor.cs | 9 +++------ .../Utilities/ArgumentProcessorFactory.cs | 3 +-- src/vstest.console/Resources/Resources.Designer.cs | 2 +- src/vstest.console/Resources/Resources.resx | 2 +- 5 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/vstest.console/CommandLine/CommandLineOptions.cs b/src/vstest.console/CommandLine/CommandLineOptions.cs index c4a46a8de5..0109de30c6 100644 --- a/src/vstest.console/CommandLine/CommandLineOptions.cs +++ b/src/vstest.console/CommandLine/CommandLineOptions.cs @@ -45,19 +45,6 @@ internal class CommandLineOptions /// private readonly TimeSpan DefaultRetrievalTimeout = new TimeSpan(0, 0, 0, 1, 500); - /// - /// The supported extension types for test source - /// - public static readonly IEnumerable extnList = new List() - { - ".xap" , - ".appx" , - ".dll", - ".exe", - ".appxrecipe" - }; - - #endregion #region PrivateMembers diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index ee64958e30..da9723ec66 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -30,7 +30,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine using System.Globalization; using System.IO; using System.Linq; - using System.Threading; using Microsoft.VisualStudio.TestPlatform.CommandLine.Internal; using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors; using Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers; @@ -170,7 +169,7 @@ internal int Execute(params string[] args) /// 0 if all of the processors were created successfully and 1 otherwise. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "processorInstance", Justification = "Done on purpose to force the instances to be created")] private int GetArgumentProcessors(string[] args, out List processors) - { + { processors = new List(); int result = 0; var processorFactory = ArgumentProcessorFactory.Create(); @@ -183,7 +182,7 @@ private int GetArgumentProcessors(string[] args, out List pr var cliRunSettingsProcessor = processorFactory.CreateArgumentProcessor(arg, args.Skip(index + 1).ToArray()); processors.Add(cliRunSettingsProcessor); break; - } + } var processor = processorFactory.CreateArgumentProcessor(arg); if (processor != null) @@ -219,7 +218,7 @@ private int GetArgumentProcessors(string[] args, out List pr // Instantiate and initialize the processors in priority order. processors.Sort((p1, p2) => Comparer.Default.Compare(p1.Metadata.Value.Priority, p2.Metadata.Value.Priority)); foreach (var processor in processors) - { + { IArgumentExecutor executorInstance; try { @@ -380,10 +379,8 @@ private void PrintSplashScreen() { string assemblyVersion = string.Empty; assemblyVersion = Product.Version; - string commandLineBanner = string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MicrosoftCommandLineTitle, assemblyVersion); this.Output.WriteLine(commandLineBanner, OutputLevel.Information); - this.Output.WriteLine(CommandLineResources.CopyrightCommandLineTitle, OutputLevel.Information); this.Output.WriteLine(string.Empty, OutputLevel.Information); } diff --git a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs index 5bddd827c4..2c5d41a3b3 100644 --- a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs +++ b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs @@ -157,8 +157,7 @@ public IArgumentProcessor CreateArgumentProcessor(string argument) argumentProcessor = WrapLazyProcessorToInitializeOnInstantiation(argumentProcessor, pair.Argument); } - return argumentProcessor; - + return argumentProcessor; } /// diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 3a1dc095db..04393581bc 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -674,7 +674,7 @@ internal class Resources { } /// - /// Looks up a localized string similar to The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Learn more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options. + /// Looks up a localized string similar to The argument {0} is invalid. Please use the /help option to check the list of valid arguments.. /// internal static string InvalidArgument { get { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index b992e5036f..33cf76e005 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -729,7 +729,7 @@ Test run in progress - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Learn more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. A total of {0} test files matched the specified pattern. From 66ddf7921a4a412506ecce39363450cfa4f7e5e5 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Wed, 21 Aug 2019 18:52:30 +0530 Subject: [PATCH 09/20] files updated for #2071 --- src/vstest.console/Resources/xlf/Resources.cs.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.de.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.es.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.fr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.it.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ja.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ko.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pl.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pt-BR.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ru.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.tr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 11bd49c08f..c094e4a75c 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1646,7 +1646,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index c0d8f44439..f582a14177 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1646,7 +1646,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index b630b948de..dfa348424f 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1648,7 +1648,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index ffc906ecc0..f67158598b 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1646,7 +1646,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 36e5c704be..22af860eec 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1646,7 +1646,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 3f971150a0..fab5f55f46 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1646,7 +1646,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index a8257d69c3..84ef7421a6 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1646,7 +1646,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index 9590005bcb..a4703fa52c 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1646,7 +1646,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index aa69169aa7..9c97888fde 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1646,7 +1646,7 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index fda1857d6b..159789e42d 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1646,7 +1646,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index d26a7c357b..1a519c8491 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1646,7 +1646,7 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index 4008f52285..a2cc4ccdf1 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -838,7 +838,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 363e6650a4..c4ccc43695 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1645,7 +1645,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 3cb5164df3..5d0db88948 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1647,7 +1647,7 @@ - The argument {0} provided is incorrect or invalid. Kindly use /help option to check the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options From 9560ae0e02210284d3cfd9363578fec03e7e7130 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Wed, 21 Aug 2019 19:32:56 +0530 Subject: [PATCH 10/20] unit tests files updated for #2071 --- .../CommandLine/CommandLineOptionsTests.cs | 6 ++++-- test/vstest.console.UnitTests/ExecutorUnitTests.cs | 2 +- .../Internal/FilePatternParserTests.cs | 5 ++++- .../Processors/TestSourceArgumentProcessorTests.cs | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs b/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs index 458ce9a5a5..76c8ce8940 100644 --- a/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs +++ b/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs @@ -64,7 +64,8 @@ public void CommandLineOptionsGetForHasPhoneContextPropertyIfTargetDeviceIsSetRe [TestMethod] public void CommandLineOptionsAddSourceShouldThrowCommandLineExceptionForNullSource() { - Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource(null)); + //Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource(null)); + Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource(null)); } [TestMethod] @@ -82,7 +83,8 @@ public void CommandLineOptionsAddSourceShouldConvertRelativePathToAbsolutePath() [TestMethod] public void CommandLineOptionsAddSourceShouldThrowCommandLineExceptionForInvalidSource() { - Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource("DummySource")); + //Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource("DummySource")); + Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource("DummySource")); } [TestMethod] diff --git a/test/vstest.console.UnitTests/ExecutorUnitTests.cs b/test/vstest.console.UnitTests/ExecutorUnitTests.cs index 047a93ecde..9e217092e3 100644 --- a/test/vstest.console.UnitTests/ExecutorUnitTests.cs +++ b/test/vstest.console.UnitTests/ExecutorUnitTests.cs @@ -131,7 +131,7 @@ public void ExecutorWithInvalidArgsShouldPrintErrorMessage() Assert.AreEqual(1, exitCode, "Exit code must be One when no arguments are provided."); - Assert.IsTrue(mockOutput.Messages.Any(message => message.Message.Contains(string.Format(CommandLineResources.TestSourceFileNotFound, badArg)))); + Assert.IsTrue(mockOutput.Messages.Any(message => message.Message.Contains(string.Format(CommandLineResources.InvalidArgument, badArg)))); } /// diff --git a/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs b/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs index 7117a7f0ac..f20e833e45 100644 --- a/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs +++ b/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs @@ -107,7 +107,10 @@ public void FilePatternParserShouldThrowCommandLineExceptionIfFileDoesNotExist() this.mockFileHelper.Setup(x => x.Exists(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")).Returns(false); this.mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - Assert.ThrowsException(() => this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); + //Assert.ThrowsException(() => this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); + Assert.ThrowsException(() => this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); } + + } } diff --git a/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs index bf3fcb4f88..81ab6cc1d4 100644 --- a/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs @@ -79,7 +79,8 @@ public void ExecuterInitializeWithInvalidSourceShouldThrowCommandLineException() } catch (Exception ex) { - Assert.IsTrue(ex is CommandLineException); + //Assert.IsTrue(ex is CommandLineException); + Assert.IsTrue(ex is TestSourceException); Assert.AreEqual("The test source file \"" + testFilePath + "\" provided was not found.", ex.Message); } } From e8af79c0dd453d9002b5af294e43df9a1ccdf0b4 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Thu, 22 Aug 2019 15:09:40 +0530 Subject: [PATCH 11/20] unit tests files updated for #2071 --- .../ArgumentProcessorTests.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs index a355495998..c3df8c5526 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs @@ -31,7 +31,7 @@ public void PassingNoArgumentsToVsTestConsoleShouldPrintHelpMessage(RunnerInfo r [TestMethod] [NetFullTargetFrameworkDataSource] - public void PassingInvalidArgumentsToVsTestConsoleShouldPrintHelpMessage(RunnerInfo runnerInfo) + public void PassingInvalidArgumentsToVsTestConsoleShouldNotPrintHelpMessage(RunnerInfo runnerInfo) { AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); @@ -41,15 +41,15 @@ public void PassingInvalidArgumentsToVsTestConsoleShouldPrintHelpMessage(RunnerI this.InvokeVsTest(arguments); //Check for help usage, description and arguments text. - this.StdOutputContains("Usage: vstest.console.exe"); - this.StdOutputContains("Description: Runs tests from the specified files."); - this.StdOutputContains("Arguments:"); + this.StdOutputDoesNotContains("Usage: vstest.console.exe"); + this.StdOutputDoesNotContains("Description: Runs tests from the specified files."); + this.StdOutputDoesNotContains("Arguments:"); //Check for help options text - this.StdOutputContains("Options:"); + this.StdOutputDoesNotContains("Options:"); //Check for help examples text - this.StdOutputContains("To run tests: >vstest.console.exe tests.dll"); - } + this.StdOutputDoesNotContains("To run tests: >vstest.console.exe tests.dll"); + } } } From 13da2db6c0bd9aa13527cd469ddfa8e96da031af Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Thu, 22 Aug 2019 15:32:51 +0530 Subject: [PATCH 12/20] unit tests files updated for #2071 --- .../ArgumentProcessorTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs index c3df8c5526..8e57d3aa0b 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs @@ -49,7 +49,7 @@ public void PassingInvalidArgumentsToVsTestConsoleShouldNotPrintHelpMessage(Runn this.StdOutputDoesNotContains("Options:"); //Check for help examples text - this.StdOutputDoesNotContains("To run tests: >vstest.console.exe tests.dll"); - } + this.StdOutputDoesNotContains("To run tests: >vstest.console.exe tests.dll"); + } } } From d94f22c4a25e4548b3d171202274424df69b14d4 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Fri, 23 Aug 2019 11:29:23 +0530 Subject: [PATCH 13/20] committing .xlf files and modified tests code files #2071 --- src/vstest.console/Resources/xlf/Resources.cs.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.de.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.es.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.fr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.it.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ja.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ko.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pl.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pt-BR.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ru.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.tr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf | 2 +- .../ArgumentProcessorTests.cs | 1 + .../CommandLine/CommandLineOptionsTests.cs | 2 -- .../Internal/FilePatternParserTests.cs | 5 +---- .../Processors/TestSourceArgumentProcessorTests.cs | 1 - 18 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index c094e4a75c..a3119daecc 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index f582a14177..5817c4f11a 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index dfa348424f..72d8ba922a 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1649,7 +1649,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index f67158598b..ae7a13278e 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 22af860eec..48ba702c82 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index fab5f55f46..7d24924f50 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 84ef7421a6..d3a464dc2b 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index a4703fa52c..141eff8df0 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 9c97888fde..572df84f4e 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1647,7 +1647,7 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index 159789e42d..f774c26967 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 1a519c8491..4373d353a5 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1647,7 +1647,7 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index a2cc4ccdf1..ba252597b1 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -839,7 +839,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index c4ccc43695..00b14e046f 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1646,7 +1646,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 5d0db88948..cb6ee42a0f 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1648,7 +1648,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} . Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs index 8e57d3aa0b..70c8a3d582 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs @@ -51,5 +51,6 @@ public void PassingInvalidArgumentsToVsTestConsoleShouldNotPrintHelpMessage(Runn //Check for help examples text this.StdOutputDoesNotContains("To run tests: >vstest.console.exe tests.dll"); } + } } diff --git a/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs b/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs index 76c8ce8940..aab762a707 100644 --- a/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs +++ b/test/vstest.console.UnitTests/CommandLine/CommandLineOptionsTests.cs @@ -64,7 +64,6 @@ public void CommandLineOptionsGetForHasPhoneContextPropertyIfTargetDeviceIsSetRe [TestMethod] public void CommandLineOptionsAddSourceShouldThrowCommandLineExceptionForNullSource() { - //Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource(null)); Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource(null)); } @@ -83,7 +82,6 @@ public void CommandLineOptionsAddSourceShouldConvertRelativePathToAbsolutePath() [TestMethod] public void CommandLineOptionsAddSourceShouldThrowCommandLineExceptionForInvalidSource() { - //Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource("DummySource")); Assert.ThrowsException(() => CommandLineOptions.Instance.AddSource("DummySource")); } diff --git a/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs b/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs index f20e833e45..9d38cd2370 100644 --- a/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs +++ b/test/vstest.console.UnitTests/Internal/FilePatternParserTests.cs @@ -106,11 +106,8 @@ public void FilePatternParserShouldThrowCommandLineExceptionIfFileDoesNotExist() var patternMatchingResult = new PatternMatchingResult(new List()); this.mockFileHelper.Setup(x => x.Exists(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")).Returns(false); this.mockMatcherHelper.Setup(x => x.Execute(It.IsAny())).Returns(patternMatchingResult); - - //Assert.ThrowsException(() => this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); + Assert.ThrowsException(() => this.filePatternParser.GetMatchingFiles(@"E:\path\to\project\tests\Blame.Tests\\abc.Tests.dll")); } - - } } diff --git a/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs index 81ab6cc1d4..31dfc9b1b6 100644 --- a/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs @@ -79,7 +79,6 @@ public void ExecuterInitializeWithInvalidSourceShouldThrowCommandLineException() } catch (Exception ex) { - //Assert.IsTrue(ex is CommandLineException); Assert.IsTrue(ex is TestSourceException); Assert.AreEqual("The test source file \"" + testFilePath + "\" provided was not found.", ex.Message); } From 315749bb0a209ec5853115d76ec0537ba63c7f51 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Fri, 23 Aug 2019 16:09:49 +0530 Subject: [PATCH 14/20] add new test in ArgumentProcessortests file #2071 --- .../ArgumentProcessorTests.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs index 70c8a3d582..aa0e91f01a 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs @@ -50,7 +50,25 @@ public void PassingInvalidArgumentsToVsTestConsoleShouldNotPrintHelpMessage(Runn //Check for help examples text this.StdOutputDoesNotContains("To run tests: >vstest.console.exe tests.dll"); + + //Check for message which guides using help option + this.StdErrorContains("Please use the /help option to check the list of valid arguments"); + } + + [TestMethod] + [NetFullTargetFrameworkDataSource] + public void PassingInvalidArgumentsToVsTestConsoleShouldPrintHowToUseHelpMessage(RunnerInfo runnerInfo) + { + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + + var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue); + arguments = string.Concat(arguments, " /badArgument"); + + this.InvokeVsTest(arguments); + + //Check for message which guides using help option + this.StdErrorContains("Please use the /help option to check the list of valid arguments"); } - + } } From ee68f86f4e8d3899de5d4838863aa91277df8dca Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Fri, 23 Aug 2019 16:13:18 +0530 Subject: [PATCH 15/20] updated new test in ArgumentProcessortests file #2071 --- .../ArgumentProcessorTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs index aa0e91f01a..9edd0b1b48 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs @@ -69,6 +69,5 @@ public void PassingInvalidArgumentsToVsTestConsoleShouldPrintHowToUseHelpMessage //Check for message which guides using help option this.StdErrorContains("Please use the /help option to check the list of valid arguments"); } - } } From 3499be7c1138e508ecfaf9b1c1b5dc887b5dc321 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Fri, 23 Aug 2019 17:30:01 +0530 Subject: [PATCH 16/20] updated .xlf files #2071 --- src/vstest.console/Resources/xlf/Resources.cs.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.de.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.es.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.fr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.it.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ja.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ko.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pl.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.pt-BR.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.ru.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.tr.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf | 2 +- src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index a3119daecc..b2d1099d2a 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 5817c4f11a..88eae6ab25 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 72d8ba922a..99601c1aa7 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1649,7 +1649,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index ae7a13278e..79a68798c1 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index 48ba702c82..e075c7e0b3 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index 7d24924f50..64aeb627cb 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index d3a464dc2b..0dc37a7a8a 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index 141eff8df0..bd579004d1 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index 572df84f4e..56cec39def 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1647,7 +1647,7 @@ Altere o prefixo de nível de diagnóstico do agente de console, como mostrado a The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index f774c26967..4736cb8b5b 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1647,7 +1647,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 4373d353a5..711c922e7b 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1647,7 +1647,7 @@ Günlükler için izleme düzeyini aşağıda gösterildiği gibi değiştirin The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 00b14e046f..79f7de3f84 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1646,7 +1646,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index cb6ee42a0f..ed03b3bfa7 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1648,7 +1648,7 @@ The argument {0} is invalid. Please use the /help option to check the list of valid arguments. - The given argument {0} .Kindly use /help option to know more about the valid args. Know more at : https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options + The argument {0} is invalid. Please use the /help option to check the list of valid arguments. From 262e88b5bff986cc0cdecf095fcbe583097e6593 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Tue, 27 Aug 2019 15:18:42 +0530 Subject: [PATCH 17/20] added new tests for - and /badArg:abc scenarios #2071 --- src/vstest.console/CommandLine/Executor.cs | 1 - .../ArgumentProcessorTests.cs | 30 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index da9723ec66..e999e552ec 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -240,7 +240,6 @@ private int GetArgumentProcessors(string[] args, out List pr result = 1; this.showHelp = false; break; - } else { diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs index 9edd0b1b48..75b91dbd18 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs @@ -69,5 +69,35 @@ public void PassingInvalidArgumentsToVsTestConsoleShouldPrintHowToUseHelpMessage //Check for message which guides using help option this.StdErrorContains("Please use the /help option to check the list of valid arguments"); } + + [TestMethod] + [NetFullTargetFrameworkDataSource] + public void PassingInvalidArgumentWithPrefixToVsTestConsoleShouldPrintHowToUseHelpMessage(RunnerInfo runnerInfo) + { + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + + var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue); + arguments = string.Concat(arguments, "-"); + + this.InvokeVsTest(arguments); + + //Check for message which guides using help option + this.StdErrorContains("Please use the /help option to check the list of valid arguments"); + } + + [TestMethod] + [NetFullTargetFrameworkDataSource] + public void PassingInvalidArgumentWithAValueToVsTestConsoleShouldPrintHowToUseHelpMessage(RunnerInfo runnerInfo) + { + AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); + + var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue); + arguments = string.Concat(arguments, "/badArgument:abc"); + + this.InvokeVsTest(arguments); + + //Check for message which guides using help option + this.StdErrorContains("Please use the /help option to check the list of valid arguments"); + } } } From 412ce03fa33af8e3700cabf0cb457f5d8c6bcbb6 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Tue, 27 Aug 2019 17:29:57 +0530 Subject: [PATCH 18/20] test fix --- .../ArgumentProcessorTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs index 75b91dbd18..c7b2595966 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs @@ -77,7 +77,7 @@ public void PassingInvalidArgumentWithPrefixToVsTestConsoleShouldPrintHowToUseHe AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue); - arguments = string.Concat(arguments, "-"); + arguments = string.Concat(arguments, " -"); this.InvokeVsTest(arguments); @@ -92,7 +92,7 @@ public void PassingInvalidArgumentWithAValueToVsTestConsoleShouldPrintHowToUseHe AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue); - arguments = string.Concat(arguments, "/badArgument:abc"); + arguments = string.Concat(arguments, " /badArgument:abc"); this.InvokeVsTest(arguments); From cac6ca6d82aead175bce20ac863dc8d7c7925c73 Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Fri, 30 Aug 2019 12:47:33 +0530 Subject: [PATCH 19/20] Committing #2071 unit tests --- .../ExecutorUnitTests.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/vstest.console.UnitTests/ExecutorUnitTests.cs b/test/vstest.console.UnitTests/ExecutorUnitTests.cs index 9e217092e3..2de09f151c 100644 --- a/test/vstest.console.UnitTests/ExecutorUnitTests.cs +++ b/test/vstest.console.UnitTests/ExecutorUnitTests.cs @@ -134,6 +134,30 @@ public void ExecutorWithInvalidArgsShouldPrintErrorMessage() Assert.IsTrue(mockOutput.Messages.Any(message => message.Message.Contains(string.Format(CommandLineResources.InvalidArgument, badArg)))); } + [TestMethod] + public void ExecutorWithInvalidArgsShouldPrintHowToUseHelpOption() + { + var mockOutput = new MockOutput(); + string badArg = "--invalidArg"; + var exitCode = new Executor(mockOutput, this.mockTestPlatformEventSource.Object).Execute(badArg); + + Assert.AreEqual(1, exitCode, "Exit code must be One when no arguments are provided."); + + Assert.IsTrue(mockOutput.Messages.Any(message => message.Message.Contains(string.Format(CommandLineResources.InvalidArgument, badArg)))); + } + + [TestMethod] + public void ExecutorWithInvalidArgsAndValueShouldPrintErrorMessage() + { + var mockOutput = new MockOutput(); + string badArg = "--invalidArg:xyz"; + var exitCode = new Executor(mockOutput, this.mockTestPlatformEventSource.Object).Execute(badArg); + + Assert.AreEqual(1, exitCode, "Exit code must be One when no arguments are provided."); + + Assert.IsTrue(mockOutput.Messages.Any(message => message.Message.Contains(string.Format(CommandLineResources.InvalidArgument, badArg)))); + } + /// /// Executor should set default runsettings value even there is no processor /// From e66327a7cfb1f4f462346ff589e8438712c9040a Mon Sep 17 00:00:00 2001 From: DineshChirnanchu Date: Fri, 30 Aug 2019 12:55:49 +0530 Subject: [PATCH 20/20] Removed #2071 tests from Acceptance Test --- .../ArgumentProcessorTests.cs | 45 ------------------- 1 file changed, 45 deletions(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs index c7b2595966..c831125b8a 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ArgumentProcessorTests.cs @@ -54,50 +54,5 @@ public void PassingInvalidArgumentsToVsTestConsoleShouldNotPrintHelpMessage(Runn //Check for message which guides using help option this.StdErrorContains("Please use the /help option to check the list of valid arguments"); } - - [TestMethod] - [NetFullTargetFrameworkDataSource] - public void PassingInvalidArgumentsToVsTestConsoleShouldPrintHowToUseHelpMessage(RunnerInfo runnerInfo) - { - AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); - - var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue); - arguments = string.Concat(arguments, " /badArgument"); - - this.InvokeVsTest(arguments); - - //Check for message which guides using help option - this.StdErrorContains("Please use the /help option to check the list of valid arguments"); - } - - [TestMethod] - [NetFullTargetFrameworkDataSource] - public void PassingInvalidArgumentWithPrefixToVsTestConsoleShouldPrintHowToUseHelpMessage(RunnerInfo runnerInfo) - { - AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); - - var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue); - arguments = string.Concat(arguments, " -"); - - this.InvokeVsTest(arguments); - - //Check for message which guides using help option - this.StdErrorContains("Please use the /help option to check the list of valid arguments"); - } - - [TestMethod] - [NetFullTargetFrameworkDataSource] - public void PassingInvalidArgumentWithAValueToVsTestConsoleShouldPrintHowToUseHelpMessage(RunnerInfo runnerInfo) - { - AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); - - var arguments = PrepareArguments(this.GetSampleTestAssembly(), this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue); - arguments = string.Concat(arguments, " /badArgument:abc"); - - this.InvokeVsTest(arguments); - - //Check for message which guides using help option - this.StdErrorContains("Please use the /help option to check the list of valid arguments"); - } } }