From c0a0705e5e7713d8361eb6127ceb18cee56384d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8F=86Nitin=20Gurram=F0=9F=8F=86?= Date: Mon, 8 Jan 2018 15:00:04 +0530 Subject: [PATCH 1/7] Adding Category to Test Category mapping for ListFullyQualifiedTests --- ...istFullyQualifiedTestsArgumentProcessor.cs | 8 ++++ ...llyQualifiedTestsArgumentProcessorTests.cs | 41 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs index a8fa98d386..7f2128651e 100644 --- a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs @@ -281,6 +281,7 @@ private class TestCaseFilter { private static TestCaseFilterExpression filterExpression; private const string TestCategory = "TestCategory"; + private const string Category = "Category"; private const string Traits = "Traits"; public TestCaseFilter() @@ -436,6 +437,13 @@ private static Dictionary> GetTraitsInTraitDictionary(Dicti } } + //This is hack for NUnit,Xunit to understand test category -> This method is called only for NUnit/Xunit + if (!traitDictionary.ContainsKey(TestCategory) && traitDictionary.ContainsKey(Category)) + { + traitDictionary.TryGetValue(Category, out var categoryValue); + traitDictionary.Add(TestCategory, categoryValue); + } + return traitDictionary; } diff --git a/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs index deca36914f..114a6481ab 100644 --- a/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs @@ -235,6 +235,22 @@ public void ExecutorExecuteShouldOutputDiscoveredTestsAndReturnSuccess() Assert.IsTrue(fileOutput.Contains("Test2")); } + [TestMethod] + public void DiscoveryShouldFilterCategoryTestsAndReturnSuccess() + { + var mockDiscoveryRequest = new Mock(); + var mockConsoleOutput = new Mock(); + + this.RunListFullyQualifiedTestArgumentProcessorWithTraits(mockDiscoveryRequest, mockConsoleOutput); + + mockDiscoveryRequest.Verify(dr => dr.DiscoverAsync(), Times.Once); + + var fileOutput = File.ReadAllLines(this.dummyFilePath); + Assert.IsTrue(fileOutput.Length == 1); + Assert.IsTrue(fileOutput.Contains("Test1")); + Assert.IsTrue(!fileOutput.Contains("Test2")); + } + [ExpectedException(typeof(CommandLineException))] [TestMethod] public void ExecutorExecuteShouldThrowWhenListFullyQualifiedTestsTargetPathIsEmpty() @@ -268,6 +284,31 @@ public void ListFullyQualifiedTestsArgumentProcessorExecuteShouldInstrumentDisco } #endregion + private void RunListFullyQualifiedTestArgumentProcessorWithTraits(Mock mockDiscoveryRequest, Mock mockConsoleOutput, bool legitPath = true) + { + var mockTestPlatform = new Mock(); + var list = new List(); + + var t1 = new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"); + t1.Traits.Add(new Trait("Category", "MyCat")); + list.Add(t1); + + var t2 = new TestCase("Test2", new Uri("http://FooTestUri2"), "Source2"); + t2.Traits.Add(new Trait("Category", "MyBat")); + list.Add(t2); + + mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); + + this.ResetAndAddSourceToCommandLineOptions(legitPath); + var cmdOptions = CommandLineOptions.Instance; + cmdOptions.TestCaseFilterValue = "TestCategory=MyCat"; + + var testRequestManager = new TestRequestManager(cmdOptions, mockTestPlatform.Object, TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + + GetExecutor(testRequestManager, mockConsoleOutput.Object).Execute(); + } + private void RunListFullyQualifiedTestArgumentProcessorExecuteWithMockSetup(Mock mockDiscoveryRequest, Mock mockConsoleOutput, bool legitPath = true) { var mockTestPlatform = new Mock(); From 437c527fea101f779064b8f565df18f4bb42a64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8F=86Nitin=20Gurram=F0=9F=8F=86?= Date: Mon, 15 Jan 2018 16:20:41 +0530 Subject: [PATCH 2/7] support for Escaping test cases with comma --- .../RunSpecificTestsArgumentProcessor.cs | 10 +- .../Processors/Utilities/StringUtilities.cs | 46 ++++++ src/vstest.console/vstest.console.csproj | 6 + .../RunSpecificTestsArgumentProcessorTests.cs | 154 +++++++++++++++++- 4 files changed, 211 insertions(+), 5 deletions(-) create mode 100644 src/vstest.console/Processors/Utilities/StringUtilities.cs diff --git a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs index 67b6667f06..5d300ef53f 100644 --- a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs @@ -12,13 +12,13 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Processors using Microsoft.VisualStudio.TestPlatform.Client.RequestHelper; using Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers; + using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.Utilities; using Microsoft.VisualStudio.TestPlatform.CommandLineUtilities; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.Utilities; - using CommandLineResources = Microsoft.VisualStudio.TestPlatform.CommandLine.Resources.Resources; internal class RunSpecificTestsArgumentProcessor : IArgumentProcessor @@ -171,7 +171,11 @@ public void Initialize(string argument) { if (!string.IsNullOrWhiteSpace(argument)) { - this.selectedTestNames = new Collection(argument.Split(new[] { CommandLineResources.SearchStringDelimiter }, StringSplitOptions.RemoveEmptyEntries)); + //todo fix the resource file + this.selectedTestNames = new Collection( + argument.Tokenize(CommandLineResources.SearchStringDelimiter.ToCharArray()[0], '\\') + .Where(x => !string.IsNullOrWhiteSpace(x)) + .Select(s => s.Trim()).ToList()); } if (this.selectedTestNames == null || this.selectedTestNames.Count <= 0) @@ -194,7 +198,7 @@ public ArgumentProcessorResult Execute() Contract.Assert(this.testRequestManager != null); Contract.Assert(!string.IsNullOrWhiteSpace(this.runSettingsManager.ActiveRunSettings.SettingsXml)); - if (this.commandLineOptions.Sources.Count() <= 0) + if (!this.commandLineOptions.Sources.Any()) { throw new CommandLineException(string.Format(CultureInfo.CurrentUICulture, CommandLineResources.MissingTestSourceFile)); } diff --git a/src/vstest.console/Processors/Utilities/StringUtilities.cs b/src/vstest.console/Processors/Utilities/StringUtilities.cs new file mode 100644 index 0000000000..a335971f87 --- /dev/null +++ b/src/vstest.console/Processors/Utilities/StringUtilities.cs @@ -0,0 +1,46 @@ +// 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.Processors.Utilities +{ + using System.Collections.Generic; + using System.Text; + + internal static class StringExtensions + { + public static IEnumerable Tokenize(this string input, char separator, char escape) + { + if (input == null) yield break; + var buffer = new StringBuilder(); + var escaping = false; + foreach (var c in input) + { + if (escaping) + { + buffer.Append(c); + escaping = false; + } + else if (c == escape) + { + escaping = true; + } + else if (c == separator) + { + yield return buffer.Flush(); + } + else + { + buffer.Append(c); + } + } + if (buffer.Length > 0 || input[input.Length - 1] == separator) yield return buffer.Flush(); + } + + public static string Flush(this StringBuilder stringBuilder) + { + var result = stringBuilder.ToString(); + stringBuilder.Clear(); + return result; + } + } +} diff --git a/src/vstest.console/vstest.console.csproj b/src/vstest.console/vstest.console.csproj index 2a319d9c57..3273917af9 100644 --- a/src/vstest.console/vstest.console.csproj +++ b/src/vstest.console/vstest.console.csproj @@ -64,5 +64,11 @@ Resources.Designer.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + + diff --git a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs index b2c2f55b87..029e0fd599 100644 --- a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs @@ -101,6 +101,51 @@ public void CapabilitiesShouldReturnAppropriateProperties() #region RunSpecificTestsArgumentExecutorTests + [TestMethod] + public void InitializeShouldThrowIfArguemntIsNull() + { + CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => { executor.Initialize(null); }); + } + + [TestMethod] + public void InitializeShouldThrowIfArgumentIsEmpty() + { + CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => { executor.Initialize(String.Empty); }); + } + + [TestMethod] + public void InitializeShouldThrowIfArgumentIsWhiteSpace() + { + CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => { executor.Initialize(" "); }); + } + + [TestMethod] + public void InitializeShouldThrowIfArgumentsAreEmpty() + { + CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => { executor.Initialize(" , "); }); + } + + [TestMethod] + public void ExecutorShouldSplitTestsSeperatedByComma() + { + CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => executor.Execute()); + } + [TestMethod] public void ExecutorExecuteForNoSourcesShouldThrowCommandLineException() { @@ -260,7 +305,6 @@ public void ExecutorExecuteShouldCatchInvalidOperationExceptionThrownDuringExecu public void ExecutorExecuteShouldForValidSourcesAndNoTestsDiscoveredShouldLogWarningAndReturnSuccess() { var mockTestPlatform = new Mock(); - var mockTestRunRequest = new Mock(); var mockDiscoveryRequest = new Mock(); this.ResetAndAddSourceToCommandLineOptions(); @@ -285,7 +329,6 @@ public void ExecutorExecuteShouldForValidSourcesAndNoTestsDiscoveredShouldLogWar public void ExecutorExecuteShouldForValidSourcesAndNoTestsDiscoveredShouldLogAppropriateWarningIfTestAdapterPathIsNotSetAndReturnSuccess() { var mockTestPlatform = new Mock(); - var mockTestRunRequest = new Mock(); var mockDiscoveryRequest = new Mock(); this.ResetAndAddSourceToCommandLineOptions(); @@ -328,6 +371,113 @@ public void ExecutorExecuteShouldForValidSourcesAndValidSelectedTestsRunsTestsAn Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); } + [TestMethod] + public void RunTestsWithCommaSeperatedTests() + { + var mockTestPlatform = new Mock(); + var mockTestRunRequest = new Mock(); + var mockDiscoveryRequest = new Mock(); + + this.ResetAndAddSourceToCommandLineOptions(); + + List list = new List(); + list.Add(new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1")); + list.Add(new TestCase("Test2", new Uri("http://FooTestUri1"), "Source1")); + mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); + + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); + + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + var executor = GetExecutor(testRequestManager); + + executor.Initialize("Test1, Test2"); + + ArgumentProcessorResult argumentProcessorResult = executor.Execute(); + this.mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); + Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); + } + + [TestMethod] + public void RunTestsWithFilteredTest() + { + var mockTestPlatform = new Mock(); + var mockTestRunRequest = new Mock(); + var mockDiscoveryRequest = new Mock(); + + this.ResetAndAddSourceToCommandLineOptions(); + + List list = new List(); + list.Add(new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1")); + list.Add(new TestCase("Test2", new Uri("http://FooTestUri1"), "Source1")); + mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); + + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); + + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + var executor = GetExecutor(testRequestManager); + + executor.Initialize("Test1"); + + ArgumentProcessorResult argumentProcessorResult = executor.Execute(); + this.mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); + Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); + } + + [TestMethod] + public void RunTestsWithNonAvailableTest() + { + var mockTestPlatform = new Mock(); + var mockTestRunRequest = new Mock(); + var mockDiscoveryRequest = new Mock(); + + this.ResetAndAddSourceToCommandLineOptions(); + + List list = new List(); + list.Add(new TestCase("Test2", new Uri("http://FooTestUri1"), "Source1")); + mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); + + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); + + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + var executor = GetExecutor(testRequestManager); + + executor.Initialize("Test1, Test2"); + + ArgumentProcessorResult argumentProcessorResult = executor.Execute(); + this.mockOutput.Verify(o => o.WriteLine("A total of 1 tests were discovered but some tests do not match the specified selection criteria(Test1). Use right value(s) and try again.", OutputLevel.Warning), Times.Once); + Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); + } + + [TestMethod] + public void RunTestsWithEscapedCommaTests() + { + var mockTestPlatform = new Mock(); + var mockTestRunRequest = new Mock(); + var mockDiscoveryRequest = new Mock(); + + this.ResetAndAddSourceToCommandLineOptions(); + + List list = new List(); + list.Add(new TestCase("Test1(a,b)", new Uri("http://FooTestUri1"), "Source1")); + list.Add(new TestCase("Test2(c,d)", new Uri("http://FooTestUri1"), "Source1")); + mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); + + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); + + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); + var executor = GetExecutor(testRequestManager); + + executor.Initialize("Test1(a\\,b), Test2(c\\,d)"); + + ArgumentProcessorResult argumentProcessorResult = executor.Execute(); + this.mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); + Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); + } + #endregion private void ResetAndAddSourceToCommandLineOptions() From da0b940e4b9e6cc9a61b3ea1d0869182ede82b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8F=86Nitin=20Gurram=F0=9F=8F=86?= Date: Mon, 15 Jan 2018 16:28:23 +0530 Subject: [PATCH 3/7] Fix project --- src/vstest.console/vstest.console.csproj | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/vstest.console/vstest.console.csproj b/src/vstest.console/vstest.console.csproj index 3273917af9..2a319d9c57 100644 --- a/src/vstest.console/vstest.console.csproj +++ b/src/vstest.console/vstest.console.csproj @@ -64,11 +64,5 @@ Resources.Designer.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - - From 41c4aeb7cc2afa58fed003a423f4607e37364eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8F=86Nitin=20Gurram=F0=9F=8F=86?= Date: Wed, 17 Jan 2018 12:58:19 +0530 Subject: [PATCH 4/7] UTs --- .../StringUtilities.cs | 8 +- .../RunSpecificTestsArgumentProcessor.cs | 6 +- ...ft.TestPlatform.Utilities.UnitTests.csproj | 2 +- .../StringUtilitiesTests.cs | 82 +++++++++++++++++++ 4 files changed, 91 insertions(+), 7 deletions(-) rename src/{vstest.console/Processors/Utilities => Microsoft.TestPlatform.Utilities}/StringUtilities.cs (83%) create mode 100644 test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs diff --git a/src/vstest.console/Processors/Utilities/StringUtilities.cs b/src/Microsoft.TestPlatform.Utilities/StringUtilities.cs similarity index 83% rename from src/vstest.console/Processors/Utilities/StringUtilities.cs rename to src/Microsoft.TestPlatform.Utilities/StringUtilities.cs index a335971f87..157641f551 100644 --- a/src/vstest.console/Processors/Utilities/StringUtilities.cs +++ b/src/Microsoft.TestPlatform.Utilities/StringUtilities.cs @@ -1,16 +1,16 @@ // 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.Processors.Utilities +namespace Microsoft.VisualStudio.TestPlatform.Utilities { using System.Collections.Generic; using System.Text; - internal static class StringExtensions + public static class StringExtensions { public static IEnumerable Tokenize(this string input, char separator, char escape) { - if (input == null) yield break; + if (string.IsNullOrEmpty(input)) yield break; var buffer = new StringBuilder(); var escaping = false; foreach (var c in input) @@ -36,7 +36,7 @@ public static IEnumerable Tokenize(this string input, char separator, ch if (buffer.Length > 0 || input[input.Length - 1] == separator) yield return buffer.Flush(); } - public static string Flush(this StringBuilder stringBuilder) + private static string Flush(this StringBuilder stringBuilder) { var result = stringBuilder.ToString(); stringBuilder.Clear(); diff --git a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs index 5d300ef53f..c8a5950a6a 100644 --- a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs @@ -83,6 +83,9 @@ internal class RunSpecificTestsArgumentProcessorCapabilities : BaseArgumentProce internal class RunSpecificTestsArgumentExecutor : IArgumentExecutor { + public const char SplitDelimeter = ','; + public const char EscapeDelimeter = '\\'; + #region Fields /// @@ -171,9 +174,8 @@ public void Initialize(string argument) { if (!string.IsNullOrWhiteSpace(argument)) { - //todo fix the resource file this.selectedTestNames = new Collection( - argument.Tokenize(CommandLineResources.SearchStringDelimiter.ToCharArray()[0], '\\') + argument.Tokenize(SplitDelimeter, EscapeDelimeter) .Where(x => !string.IsNullOrWhiteSpace(x)) .Select(s => s.Trim()).ToList()); } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj b/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj index ea1b89bd3d..d7c8387596 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj @@ -7,7 +7,7 @@ Exe - netcoreapp1.0;net451 + net451;netcoreapp1.0 Microsoft.TestPlatform.Utilities.UnitTests diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs new file mode 100644 index 0000000000..657dbed54d --- /dev/null +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Linq; + +namespace Microsoft.TestPlatform.Utilities.UnitTests +{ + using Castle.Core.Internal; + using Microsoft.VisualStudio.TestPlatform.Utilities; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class StringUtilitiesTests + { + [TestMethod] + public void EmptyNullStringShouldNotSplit() + { + var argsList = string.Empty.Tokenize(SplitChar, EscapeChar); + Assert.IsTrue(argsList.IsNullOrEmpty()); + } + + [TestMethod] + public void SplitStringDoesntContainSplitChar() + { + var data = "foobar"; + var argsList = data.Tokenize(SplitChar, EscapeChar); + var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 1); + Assert.IsTrue(enumerable.First().Equals(data)); + } + + [TestMethod] + public void SplitStringSplitsBySplitChar() + { + var data = "foo,bar"; + var argsList = data.Tokenize(SplitChar, EscapeChar); + var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 2); + } + + [TestMethod] + public void SplitStringSplitsBySplitCharWithStartEnd() + { + var data = ",foo,bar,"; + var argsList = data.Tokenize(SplitChar, EscapeChar); + var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 4); + } + + [TestMethod] + public void SplitStringSplitsWithEscapedChar() + { + var data = "foo\\,bar"; + var argsList = data.Tokenize(SplitChar, EscapeChar); + var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 1); + Assert.IsTrue(enumerable.First().Equals("foo,bar")); + } + + [TestMethod] + public void SplitStringSplitsWithEscapedCharWithSeperator() + { + var data = "foo\\,,bar"; + var argsList = data.Tokenize(SplitChar, EscapeChar); + var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 2); + Assert.IsTrue(enumerable.First().Equals("foo,")); + } + + [TestMethod] + public void SplitStringOnlyWithSplitChar() + { + var data = ","; + var argsList = data.Tokenize(SplitChar, EscapeChar); + var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 2); + } + + private const char SplitChar = ','; + private const char EscapeChar = '\\'; + } +} From 1b7279f941b506fa8240561948a0a770d69e3faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8F=86Nitin=20Gurram=F0=9F=8F=86?= Date: Wed, 17 Jan 2018 13:00:36 +0530 Subject: [PATCH 5/7] UTs --- .../StringUtilitiesTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs index 657dbed54d..69252c3c38 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs @@ -76,6 +76,15 @@ public void SplitStringOnlyWithSplitChar() Assert.IsTrue(enumerable.Length == 2); } + [TestMethod] + public void SplitStringOnlyWithEscapeCharOnly() + { + var data = "foo\\bar"; + var argsList = data.Tokenize(SplitChar, EscapeChar); + var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 1); + } + private const char SplitChar = ','; private const char EscapeChar = '\\'; } From c341a562651a80a751311142a930f532e936499f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8F=86Nitin=20Gurram=F0=9F=8F=86?= Date: Wed, 17 Jan 2018 14:30:26 +0530 Subject: [PATCH 6/7] review comments --- .../StringUtilities.cs | 1 + .../StringUtilitiesTests.cs | 23 +++++---- .../RunSpecificTestsArgumentProcessorTests.cs | 48 ++++++++++++------- 3 files changed, 46 insertions(+), 26 deletions(-) diff --git a/src/Microsoft.TestPlatform.Utilities/StringUtilities.cs b/src/Microsoft.TestPlatform.Utilities/StringUtilities.cs index 157641f551..f71f809976 100644 --- a/src/Microsoft.TestPlatform.Utilities/StringUtilities.cs +++ b/src/Microsoft.TestPlatform.Utilities/StringUtilities.cs @@ -11,6 +11,7 @@ public static class StringExtensions public static IEnumerable Tokenize(this string input, char separator, char escape) { if (string.IsNullOrEmpty(input)) yield break; + var buffer = new StringBuilder(); var escaping = false; foreach (var c in input) diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs index 69252c3c38..c285f3a155 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/StringUtilitiesTests.cs @@ -13,52 +13,57 @@ namespace Microsoft.TestPlatform.Utilities.UnitTests public class StringUtilitiesTests { [TestMethod] - public void EmptyNullStringShouldNotSplit() + public void SplitShouldReturnWhenStringisNullOrEmpty() { var argsList = string.Empty.Tokenize(SplitChar, EscapeChar); + Assert.IsTrue(argsList.IsNullOrEmpty()); } [TestMethod] - public void SplitStringDoesntContainSplitChar() + public void SplitShouldReturnWhenStringDoesntContainSplitChar() { var data = "foobar"; var argsList = data.Tokenize(SplitChar, EscapeChar); var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 1); Assert.IsTrue(enumerable.First().Equals(data)); } [TestMethod] - public void SplitStringSplitsBySplitChar() + public void SplitShouldSplitWhenStringContainsSplitChar() { var data = "foo,bar"; var argsList = data.Tokenize(SplitChar, EscapeChar); var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 2); } [TestMethod] - public void SplitStringSplitsBySplitCharWithStartEnd() + public void SplitShouldSplitWhenStringWithSplitCharStartEnd() { var data = ",foo,bar,"; var argsList = data.Tokenize(SplitChar, EscapeChar); var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 4); } [TestMethod] - public void SplitStringSplitsWithEscapedChar() + public void SplitShouldEscapeSplitCharWhenEscapedCharPresent() { var data = "foo\\,bar"; var argsList = data.Tokenize(SplitChar, EscapeChar); var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 1); Assert.IsTrue(enumerable.First().Equals("foo,bar")); } [TestMethod] - public void SplitStringSplitsWithEscapedCharWithSeperator() + public void SplitShouldEscapeSplitCharWhenEscapedNonEscapedCharPresent() { var data = "foo\\,,bar"; var argsList = data.Tokenize(SplitChar, EscapeChar); @@ -68,20 +73,22 @@ public void SplitStringSplitsWithEscapedCharWithSeperator() } [TestMethod] - public void SplitStringOnlyWithSplitChar() + public void SplitShouldSplitWhenOnlySplitCharPresent() { var data = ","; var argsList = data.Tokenize(SplitChar, EscapeChar); var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 2); } [TestMethod] - public void SplitStringOnlyWithEscapeCharOnly() + public void SplitShouldNotSplitWhenNoSplitCharPresent() { var data = "foo\\bar"; var argsList = data.Tokenize(SplitChar, EscapeChar); var enumerable = argsList as string[] ?? argsList.ToArray(); + Assert.IsTrue(enumerable.Length == 1); } diff --git a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs index 029e0fd599..77541f6249 100644 --- a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs @@ -102,11 +102,13 @@ public void CapabilitiesShouldReturnAppropriateProperties() #region RunSpecificTestsArgumentExecutorTests [TestMethod] - public void InitializeShouldThrowIfArguemntIsNull() + public void InitializeShouldThrowIfArgumentIsNull() { CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => { executor.Initialize(null); }); } @@ -114,8 +116,10 @@ public void InitializeShouldThrowIfArguemntIsNull() public void InitializeShouldThrowIfArgumentIsEmpty() { CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => { executor.Initialize(String.Empty); }); } @@ -123,8 +127,10 @@ public void InitializeShouldThrowIfArgumentIsEmpty() public void InitializeShouldThrowIfArgumentIsWhiteSpace() { CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => { executor.Initialize(" "); }); } @@ -132,8 +138,10 @@ public void InitializeShouldThrowIfArgumentIsWhiteSpace() public void InitializeShouldThrowIfArgumentsAreEmpty() { CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => { executor.Initialize(" , "); }); } @@ -141,8 +149,10 @@ public void InitializeShouldThrowIfArgumentsAreEmpty() public void ExecutorShouldSplitTestsSeperatedByComma() { CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => executor.Execute()); } @@ -150,8 +160,10 @@ public void ExecutorShouldSplitTestsSeperatedByComma() public void ExecutorExecuteForNoSourcesShouldThrowCommandLineException() { CommandLineOptions.Instance.Reset(); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); + Assert.ThrowsException(() => executor.Execute()); } @@ -372,13 +384,13 @@ public void ExecutorExecuteShouldForValidSourcesAndValidSelectedTestsRunsTestsAn } [TestMethod] - public void RunTestsWithCommaSeperatedTests() + public void ExecutorShouldRunTestsWhenTestsAreCommaSeperated() { var mockTestPlatform = new Mock(); var mockTestRunRequest = new Mock(); var mockDiscoveryRequest = new Mock(); - this.ResetAndAddSourceToCommandLineOptions(); + ResetAndAddSourceToCommandLineOptions(); List list = new List(); list.Add(new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1")); @@ -390,22 +402,22 @@ public void RunTestsWithCommaSeperatedTests() var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); - + executor.Initialize("Test1, Test2"); - ArgumentProcessorResult argumentProcessorResult = executor.Execute(); - this.mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); + + mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); } [TestMethod] - public void RunTestsWithFilteredTest() + public void ExecutorShouldRunTestsWhenTestsAreFiltered() { var mockTestPlatform = new Mock(); var mockTestRunRequest = new Mock(); var mockDiscoveryRequest = new Mock(); - this.ResetAndAddSourceToCommandLineOptions(); + ResetAndAddSourceToCommandLineOptions(); List list = new List(); list.Add(new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1")); @@ -419,20 +431,20 @@ public void RunTestsWithFilteredTest() var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); - ArgumentProcessorResult argumentProcessorResult = executor.Execute(); - this.mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); + + mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); } [TestMethod] - public void RunTestsWithNonAvailableTest() + public void ExecutorShouldWarnWhenTestsAreNotAvailable() { var mockTestPlatform = new Mock(); var mockTestRunRequest = new Mock(); var mockDiscoveryRequest = new Mock(); - this.ResetAndAddSourceToCommandLineOptions(); + ResetAndAddSourceToCommandLineOptions(); List list = new List(); list.Add(new TestCase("Test2", new Uri("http://FooTestUri1"), "Source1")); @@ -445,20 +457,20 @@ public void RunTestsWithNonAvailableTest() var executor = GetExecutor(testRequestManager); executor.Initialize("Test1, Test2"); - ArgumentProcessorResult argumentProcessorResult = executor.Execute(); - this.mockOutput.Verify(o => o.WriteLine("A total of 1 tests were discovered but some tests do not match the specified selection criteria(Test1). Use right value(s) and try again.", OutputLevel.Warning), Times.Once); + + mockOutput.Verify(o => o.WriteLine("A total of 1 tests were discovered but some tests do not match the specified selection criteria(Test1). Use right value(s) and try again.", OutputLevel.Warning), Times.Once); Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); } [TestMethod] - public void RunTestsWithEscapedCommaTests() + public void ExecutorShouldRunTestsWhenTestsAreCommaSeperatedWithEscape() { var mockTestPlatform = new Mock(); var mockTestRunRequest = new Mock(); var mockDiscoveryRequest = new Mock(); - this.ResetAndAddSourceToCommandLineOptions(); + ResetAndAddSourceToCommandLineOptions(); List list = new List(); list.Add(new TestCase("Test1(a,b)", new Uri("http://FooTestUri1"), "Source1")); @@ -472,9 +484,9 @@ public void RunTestsWithEscapedCommaTests() var executor = GetExecutor(testRequestManager); executor.Initialize("Test1(a\\,b), Test2(c\\,d)"); - ArgumentProcessorResult argumentProcessorResult = executor.Execute(); - this.mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); + + mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); } From 18e668392345c6c80555caf62c4f9da609f63bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8F=86Nitin=20Gurram=F0=9F=8F=86?= Date: Wed, 17 Jan 2018 16:24:39 +0530 Subject: [PATCH 7/7] CRC --- .../RunSpecificTestsArgumentProcessor.cs | 6 ++-- ...ft.TestPlatform.Utilities.UnitTests.csproj | 2 +- .../RunSpecificTestsArgumentProcessorTests.cs | 32 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs index c8a5950a6a..97780cad67 100644 --- a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs @@ -83,8 +83,8 @@ internal class RunSpecificTestsArgumentProcessorCapabilities : BaseArgumentProce internal class RunSpecificTestsArgumentExecutor : IArgumentExecutor { - public const char SplitDelimeter = ','; - public const char EscapeDelimeter = '\\'; + public const char SplitDelimiter = ','; + public const char EscapeDelimiter = '\\'; #region Fields @@ -175,7 +175,7 @@ public void Initialize(string argument) if (!string.IsNullOrWhiteSpace(argument)) { this.selectedTestNames = new Collection( - argument.Tokenize(SplitDelimeter, EscapeDelimeter) + argument.Tokenize(SplitDelimiter, EscapeDelimiter) .Where(x => !string.IsNullOrWhiteSpace(x)) .Select(s => s.Trim()).ToList()); } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj b/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj index d7c8387596..ea1b89bd3d 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/Microsoft.TestPlatform.Utilities.UnitTests.csproj @@ -7,7 +7,7 @@ Exe - net451;netcoreapp1.0 + netcoreapp1.0;net451 Microsoft.TestPlatform.Utilities.UnitTests diff --git a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs index 77541f6249..f1c4a992b4 100644 --- a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs @@ -105,10 +105,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() public void InitializeShouldThrowIfArgumentIsNull() { CommandLineOptions.Instance.Reset(); - + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); - + Assert.ThrowsException(() => { executor.Initialize(null); }); } @@ -116,10 +116,10 @@ public void InitializeShouldThrowIfArgumentIsNull() public void InitializeShouldThrowIfArgumentIsEmpty() { CommandLineOptions.Instance.Reset(); - + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); - + Assert.ThrowsException(() => { executor.Initialize(String.Empty); }); } @@ -127,10 +127,10 @@ public void InitializeShouldThrowIfArgumentIsEmpty() public void InitializeShouldThrowIfArgumentIsWhiteSpace() { CommandLineOptions.Instance.Reset(); - + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); - + Assert.ThrowsException(() => { executor.Initialize(" "); }); } @@ -138,21 +138,21 @@ public void InitializeShouldThrowIfArgumentIsWhiteSpace() public void InitializeShouldThrowIfArgumentsAreEmpty() { CommandLineOptions.Instance.Reset(); - + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); - + Assert.ThrowsException(() => { executor.Initialize(" , "); }); } [TestMethod] - public void ExecutorShouldSplitTestsSeperatedByComma() + public void ExecutorShouldSplitTestsSeparatedByComma() { CommandLineOptions.Instance.Reset(); - + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); - + Assert.ThrowsException(() => executor.Execute()); } @@ -160,10 +160,10 @@ public void ExecutorShouldSplitTestsSeperatedByComma() public void ExecutorExecuteForNoSourcesShouldThrowCommandLineException() { CommandLineOptions.Instance.Reset(); - + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, new TestPlatform(), TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); - + Assert.ThrowsException(() => executor.Execute()); } @@ -384,7 +384,7 @@ public void ExecutorExecuteShouldForValidSourcesAndValidSelectedTestsRunsTestsAn } [TestMethod] - public void ExecutorShouldRunTestsWhenTestsAreCommaSeperated() + public void ExecutorShouldRunTestsWhenTestsAreCommaSeparated() { var mockTestPlatform = new Mock(); var mockTestRunRequest = new Mock(); @@ -402,7 +402,7 @@ public void ExecutorShouldRunTestsWhenTestsAreCommaSeperated() var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestLoggerManager.Instance, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask); var executor = GetExecutor(testRequestManager); - + executor.Initialize("Test1, Test2"); ArgumentProcessorResult argumentProcessorResult = executor.Execute(); @@ -464,7 +464,7 @@ public void ExecutorShouldWarnWhenTestsAreNotAvailable() } [TestMethod] - public void ExecutorShouldRunTestsWhenTestsAreCommaSeperatedWithEscape() + public void ExecutorShouldRunTestsWhenTestsAreCommaSeparatedWithEscape() { var mockTestPlatform = new Mock(); var mockTestRunRequest = new Mock();