From d296dd5076325100cba42dc5b17207bf9e2f6ec1 Mon Sep 17 00:00:00 2001 From: Martin Gondermann Date: Wed, 4 May 2016 18:17:30 +0200 Subject: [PATCH 01/12] Fix: XUnit failed, if multiple TestResults.xml were used --- .../XUnit/XUnit2/XUnit2SingleResults.cs | 7 ++++--- .../XUnit/xUnitExampleSignatureBuilder.cs | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2SingleResults.cs b/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2SingleResults.cs index f50d1c87c..fd062379b 100644 --- a/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2SingleResults.cs +++ b/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2SingleResults.cs @@ -18,10 +18,8 @@ // // -------------------------------------------------------------------------------------------------------------------- -using System; using System.Collections.Generic; using System.Linq; -using System.Text.RegularExpressions; using PicklesDoc.Pickles.ObjectModel; @@ -110,6 +108,8 @@ where HasFeatureTitleTrait(test, feature.Name) private assembliesAssemblyCollectionTest GetScenarioElement(Scenario scenario) { var featureElement = this.GetFeatureElement(scenario.Feature); + if (featureElement == null) + return null; var query = from test in featureElement.test where HasDescriptionTrait(test, scenario.Name) @@ -121,7 +121,8 @@ where HasDescriptionTrait(test, scenario.Name) private IEnumerable GetScenarioOutlineElements(ScenarioOutline scenario) { var featureElement = this.GetFeatureElement(scenario.Feature); - + if (featureElement == null) + return Enumerable.Empty(); var query = from test in featureElement.test where HasDescriptionTrait(test, scenario.Name) select test; diff --git a/src/Pickles/Pickles.TestFrameworks/XUnit/xUnitExampleSignatureBuilder.cs b/src/Pickles/Pickles.TestFrameworks/XUnit/xUnitExampleSignatureBuilder.cs index 9ce7651f7..103f9f735 100644 --- a/src/Pickles/Pickles.TestFrameworks/XUnit/xUnitExampleSignatureBuilder.cs +++ b/src/Pickles/Pickles.TestFrameworks/XUnit/xUnitExampleSignatureBuilder.cs @@ -40,7 +40,8 @@ public Regex Build(ScenarioOutline scenarioOutline, string[] row) .Replace(@"\", string.Empty) .Replace(@"$", @"\$") .Replace(@"(", @"\(") - .Replace(@")", @"\)")); + .Replace(@")", @"\)") + .Replace(@"*", @"\*")); } stringBuilder.Remove(stringBuilder.Length - 2, 2); From f6411c0799f58e7c56fee8acc5ca4d0e7abc4c46 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2016 09:41:27 +0200 Subject: [PATCH 02/12] Add new results with examples, which contain Regexes --- .../XUnit/XUnit2/results-example-xunit2.xml | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/results-example-xunit2.xml b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/results-example-xunit2.xml index 6eb25f06d..dec2d3153 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/results-example-xunit2.xml +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/results-example-xunit2.xml @@ -1,6 +1,6 @@  - + @@ -198,7 +198,7 @@ - + @@ -211,6 +211,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a950184c2ef09a2558140c5659c3f8aa0eb6d6b2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2016 10:57:31 +0200 Subject: [PATCH 03/12] Add unit tests for XUnit2 examples with regular expression as example. --- ...rminingTheSignatureOfAnXUnit2ExampleRow.cs | 67 ++++++++++++++++++- .../XUnit/XUnit2/results-example-xunit2.xml | 14 ++-- 2 files changed, 73 insertions(+), 8 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/WhenDeterminingTheSignatureOfAnXUnit2ExampleRow.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/WhenDeterminingTheSignatureOfAnXUnit2ExampleRow.cs index 5baf10e2b..d4d1bccf7 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/WhenDeterminingTheSignatureOfAnXUnit2ExampleRow.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/WhenDeterminingTheSignatureOfAnXUnit2ExampleRow.cs @@ -18,7 +18,6 @@ // // -------------------------------------------------------------------------------------------------------------------- -using System; using System.Text.RegularExpressions; using NFluent; @@ -46,5 +45,71 @@ public void ThenCanSuccessfullyMatch() var isMatch = signature.IsMatch("Pickles.TestHarness.xUnit.AdditionFeature.AddingSeveralNumbers(firstNumber: \"40\", secondNumber: \"50\", result: \"90\", exampleTags: System.String[])".ToLowerInvariant()); Check.That(isMatch).IsTrue(); } + + private static bool MatchRegexSpecialChars(string expectedParameter) + { + var scenarioOutline = new ScenarioOutline { Name = "This scenario contains examples with Regex-special characters" }; + var exampleRow = new[] { expectedParameter }; + + var signatureBuilder = new XUnitExampleSignatureBuilder(); + var signature = signatureBuilder.Build(scenarioOutline, exampleRow); + + var matchEntry = string + .Format( + "Pickles.TestHarness.xunit2.ScenariosWithSpecialCharactersFeature.ThisScenarioContainsExamplesWithRegex_SpecialCharacters(regex: \"{0}\", exampleTags: System.String[])", + expectedParameter) + .ToLowerInvariant(); + + return signature.IsMatch(matchEntry); + } + + [Test] + public void RegularExpressionAsExampleContentMatches_With_Asterisk() + { + var isMatch = MatchRegexSpecialChars("**"); + Check.That(isMatch).IsTrue(); + } + + [Test] + public void RegularExpressionAsExampleContentMatches_With_Plus() + { + var isMatch = MatchRegexSpecialChars("++"); + Check.That(isMatch).IsTrue(); + } + + [Test] + public void RegularExpressionAsExampleContentMatches_With_FullStop_And_Asterisk() + { + var isMatch = MatchRegexSpecialChars(".*"); + Check.That(isMatch).IsTrue(); + } + + [Test] + public void RegularExpressionAsExampleContentMatches_With_Angle_Brackets() + { + var isMatch = MatchRegexSpecialChars("[]"); + Check.That(isMatch).IsTrue(); + } + + [Test] + public void RegularExpressionAsExampleContentMatches_With_Curly_Braces() + { + var isMatch = MatchRegexSpecialChars("{}"); + Check.That(isMatch).IsTrue(); + } + + [Test] + public void RegularExpressionAsExampleContentMatches_With_Parentheses() + { + var isMatch = MatchRegexSpecialChars("()"); + Check.That(isMatch).IsTrue(); + } + + [Test] + public void RegularExpressionAsExampleContentMatches_With_Full_Regular_Expression() + { + var isMatch = MatchRegexSpecialChars(@"^.*(?BAR)\s[^0-9]{3,4}A+$"); + Check.That(isMatch).IsTrue(); + } } } diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/results-example-xunit2.xml b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/results-example-xunit2.xml index dec2d3153..e44303a18 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/results-example-xunit2.xml +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/results-example-xunit2.xml @@ -211,43 +211,43 @@ - + - + - + - + - + - + - + From 73a9f36c697a95fae3d8826c038fa606e1a6d775 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2016 10:57:42 +0200 Subject: [PATCH 04/12] Fix failing tests --- .../XUnit/XUnit1/XUnit1ScenarioOutlineExampleMatcher.cs | 2 +- .../XUnit/XUnit2/XUnit2ScenarioOutlineExampleMatcher.cs | 2 +- .../XUnit/xUnitExampleSignatureBuilder.cs | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit1/XUnit1ScenarioOutlineExampleMatcher.cs b/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit1/XUnit1ScenarioOutlineExampleMatcher.cs index f73f0fa27..3e40f55df 100644 --- a/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit1/XUnit1ScenarioOutlineExampleMatcher.cs +++ b/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit1/XUnit1ScenarioOutlineExampleMatcher.cs @@ -38,7 +38,7 @@ public bool IsMatch(ScenarioOutline scenarioOutline, string[] exampleValues, obj internal static bool IsMatchingTestCase(XElement x, Regex exampleSignature) { - return exampleSignature.IsMatch(x.Attribute("name").Value.ToLowerInvariant().Replace(@"\", string.Empty)); + return exampleSignature.IsMatch(x.Attribute("name").Value.ToLowerInvariant()); } } } \ No newline at end of file diff --git a/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2ScenarioOutlineExampleMatcher.cs b/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2ScenarioOutlineExampleMatcher.cs index 1ea93e3b6..1d897e0cf 100644 --- a/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2ScenarioOutlineExampleMatcher.cs +++ b/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2ScenarioOutlineExampleMatcher.cs @@ -37,7 +37,7 @@ public bool IsMatch(ScenarioOutline scenarioOutline, string[] exampleValues, obj private bool ScenarioOutlineExampleIsMatch(assembliesAssemblyCollectionTest exampleElement, Regex signature) { - return signature.IsMatch(exampleElement.name.ToLowerInvariant().Replace(@"\", string.Empty)); + return signature.IsMatch(exampleElement.name.ToLowerInvariant()); } } } \ No newline at end of file diff --git a/src/Pickles/Pickles.TestFrameworks/XUnit/xUnitExampleSignatureBuilder.cs b/src/Pickles/Pickles.TestFrameworks/XUnit/xUnitExampleSignatureBuilder.cs index 103f9f735..98516f126 100644 --- a/src/Pickles/Pickles.TestFrameworks/XUnit/xUnitExampleSignatureBuilder.cs +++ b/src/Pickles/Pickles.TestFrameworks/XUnit/xUnitExampleSignatureBuilder.cs @@ -36,12 +36,7 @@ public Regex Build(ScenarioOutline scenarioOutline, string[] row) foreach (string value in row) { - stringBuilder.AppendFormat("(.*): \"{0}\", ", value.ToLowerInvariant() - .Replace(@"\", string.Empty) - .Replace(@"$", @"\$") - .Replace(@"(", @"\(") - .Replace(@")", @"\)") - .Replace(@"*", @"\*")); + stringBuilder.AppendFormat("(.*): \"{0}\", ", Regex.Escape(value.ToLowerInvariant())); } stringBuilder.Remove(stringBuilder.Length - 2, 2); From db1bf22b3d1a50d09531f71c4d4018373b3160e7 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2016 16:53:40 +0200 Subject: [PATCH 05/12] Add Tests for NUnit and XUnit for Regexes as Example values --- ...ngNUnitResultsFileWithIndividualResults.cs | 6 + .../NUnit/NUnit2/results-example-nunit.xml | 13 +- ...ngXUnitResultsFileWithIndividualResults.cs | 6 + .../XUnit/XUnit1/results-example-xunit.xml | 166 +++++++++++------- ...ngXUnitResultsFileWithIndividualResults.cs | 6 + .../NUnit/NUnitExampleSignatureBuilder.cs | 5 +- .../NUnitScenarioOutlineExampleMatcher.cs | 2 +- 7 files changed, 136 insertions(+), 68 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit2/WhenParsingNUnitResultsFileWithIndividualResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit2/WhenParsingNUnitResultsFileWithIndividualResults.cs index b3b6acc4a..a50f55383 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit2/WhenParsingNUnitResultsFileWithIndividualResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit2/WhenParsingNUnitResultsFileWithIndividualResults.cs @@ -57,5 +57,11 @@ public WhenParsingNUnitResultsFileWithIndividualResults() { base.ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSections_ShouldBeTestResultFailed(); } + + [Test] + public new void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() + { + base.ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed(); + } } } diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit2/results-example-nunit.xml b/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit2/results-example-nunit.xml index 48e01984c..ee1b01958 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit2/results-example-nunit.xml +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit2/results-example-nunit.xml @@ -1,6 +1,6 @@ - + @@ -435,6 +435,17 @@ bei Pickles.TestHarness.nunit.ScenarioOutlinesFeature.ThisIsAScenarioOutlineWher + + + + + + + + + + + diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit1/WhenParsingXUnitResultsFileWithIndividualResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit1/WhenParsingXUnitResultsFileWithIndividualResults.cs index b67a36d22..500461bd7 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit1/WhenParsingXUnitResultsFileWithIndividualResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit1/WhenParsingXUnitResultsFileWithIndividualResults.cs @@ -58,5 +58,11 @@ public WhenParsingXUnitResultsFileWithIndividualResults() { base.ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSections_ShouldBeTestResultFailed(); } + + [Test] + public new void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() + { + base.ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed(); + } } } \ No newline at end of file diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit1/results-example-xunit.xml b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit1/results-example-xunit.xml index 788f659b1..5079e16e5 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit1/results-example-xunit.xml +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit1/results-example-xunit.xml @@ -1,4 +1,28 @@ -Given the calculator has clean memory +IgnoredGiven the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +Given I have entered 60 into the calculator +-> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(60) (0,0s) +And I have entered 70 into the calculator +-> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(70) (0,0s) +And I have entered 130 into the calculator +-> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(130) (0,0s) +When I press add +-> done: AdditionSteps.WhenIPressAdd() (0,0s) +Then the result should be 260 on the screen +-> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(260) (0,0s) +Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +Given I have entered 40 into the calculator +-> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(40) (0,0s) +And I have entered 50 into the calculator +-> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(50) (0,0s) +And I have entered 90 into the calculator +-> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(90) (0,0s) +When I press add +-> done: AdditionSteps.WhenIPressAdd() (0,0s) +Then the result should be 180 on the screen +-> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(180) (0,0s) +Given the calculator has clean memory -> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) Given I have entered 1 into the calculator -> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(1) (0,0s) @@ -19,7 +43,7 @@ Then the result should be 3.2 on the screen bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() bei Pickles.TestHarness.xunit.AdditionFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\Addition.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.AdditionFeature.FailToAddTwoNumbers() in D:\Work\pickles-testresults\TestHarness\xunit\Addition.feature:Zeile 34.Given the calculator has clean memory + bei Pickles.TestHarness.xunit.AdditionFeature.FailToAddTwoNumbers() in D:\Work\pickles-testresults\TestHarness\xunit\Addition.feature:Zeile 34.Given the calculator has clean memory -> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) Given I have entered 1 into the calculator -> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(1) (0,0s) @@ -28,32 +52,8 @@ And I have entered 2 into the calculator When I press add -> done: AdditionSteps.WhenIPressAdd() (0,0s) Then the result should be 3 on the screen --> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(3) (0,2s) -Given the calculator has clean memory --> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) -Given I have entered 60 into the calculator --> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(60) (0,0s) -And I have entered 70 into the calculator --> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(70) (0,0s) -And I have entered 130 into the calculator --> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(130) (0,0s) -When I press add --> done: AdditionSteps.WhenIPressAdd() (0,0s) -Then the result should be 260 on the screen --> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(260) (0,0s) -Given the calculator has clean memory --> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) -Given I have entered 40 into the calculator --> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(40) (0,0s) -And I have entered 50 into the calculator --> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(50) (0,0s) -And I have entered 90 into the calculator --> done: AdditionSteps.GivenIHaveEnteredIntoTheCalculator(90) (0,0s) -When I press add --> done: AdditionSteps.WhenIPressAdd() (0,0s) -Then the result should be 180 on the screen --> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(180) (0,0s) -IgnoredGiven the calculator has clean memory +-> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(3) (0,0s) +Given the calculator has clean memory -> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) Given unimplemented step -> No matching step definition found for the step. Use the following code to create one: @@ -109,7 +109,7 @@ namespace MyNamespace } bei TechTalk.SpecFlow.UnitTestProvider.XUnitRuntimeProvider.TestPending(String message) bei Pickles.TestHarness.xunit.AdditionFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\Addition.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.AdditionFeature.NotAutomatedAddingTwoNumbers() in D:\Work\pickles-testresults\TestHarness\xunit\Addition.feature:Zeile 46.Given the background step fails + bei Pickles.TestHarness.xunit.AdditionFeature.NotAutomatedAddingTwoNumbers() in D:\Work\pickles-testresults\TestHarness\xunit\Addition.feature:Zeile 46.Given the background step fails -> error: 1 should be @@ -118,13 +118,15 @@ namespace MyNamespace 1 And the calculator has clean memory -> skipped because of previous errors -Given I have entered 50 into the calculator +Given I have entered 60 into the calculator -> skipped because of previous errors And I have entered 70 into the calculator -> skipped because of previous errors +And I have entered 130 into the calculator +-> skipped because of previous errors When I press add -> skipped because of previous errors -Then the result should be 120 on the screen +Then the result should be 260 on the screen -> skipped because of previous errors Shouldly.ChuckedAWobbly : 1 @@ -139,7 +141,7 @@ Then the result should be 120 on the screen bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() bei Pickles.TestHarness.xunit.FailingBackgroundFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\FailingBackground.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.FailingBackgroundFeature.AddTwoNumbers() in D:\Work\pickles-testresults\TestHarness\xunit\FailingBackground.feature:Zeile 12.Given the background step fails + bei Pickles.TestHarness.xunit.FailingBackgroundFeature.AddingSeveralNumbers(String firstNumber, String secondNumber, String thirdNumber, String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\FailingBackground.feature:Zeile 19.Given the background step fails -> error: 1 should be @@ -148,15 +150,15 @@ Then the result should be 120 on the screen 1 And the calculator has clean memory -> skipped because of previous errors -Given I have entered 60 into the calculator +Given I have entered 40 into the calculator -> skipped because of previous errors -And I have entered 70 into the calculator +And I have entered 50 into the calculator -> skipped because of previous errors -And I have entered 130 into the calculator +And I have entered 90 into the calculator -> skipped because of previous errors When I press add -> skipped because of previous errors -Then the result should be 260 on the screen +Then the result should be 180 on the screen -> skipped because of previous errors Shouldly.ChuckedAWobbly : 1 @@ -171,7 +173,7 @@ Then the result should be 260 on the screen bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() bei Pickles.TestHarness.xunit.FailingBackgroundFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\FailingBackground.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.FailingBackgroundFeature.AddingSeveralNumbers(String firstNumber, String secondNumber, String thirdNumber, String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\FailingBackground.feature:Zeile 19.Given the background step fails + bei Pickles.TestHarness.xunit.FailingBackgroundFeature.AddingSeveralNumbers(String firstNumber, String secondNumber, String thirdNumber, String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\FailingBackground.feature:Zeile 19.Given the background step fails -> error: 1 should be @@ -180,15 +182,13 @@ Then the result should be 260 on the screen 1 And the calculator has clean memory -> skipped because of previous errors -Given I have entered 40 into the calculator --> skipped because of previous errors -And I have entered 50 into the calculator +Given I have entered 50 into the calculator -> skipped because of previous errors -And I have entered 90 into the calculator +And I have entered 70 into the calculator -> skipped because of previous errors When I press add -> skipped because of previous errors -Then the result should be 180 on the screen +Then the result should be 120 on the screen -> skipped because of previous errors Shouldly.ChuckedAWobbly : 1 @@ -203,7 +203,7 @@ Then the result should be 180 on the screen bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() bei Pickles.TestHarness.xunit.FailingBackgroundFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\FailingBackground.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.FailingBackgroundFeature.AddingSeveralNumbers(String firstNumber, String secondNumber, String thirdNumber, String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\FailingBackground.feature:Zeile 19.Given unimplemented step + bei Pickles.TestHarness.xunit.FailingBackgroundFeature.AddTwoNumbers() in D:\Work\pickles-testresults\TestHarness\xunit\FailingBackground.feature:Zeile 12.Given unimplemented step -> No matching step definition found for the step. Use the following code to create one: [Given(@"unimplemented step")] public void GivenUnimplementedStep() @@ -265,7 +265,7 @@ namespace MyNamespace } bei TechTalk.SpecFlow.UnitTestProvider.XUnitRuntimeProvider.TestPending(String message) bei Pickles.TestHarness.xunit.NotAutomatedAtAllFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\NotAutomatedAtAll.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.NotAutomatedAtAllFeature.NotAutomatedScenario1() in D:\Work\pickles-testresults\TestHarness\xunit\NotAutomatedAtAll.feature:Zeile 9.Given unimplemented step + bei Pickles.TestHarness.xunit.NotAutomatedAtAllFeature.NotAutomatedScenario2() in D:\Work\pickles-testresults\TestHarness\xunit\NotAutomatedAtAll.feature:Zeile 14.Given unimplemented step -> No matching step definition found for the step. Use the following code to create one: [Given(@"unimplemented step")] public void GivenUnimplementedStep() @@ -327,7 +327,7 @@ namespace MyNamespace } bei TechTalk.SpecFlow.UnitTestProvider.XUnitRuntimeProvider.TestPending(String message) bei Pickles.TestHarness.xunit.NotAutomatedAtAllFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\NotAutomatedAtAll.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.NotAutomatedAtAllFeature.NotAutomatedScenario2() in D:\Work\pickles-testresults\TestHarness\xunit\NotAutomatedAtAll.feature:Zeile 14.Given unimplemented step + bei Pickles.TestHarness.xunit.NotAutomatedAtAllFeature.NotAutomatedScenario3() in D:\Work\pickles-testresults\TestHarness\xunit\NotAutomatedAtAll.feature:Zeile 19.Given unimplemented step -> No matching step definition found for the step. Use the following code to create one: [Given(@"unimplemented step")] public void GivenUnimplementedStep() @@ -389,13 +389,13 @@ namespace MyNamespace } bei TechTalk.SpecFlow.UnitTestProvider.XUnitRuntimeProvider.TestPending(String message) bei Pickles.TestHarness.xunit.NotAutomatedAtAllFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\NotAutomatedAtAll.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.NotAutomatedAtAllFeature.NotAutomatedScenario3() in D:\Work\pickles-testresults\TestHarness\xunit\NotAutomatedAtAll.feature:Zeile 19.When I have backslashes in the value, for example a 'c:\Temp\' --> done: ScenarioOutlineSteps.WhenIHaveBackslashesInTheValueForExampleAFilePath("c:\Temp\") (0,0s) -Then the scenario will 'pass_1' + bei Pickles.TestHarness.xunit.NotAutomatedAtAllFeature.NotAutomatedScenario1() in D:\Work\pickles-testresults\TestHarness\xunit\NotAutomatedAtAll.feature:Zeile 9.When I have parenthesis in the value, for example an 'This is a description (and more)' +-> done: ScenarioOutlineSteps.WhenIHaveParenthesisInTheValueForExampleAnOverlyDescriptiveField("This is a descrip...") (0,0s) +Then the scenario will 'pass_1' -> done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_1") (0,0s) Then the scenario will 'pass_2' -> done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_2") (0,0s) -Then the scenario will 'inconclusive_1' +Then the scenario will 'inconclusive_1' -> pending: ScenarioOutlineSteps.ThenTheScenarioWill("inconclusive_1") TechTalk.SpecFlow.SpecFlowException : Test pending: One or more step definitions are not implemented yet. ScenarioOutlineSteps.ThenTheScenarioWill("inconclusive_1") bei TechTalk.SpecFlow.UnitTestProvider.XUnitRuntimeProvider.TestPending(String message) @@ -405,7 +405,7 @@ namespace MyNamespace TechTalk.SpecFlow.SpecFlowException : Test pending: One or more step definitions are not implemented yet. ScenarioOutlineSteps.ThenTheScenarioWill("inconclusive_2") bei TechTalk.SpecFlow.UnitTestProvider.XUnitRuntimeProvider.TestPending(String message) bei Pickles.TestHarness.xunit.ScenarioOutlinesFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\ScenarioOutlines.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.ScenarioOutlinesFeature.AndWeCanGoTotallyBonkersWithMultipleExampleSections_(String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\ScenarioOutlines.feature:Zeile 45.Then the scenario will 'fail_1' + bei Pickles.TestHarness.xunit.ScenarioOutlinesFeature.AndWeCanGoTotallyBonkersWithMultipleExampleSections_(String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\ScenarioOutlines.feature:Zeile 45.Then the scenario will 'fail_1' -> error: true should be @@ -445,8 +445,8 @@ namespace MyNamespace bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() bei Pickles.TestHarness.xunit.ScenarioOutlinesFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\ScenarioOutlines.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.ScenarioOutlinesFeature.AndWeCanGoTotallyBonkersWithMultipleExampleSections_(String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\ScenarioOutlines.feature:Zeile 45.When I have parenthesis in the value, for example an 'This is a description (and more)' --> done: ScenarioOutlineSteps.WhenIHaveParenthesisInTheValueForExampleAnOverlyDescriptiveField("This is a descrip...") (0,0s) + bei Pickles.TestHarness.xunit.ScenarioOutlinesFeature.AndWeCanGoTotallyBonkersWithMultipleExampleSections_(String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\ScenarioOutlines.feature:Zeile 45.When I have backslashes in the value, for example a 'c:\Temp\' +-> done: ScenarioOutlineSteps.WhenIHaveBackslashesInTheValueForExampleAFilePath("c:\Temp\") (0,0s) Then the scenario will 'pass_1' -> done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_1") (0,0s) Then the scenario will 'pass_2' @@ -457,7 +457,7 @@ namespace MyNamespace -> done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_1") (0,0s) Then the scenario will 'pass_2' -> done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_2") (0,0s) -Then the scenario will 'inconclusive_1' +Then the scenario will 'inconclusive_1' -> pending: ScenarioOutlineSteps.ThenTheScenarioWill("inconclusive_1") TechTalk.SpecFlow.SpecFlowException : Test pending: One or more step definitions are not implemented yet. ScenarioOutlineSteps.ThenTheScenarioWill("inconclusive_1") bei TechTalk.SpecFlow.UnitTestProvider.XUnitRuntimeProvider.TestPending(String message) @@ -466,7 +466,7 @@ namespace MyNamespace -> done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_1") (0,0s) Then the scenario will 'pass_2' -> done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_2") (0,0s) -Then the scenario will 'fail_1' +Then the scenario will 'fail_1' -> error: true should be @@ -486,10 +486,52 @@ namespace MyNamespace bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() bei Pickles.TestHarness.xunit.ScenarioOutlinesFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\ScenarioOutlines.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.ScenarioOutlinesFeature.ThisIsAScenarioOutlineWhereOneScenarioFails(String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\ScenarioOutlines.feature:Zeile 34.Given the calculator has clean memory + bei Pickles.TestHarness.xunit.ScenarioOutlinesFeature.ThisIsAScenarioOutlineWhereOneScenarioFails(String result, String[] exampleTags) in D:\Work\pickles-testresults\TestHarness\xunit\ScenarioOutlines.feature:Zeile 34.Given the calculator has clean memory -> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) Then the scenario will 'pass_1' -> done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_1") (0,0s) +Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '**' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("**") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '++' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("++") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '.*' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex(".*") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '[]' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("[]") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '{}' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("{}") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '()' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("()") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '^.*(?<foo>BAR)\s[^0-9]{3,4}A+$' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("^.*(?<foo>BAR)\s[...") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) Given the calculator has clean memory -> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) Given I have entered 50 into the calculator @@ -500,7 +542,12 @@ When I press add -> done: AdditionSteps.WhenIPressAdd() (0,0s) Then the result should be 120 on the screen -> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(120) (0,0s) -Then failing step +Then inconclusive step +-> pending: MinimalSteps.ThenInconclusiveStep() +TechTalk.SpecFlow.SpecFlowException : Test pending: One or more step definitions are not implemented yet. + MinimalSteps.ThenInconclusiveStep() bei TechTalk.SpecFlow.UnitTestProvider.XUnitRuntimeProvider.TestPending(String message) + bei Pickles.TestHarness.xunit.MinimalFeatures.FailingFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\Minimal Features\Failing.feature.cs:Zeile 0. + bei Pickles.TestHarness.xunit.MinimalFeatures.FailingFeature.FailingFeatureInconclusiveScenario() in D:\Work\pickles-testresults\TestHarness\xunit\Minimal Features\Failing.feature:Zeile 7.Then failing step -> error: true should be @@ -520,12 +567,7 @@ Then the result should be 120 on the screen bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) bei TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() bei Pickles.TestHarness.xunit.MinimalFeatures.FailingFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\Minimal Features\Failing.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.MinimalFeatures.FailingFeature.FailingFeatureFailingScenario() in D:\Work\pickles-testresults\TestHarness\xunit\Minimal Features\Failing.feature:Zeile 10.Then inconclusive step --> pending: MinimalSteps.ThenInconclusiveStep() -TechTalk.SpecFlow.SpecFlowException : Test pending: One or more step definitions are not implemented yet. - MinimalSteps.ThenInconclusiveStep() bei TechTalk.SpecFlow.UnitTestProvider.XUnitRuntimeProvider.TestPending(String message) - bei Pickles.TestHarness.xunit.MinimalFeatures.FailingFeature.ScenarioCleanup() in D:\Work\pickles-testresults\TestHarness\xunit\Minimal Features\Failing.feature.cs:Zeile 0. - bei Pickles.TestHarness.xunit.MinimalFeatures.FailingFeature.FailingFeatureInconclusiveScenario() in D:\Work\pickles-testresults\TestHarness\xunit\Minimal Features\Failing.feature:Zeile 7.Then passing step + bei Pickles.TestHarness.xunit.MinimalFeatures.FailingFeature.FailingFeatureFailingScenario() in D:\Work\pickles-testresults\TestHarness\xunit\Minimal Features\Failing.feature:Zeile 10.Then passing step -> done: MinimalSteps.ThenPassingStep() (0,0s) Then passing step -> done: MinimalSteps.ThenPassingStep() (0,0s) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/WhenParsingXUnitResultsFileWithIndividualResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/WhenParsingXUnitResultsFileWithIndividualResults.cs index c554970d4..44ce35b9f 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/WhenParsingXUnitResultsFileWithIndividualResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/XUnit/XUnit2/WhenParsingXUnitResultsFileWithIndividualResults.cs @@ -58,5 +58,11 @@ public WhenParsingXUnitResultsFileWithIndividualResults() { base.ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSections_ShouldBeTestResultFailed(); } + + [Test] + public new void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() + { + base.ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed(); + } } } \ No newline at end of file diff --git a/src/Pickles/Pickles.TestFrameworks/NUnit/NUnitExampleSignatureBuilder.cs b/src/Pickles/Pickles.TestFrameworks/NUnit/NUnitExampleSignatureBuilder.cs index 50567a08e..2f14de97e 100644 --- a/src/Pickles/Pickles.TestFrameworks/NUnit/NUnitExampleSignatureBuilder.cs +++ b/src/Pickles/Pickles.TestFrameworks/NUnit/NUnitExampleSignatureBuilder.cs @@ -39,10 +39,7 @@ public Regex Build(ScenarioOutline scenarioOutline, string[] row) foreach (string value in row) { - stringBuilder.AppendFormat("\"{0}\",", value.ToLowerInvariant() - .Replace(@"\", string.Empty).Replace(@"$", @"\$") - .Replace(@"(", @"\(") - .Replace(@")", @"\)")); + stringBuilder.AppendFormat("\"{0}\",", Regex.Escape(value.ToLowerInvariant())); } stringBuilder.Remove(stringBuilder.Length - 1, 1); diff --git a/src/Pickles/Pickles.TestFrameworks/NUnit/NUnitScenarioOutlineExampleMatcher.cs b/src/Pickles/Pickles.TestFrameworks/NUnit/NUnitScenarioOutlineExampleMatcher.cs index 065804aea..0438d7c94 100644 --- a/src/Pickles/Pickles.TestFrameworks/NUnit/NUnitScenarioOutlineExampleMatcher.cs +++ b/src/Pickles/Pickles.TestFrameworks/NUnit/NUnitScenarioOutlineExampleMatcher.cs @@ -39,7 +39,7 @@ public bool IsMatch(ScenarioOutline scenarioOutline, string[] exampleValues, obj internal static bool IsMatchingTestCase(XElement x, Regex exampleSignature) { var name = x.Attribute("name"); - return name != null && exampleSignature.IsMatch(name.Value.ToLowerInvariant().Replace(@"\", string.Empty)); + return name != null && exampleSignature.IsMatch(name.Value.ToLowerInvariant().Replace(@"\\", @"\")); } } } \ No newline at end of file From a6cf49032c74b6f2bd0bb1ecbfb0bc6cf9b5bc22 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2016 17:24:07 +0200 Subject: [PATCH 06/12] Add Tests for MSTest for Regexes as Example values --- ...gMsTestResultsFileWithIndividualResults.cs | 7 +- .../MsTest/results-example-mstest.trx | 212 +++++++++++++++++- 2 files changed, 217 insertions(+), 2 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/MsTest/WhenParsingMsTestResultsFileWithIndividualResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/MsTest/WhenParsingMsTestResultsFileWithIndividualResults.cs index b6425cb93..0e7a8dc88 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/MsTest/WhenParsingMsTestResultsFileWithIndividualResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/MsTest/WhenParsingMsTestResultsFileWithIndividualResults.cs @@ -18,7 +18,6 @@ // // -------------------------------------------------------------------------------------------------------------------- -using System; using NUnit.Framework; @@ -57,5 +56,11 @@ public WhenParsingMsTestResultsFileWithIndividualResults() { base.ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSections_ShouldBeTestResultFailed(); } + + [Test] + public new void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() + { + base.ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed(); + } } } diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/MsTest/results-example-mstest.trx b/src/Pickles/Pickles.TestFrameworks.UnitTests/MsTest/results-example-mstest.trx index 850ad8cde..b3e62685a 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/MsTest/results-example-mstest.trx +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/MsTest/results-example-mstest.trx @@ -12,9 +12,28 @@ - + + + This scenario contains examples with Regex-special characters + + + + FeatureTitle + Scenarios With Special Characters + + + VariantName + Variant 3 + + + Parameter:regex + [] + + + + Not automated scenario 1 @@ -90,6 +109,25 @@ + + This scenario contains examples with Regex-special characters + + + + FeatureTitle + Scenarios With Special Characters + + + VariantName + Variant 2 + + + Parameter:regex + .* + + + + This is a scenario with parentheses, hyphen and comma (10-20, 30-40) @@ -101,6 +139,25 @@ + + This scenario contains examples with Regex-special characters + + + + FeatureTitle + Scenarios With Special Characters + + + VariantName + Variant 1 + + + Parameter:regex + ++ + + + + Add two numbers @@ -202,6 +259,44 @@ + + This scenario contains examples with Regex-special characters + + + + FeatureTitle + Scenarios With Special Characters + + + VariantName + Variant 6 + + + Parameter:regex + ^.*(?<foo>BAR)\s[^0-9]{3,4}A+$ + + + + + + This scenario contains examples with Regex-special characters + + + + FeatureTitle + Scenarios With Special Characters + + + VariantName + Variant 5 + + + Parameter:regex + () + + + + Adding several numbers @@ -544,6 +639,25 @@ + + This scenario contains examples with Regex-special characters + + + + FeatureTitle + Scenarios With Special Characters + + + VariantName + Variant 0 + + + Parameter:regex + ** + + + + This is a scenario outline where all scenarios pass @@ -582,6 +696,25 @@ + + This scenario contains examples with Regex-special characters + + + + FeatureTitle + Scenarios With Special Characters + + + VariantName + Variant 4 + + + Parameter:regex + {} + + + + Adding several numbers @@ -700,6 +833,13 @@ + + + + + + + @@ -1548,5 +1688,75 @@ Then the result should be 120 on the screen -> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(120) (0,0s) + + + Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '**' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("**") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) + + + + + Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '++' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("++") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) + + + + + Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '.*' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex(".*") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) + + + + + Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '[]' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("[]") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) + + + + + Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '{}' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("{}") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) + + + + + Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '()' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("()") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) + + + + + Given the calculator has clean memory +-> done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '^.*(?<foo>BAR)\s[^0-9]{3,4}A+$' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("^.*(?<foo>BAR)\s[...") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) + + \ No newline at end of file From 8210af20c4b8cdf233c18e1e60f0343fdf57fc93 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2016 17:54:28 +0200 Subject: [PATCH 07/12] Add Tests for Cucumber and CucumberJS for Regexes as Example values --- ...nFromJSResultsFileWithIndividualResults.cs | 7 +- ...romRubyResultsFileWithIndividualResults.cs | 7 +- .../results-example-cucumberjs-json.json | 322 +++++++++++++++ .../CucumberJson/results-example-json.json | 385 ++++++++++++++++++ 4 files changed, 719 insertions(+), 2 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/WhenParsingCucumberJsonFromJSResultsFileWithIndividualResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/WhenParsingCucumberJsonFromJSResultsFileWithIndividualResults.cs index 8c3f3b6e4..266ac7471 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/WhenParsingCucumberJsonFromJSResultsFileWithIndividualResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/WhenParsingCucumberJsonFromJSResultsFileWithIndividualResults.cs @@ -18,7 +18,6 @@ // // -------------------------------------------------------------------------------------------------------------------- -using System; using NUnit.Framework; @@ -57,5 +56,11 @@ public WhenParsingCucumberJsonFromJSResultsFileWithIndividualResults() { base.ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSections_ShouldBeTestResultFailed(); } + + [Test] + public new void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() + { + base.ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed(); + } } } diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/WhenParsingCucumberJsonFromRubyResultsFileWithIndividualResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/WhenParsingCucumberJsonFromRubyResultsFileWithIndividualResults.cs index 9d9eae77f..53bc5e85b 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/WhenParsingCucumberJsonFromRubyResultsFileWithIndividualResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/WhenParsingCucumberJsonFromRubyResultsFileWithIndividualResults.cs @@ -18,7 +18,6 @@ // // -------------------------------------------------------------------------------------------------------------------- -using System; using NUnit.Framework; @@ -57,5 +56,11 @@ public WhenParsingCucumberJsonFromRubyResultsFileWithIndividualResults() { base.ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSections_ShouldBeTestResultFailed(); } + + [Test] + public new void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() + { + base.ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed(); + } } } diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/results-example-cucumberjs-json.json b/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/results-example-cucumberjs-json.json index b2d796399..b2815df2e 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/results-example-cucumberjs-json.json +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/results-example-cucumberjs-json.json @@ -1496,6 +1496,328 @@ } } ] + }, + { + "name": "This scenario contains examples with Regex-special characters", + "id": "Scenarios-With-Special-Characters;this-scenario-contains-examples-with-regex-special-characters", + "line": 27, + "keyword": "Scenario", + "description": "", + "type": "scenario", + "steps": [ + { + "name": "the calculator has clean memory", + "line": 5, + "keyword": "Given ", + "result": { + "status": "passed", + "duration": 79258 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\AdditionSteps.js:10" + } + }, + { + "name": "I have special characters for regexes in the value, for example a '**'", + "line": 22, + "keyword": "When ", + "result": { + "status": "passed", + "duration": 80969 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:32" + } + }, + { + "name": "the scenario will 'pass_1'", + "line": 23, + "keyword": "Then ", + "result": { + "status": "passed", + "duration": 56450 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:7" + } + } + ] + }, + { + "name": "This scenario contains examples with Regex-special characters", + "id": "Scenarios-With-Special-Characters;this-scenario-contains-examples-with-regex-special-characters", + "line": 28, + "keyword": "Scenario", + "description": "", + "type": "scenario", + "steps": [ + { + "name": "the calculator has clean memory", + "line": 5, + "keyword": "Given ", + "result": { + "status": "passed", + "duration": 197574 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\AdditionSteps.js:10" + } + }, + { + "name": "I have special characters for regexes in the value, for example a '++'", + "line": 22, + "keyword": "When ", + "result": { + "status": "passed", + "duration": 62436 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:32" + } + }, + { + "name": "the scenario will 'pass_1'", + "line": 23, + "keyword": "Then ", + "result": { + "status": "passed", + "duration": 55595 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:7" + } + } + ] + }, + { + "name": "This scenario contains examples with Regex-special characters", + "id": "Scenarios-With-Special-Characters;this-scenario-contains-examples-with-regex-special-characters", + "line": 29, + "keyword": "Scenario", + "description": "", + "type": "scenario", + "steps": [ + { + "name": "the calculator has clean memory", + "line": 5, + "keyword": "Given ", + "result": { + "status": "passed", + "duration": 84674 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\AdditionSteps.js:10" + } + }, + { + "name": "I have special characters for regexes in the value, for example a '.*'", + "line": 22, + "keyword": "When ", + "result": { + "status": "passed", + "duration": 61011 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:32" + } + }, + { + "name": "the scenario will 'pass_1'", + "line": 23, + "keyword": "Then ", + "result": { + "status": "passed", + "duration": 66713 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:7" + } + } + ] + }, + { + "name": "This scenario contains examples with Regex-special characters", + "id": "Scenarios-With-Special-Characters;this-scenario-contains-examples-with-regex-special-characters", + "line": 30, + "keyword": "Scenario", + "description": "", + "type": "scenario", + "steps": [ + { + "name": "the calculator has clean memory", + "line": 5, + "keyword": "Given ", + "result": { + "status": "passed", + "duration": 69849 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\AdditionSteps.js:10" + } + }, + { + "name": "I have special characters for regexes in the value, for example a '[]'", + "line": 22, + "keyword": "When ", + "result": { + "status": "passed", + "duration": 51318 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:32" + } + }, + { + "name": "the scenario will 'pass_1'", + "line": 23, + "keyword": "Then ", + "result": { + "status": "passed", + "duration": 65573 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:7" + } + } + ] + }, + { + "name": "This scenario contains examples with Regex-special characters", + "id": "Scenarios-With-Special-Characters;this-scenario-contains-examples-with-regex-special-characters", + "line": 31, + "keyword": "Scenario", + "description": "", + "type": "scenario", + "steps": [ + { + "name": "the calculator has clean memory", + "line": 5, + "keyword": "Given ", + "result": { + "status": "passed", + "duration": 66429 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\AdditionSteps.js:10" + } + }, + { + "name": "I have special characters for regexes in the value, for example a '{}'", + "line": 22, + "keyword": "When ", + "result": { + "status": "passed", + "duration": 51888 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:32" + } + }, + { + "name": "the scenario will 'pass_1'", + "line": 23, + "keyword": "Then ", + "result": { + "status": "passed", + "duration": 75266 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:7" + } + } + ] + }, + { + "name": "This scenario contains examples with Regex-special characters", + "id": "Scenarios-With-Special-Characters;this-scenario-contains-examples-with-regex-special-characters", + "line": 32, + "keyword": "Scenario", + "description": "", + "type": "scenario", + "steps": [ + { + "name": "the calculator has clean memory", + "line": 5, + "keyword": "Given ", + "result": { + "status": "passed", + "duration": 65003 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\AdditionSteps.js:10" + } + }, + { + "name": "I have special characters for regexes in the value, for example a '()'", + "line": 22, + "keyword": "When ", + "result": { + "status": "passed", + "duration": 139414 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:32" + } + }, + { + "name": "the scenario will 'pass_1'", + "line": 23, + "keyword": "Then ", + "result": { + "status": "passed", + "duration": 213540 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:7" + } + } + ] + }, + { + "name": "This scenario contains examples with Regex-special characters", + "id": "Scenarios-With-Special-Characters;this-scenario-contains-examples-with-regex-special-characters", + "line": 33, + "keyword": "Scenario", + "description": "", + "type": "scenario", + "steps": [ + { + "name": "the calculator has clean memory", + "line": 5, + "keyword": "Given ", + "result": { + "status": "passed", + "duration": 310474 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\AdditionSteps.js:10" + } + }, + { + "name": "I have special characters for regexes in the value, for example a '^.*(?BAR)\\s[^0-9]{3,4}A+$'", + "line": 22, + "keyword": "When ", + "result": { + "status": "passed", + "duration": 74982 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:32" + } + }, + { + "name": "the scenario will 'pass_1'", + "line": 23, + "keyword": "Then ", + "result": { + "status": "passed", + "duration": 56165 + }, + "match": { + "location": "D:\\Work\\pickles-testresults\\TestHarness\\CucumberJS\\features\\stepdefinitions\\ScenarioOutlineSteps.js:7" + } + } + ] } ] } diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/results-example-json.json b/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/results-example-json.json index b300aa323..6bd36ffd8 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/results-example-json.json +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/CucumberJson/results-example-json.json @@ -1612,6 +1612,391 @@ } } ] + }, + { + "keyword": "Background", + "name": "", + "description": "", + "line": 4, + "type": "background", + "steps": [ + { + "keyword": "Given ", + "name": "the calculator has clean memory", + "line": 5, + "match": { + "location": "features/step_definitions/AdditionSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "id": "scenarios-with-special-characters;this-scenario-contains-examples-with-regex-special-characters;;2", + "keyword": "Scenario Outline", + "name": "This scenario contains examples with Regex-special characters", + "description": "", + "line": 27, + "type": "scenario", + "steps": [ + { + "keyword": "When ", + "name": "I have special characters for regexes in the value, for example a '**'", + "line": 27, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:21" + }, + "result": { + "status": "passed", + "duration": 0 + } + }, + { + "keyword": "Then ", + "name": "the scenario will 'pass_1'", + "line": 27, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "keyword": "Background", + "name": "", + "description": "", + "line": 4, + "type": "background", + "steps": [ + { + "keyword": "Given ", + "name": "the calculator has clean memory", + "line": 5, + "match": { + "location": "features/step_definitions/AdditionSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "id": "scenarios-with-special-characters;this-scenario-contains-examples-with-regex-special-characters;;3", + "keyword": "Scenario Outline", + "name": "This scenario contains examples with Regex-special characters", + "description": "", + "line": 28, + "type": "scenario", + "steps": [ + { + "keyword": "When ", + "name": "I have special characters for regexes in the value, for example a '++'", + "line": 28, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:21" + }, + "result": { + "status": "passed", + "duration": 0 + } + }, + { + "keyword": "Then ", + "name": "the scenario will 'pass_1'", + "line": 28, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "keyword": "Background", + "name": "", + "description": "", + "line": 4, + "type": "background", + "steps": [ + { + "keyword": "Given ", + "name": "the calculator has clean memory", + "line": 5, + "match": { + "location": "features/step_definitions/AdditionSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "id": "scenarios-with-special-characters;this-scenario-contains-examples-with-regex-special-characters;;4", + "keyword": "Scenario Outline", + "name": "This scenario contains examples with Regex-special characters", + "description": "", + "line": 29, + "type": "scenario", + "steps": [ + { + "keyword": "When ", + "name": "I have special characters for regexes in the value, for example a '.*'", + "line": 29, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:21" + }, + "result": { + "status": "passed", + "duration": 0 + } + }, + { + "keyword": "Then ", + "name": "the scenario will 'pass_1'", + "line": 29, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "keyword": "Background", + "name": "", + "description": "", + "line": 4, + "type": "background", + "steps": [ + { + "keyword": "Given ", + "name": "the calculator has clean memory", + "line": 5, + "match": { + "location": "features/step_definitions/AdditionSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "id": "scenarios-with-special-characters;this-scenario-contains-examples-with-regex-special-characters;;5", + "keyword": "Scenario Outline", + "name": "This scenario contains examples with Regex-special characters", + "description": "", + "line": 30, + "type": "scenario", + "steps": [ + { + "keyword": "When ", + "name": "I have special characters for regexes in the value, for example a '[]'", + "line": 30, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:21" + }, + "result": { + "status": "passed", + "duration": 0 + } + }, + { + "keyword": "Then ", + "name": "the scenario will 'pass_1'", + "line": 30, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "keyword": "Background", + "name": "", + "description": "", + "line": 4, + "type": "background", + "steps": [ + { + "keyword": "Given ", + "name": "the calculator has clean memory", + "line": 5, + "match": { + "location": "features/step_definitions/AdditionSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "id": "scenarios-with-special-characters;this-scenario-contains-examples-with-regex-special-characters;;6", + "keyword": "Scenario Outline", + "name": "This scenario contains examples with Regex-special characters", + "description": "", + "line": 31, + "type": "scenario", + "steps": [ + { + "keyword": "When ", + "name": "I have special characters for regexes in the value, for example a '{}'", + "line": 31, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:21" + }, + "result": { + "status": "passed", + "duration": 1000000 + } + }, + { + "keyword": "Then ", + "name": "the scenario will 'pass_1'", + "line": 31, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "keyword": "Background", + "name": "", + "description": "", + "line": 4, + "type": "background", + "steps": [ + { + "keyword": "Given ", + "name": "the calculator has clean memory", + "line": 5, + "match": { + "location": "features/step_definitions/AdditionSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "id": "scenarios-with-special-characters;this-scenario-contains-examples-with-regex-special-characters;;7", + "keyword": "Scenario Outline", + "name": "This scenario contains examples with Regex-special characters", + "description": "", + "line": 32, + "type": "scenario", + "steps": [ + { + "keyword": "When ", + "name": "I have special characters for regexes in the value, for example a '()'", + "line": 32, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:21" + }, + "result": { + "status": "passed", + "duration": 1000000 + } + }, + { + "keyword": "Then ", + "name": "the scenario will 'pass_1'", + "line": 32, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "keyword": "Background", + "name": "", + "description": "", + "line": 4, + "type": "background", + "steps": [ + { + "keyword": "Given ", + "name": "the calculator has clean memory", + "line": 5, + "match": { + "location": "features/step_definitions/AdditionSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] + }, + { + "id": "scenarios-with-special-characters;this-scenario-contains-examples-with-regex-special-characters;;8", + "keyword": "Scenario Outline", + "name": "This scenario contains examples with Regex-special characters", + "description": "", + "line": 33, + "type": "scenario", + "steps": [ + { + "keyword": "When ", + "name": "I have special characters for regexes in the value, for example a '^.*(?BAR)\\s[^0-9]{3,4}A+$'", + "line": 33, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:21" + }, + "result": { + "status": "passed", + "duration": 0 + } + }, + { + "keyword": "Then ", + "name": "the scenario will 'pass_1'", + "line": 33, + "match": { + "location": "features/step_definitions/ScenarioOutlineSteps.rb:1" + }, + "result": { + "status": "passed", + "duration": 0 + } + } + ] } ] } From 9a02aa3dd7c43bb262d13fe0fedd6c4c481458c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2016 18:05:21 +0200 Subject: [PATCH 08/12] Add Tests for SpecRun for Regexes as Example values --- ...RunTestResultsFileWithIndividualResults.cs | 1 - .../SpecRun/results-example-specrun.html | 28 +++++++++++++++++++ .../SpecRun/SpecRunExampleSignatureBuilder.cs | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/SpecRun/WhenParsingSpecRunTestResultsFileWithIndividualResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/SpecRun/WhenParsingSpecRunTestResultsFileWithIndividualResults.cs index ca1ad4be1..75afd4633 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/SpecRun/WhenParsingSpecRunTestResultsFileWithIndividualResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/SpecRun/WhenParsingSpecRunTestResultsFileWithIndividualResults.cs @@ -18,7 +18,6 @@ // // -------------------------------------------------------------------------------------------------------------------- -using System; using NUnit.Framework; diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/SpecRun/results-example-specrun.html b/src/Pickles/Pickles.TestFrameworks.UnitTests/SpecRun/results-example-specrun.html index eff8c9d12..2307053f3 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/SpecRun/results-example-specrun.html +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/SpecRun/results-example-specrun.html @@ -195,6 +195,34 @@ <title>This is a scenario outline with parentheses, hyphen and comma (10-20, 30-40), pass_1</title> <result>Passed</result> </scenario> + <scenario> + <title>This scenario contains examples with Regex-special characters, Variant 0</title> + <result>Passed</result> + </scenario> + <scenario> + <title>This scenario contains examples with Regex-special characters, Variant 1</title> + <result>Passed</result> + </scenario> + <scenario> + <title>This scenario contains examples with Regex-special characters, Variant 2</title> + <result>Passed</result> + </scenario> + <scenario> + <title>This scenario contains examples with Regex-special characters, Variant 3</title> + <result>Passed</result> + </scenario> + <scenario> + <title>This scenario contains examples with Regex-special characters, Variant 4</title> + <result>Passed</result> + </scenario> + <scenario> + <title>This scenario contains examples with Regex-special characters, Variant 5</title> + <result>Passed</result> + </scenario> + <scenario> + <title>This scenario contains examples with Regex-special characters, Variant 6</title> + <result>Passed</result> + </scenario> </scenarios> </feature> </features> diff --git a/src/Pickles/Pickles.TestFrameworks/SpecRun/SpecRunExampleSignatureBuilder.cs b/src/Pickles/Pickles.TestFrameworks/SpecRun/SpecRunExampleSignatureBuilder.cs index 1cedbe0a9..f1c1ff8f0 100644 --- a/src/Pickles/Pickles.TestFrameworks/SpecRun/SpecRunExampleSignatureBuilder.cs +++ b/src/Pickles/Pickles.TestFrameworks/SpecRun/SpecRunExampleSignatureBuilder.cs @@ -33,7 +33,7 @@ public Regex Build(ScenarioOutline scenarioOutline, string[] row) var stringBuilder = new StringBuilder(); stringBuilder.Append(Regex.Escape(scenarioOutline.Name)); stringBuilder.Append("(, Examples (\\d*))?"); - stringBuilder.Append(", " + row[0]); + stringBuilder.Append(", " + Regex.Escape(row[0])); return new Regex(stringBuilder.ToString()); } From 941c2dbf2970343a4c682717745df1740c3a028b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2016 18:07:34 +0200 Subject: [PATCH 09/12] Add Tests for NUnit3 for Regexes as Example values --- ...ngNUnitResultsFileWithIndividualResults.cs | 6 + .../NUnit/NUnit3/results-example-nunit3.xml | 190 ++++++++++++------ 2 files changed, 135 insertions(+), 61 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit3/WhenParsingNUnitResultsFileWithIndividualResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit3/WhenParsingNUnitResultsFileWithIndividualResults.cs index 00d0ad342..fc89e1200 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit3/WhenParsingNUnitResultsFileWithIndividualResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit3/WhenParsingNUnitResultsFileWithIndividualResults.cs @@ -57,5 +57,11 @@ public WhenParsingNUnitResultsFileWithIndividualResults() { base.ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSections_ShouldBeTestResultFailed(); } + + [Test] + public new void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() + { + base.ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed(); + } } } \ No newline at end of file diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit3/results-example-nunit3.xml b/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit3/results-example-nunit3.xml index c93956bab..06ccdfea5 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit3/results-example-nunit3.xml +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/NUnit/NUnit3/results-example-nunit3.xml @@ -1,44 +1,44 @@  - + - - + + - + - + - + - + - + - + - + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) Given I have entered 60 into the calculator @@ -50,10 +50,10 @@ And I have entered 130 into the calculator When I press add -> done: AdditionSteps.WhenIPressAdd() (0,0s) Then the result should be 260 on the screen --> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(260) (0,1s) +-> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(260) (0,0s) ]]> - + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) Given I have entered 40 into the calculator @@ -69,7 +69,7 @@ Then the result should be 180 on the screen ]]> - + @@ -86,7 +86,7 @@ Then the result should be 3 on the screen -> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(3) (0,0s) ]]> - + @@ -118,7 +118,7 @@ Then the result should be 3.2 on the screen -> error: Die Eingabezeichenfolge hat das falsche Format. ]]> - + @@ -127,7 +127,7 @@ Then the result should be 3.2 on the screen - + @@ -191,21 +191,21 @@ Then unimplemented step ]]> - + - + - + skipped because of previous errors ]]> - + - + @@ -325,18 +325,18 @@ Then the result should be 120 on the screen ]]> - + - + - + @@ -366,7 +366,7 @@ Then the result should be 120 on the screen True ]]> - + @@ -378,7 +378,7 @@ Then the result should be 120 on the screen -> pending: MinimalSteps.ThenInconclusiveStep() ]]> - + @@ -387,11 +387,11 @@ Then the result should be 120 on the screen ]]> - + - + @@ -403,7 +403,7 @@ Then the result should be 120 on the screen -> pending: MinimalSteps.ThenInconclusiveStep() ]]> - + @@ -412,11 +412,11 @@ Then the result should be 120 on the screen ]]> - + - + @@ -426,14 +426,14 @@ Then the result should be 120 on the screen - + - + @@ -460,31 +460,31 @@ Then the result should be 120 on the screen ]]> - + - + - + done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_1") (0,0s) ]]> - + done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_2") (0,0s) ]]> - + @@ -493,7 +493,7 @@ Then the result should be 120 on the screen -> pending: ScenarioOutlineSteps.ThenTheScenarioWill("inconclusive_1") ]]> - + @@ -502,7 +502,7 @@ Then the result should be 120 on the screen -> pending: ScenarioOutlineSteps.ThenTheScenarioWill("inconclusive_2") ]]> - + - + - + - + done: ScenarioOutlineSteps.WhenIHaveBackslashesInTheValueForExampleAFilePath("c:\Temp\") (0,0s) ]]> - + - + done: ScenarioOutlineSteps.WhenIHaveParenthesisInTheValueForExampleAnOverlyDescriptiveField("This is a descrip...") (0,0s) ]]> - + - + done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_1") (0,0s) ]]> - + done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_2") (0,0s) ]]> - + done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_3") (0,0s) ]]> - + - + done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_1") (0,0s) ]]> - + done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_2") (0,0s) ]]> - + - + - + done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_1") (0,0s) ]]> - + done: ScenarioOutlineSteps.ThenTheScenarioWill("pass_2") (0,0s) ]]> - + @@ -667,15 +667,15 @@ Then the result should be 120 on the screen - + - + - + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) Then the scenario will 'pass_1' @@ -683,7 +683,7 @@ Then the scenario will 'pass_1' ]]> - + @@ -699,6 +699,74 @@ Then the result should be 120 on the screen -> done: AdditionSteps.ThenTheResultShouldBeOnTheScreen(120) (0,0s) ]]> + + + + + + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '**' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("**") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +]]> + + + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '++' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("++") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +]]> + + + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '.*' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex(".*") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +]]> + + + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '[]' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("[]") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +]]> + + + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '{}' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("{}") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +]]> + + + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '()' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("()") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +]]> + + + done: AdditionSteps.GivenTheCalculatorHasCleanMemory() (0,0s) +When I have special characters for regexes in the value, for example a '^.*(?BAR)\s[^0-9]{3,4}A+$' +-> done: ScenarioOutlineSteps.WhenIHaveSpecialCharactersForRegexesInTheValueForExampleARegex("^.*(?BAR)\s[...") (0,0s) +Then the scenario will 'PASS' +-> done: ScenarioOutlineSteps.ThenTheScenarioWill("PASS") (0,0s) +]]> + + From 3cbc9f86102a47352912654ad133d719cae549cd Mon Sep 17 00:00:00 2001 From: Martin Gondermann Date: Sun, 8 May 2016 22:23:30 +0200 Subject: [PATCH 10/12] Deliberately breaking the CI build by adding the TestFramework-UnitTests to build.fsx and test.fsx --- build.fsx | 7 +++++++ test.fsx | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/build.fsx b/build.fsx index a7c0cee9f..4baf7c332 100644 --- a/build.fsx +++ b/build.fsx @@ -63,6 +63,12 @@ Target "BuildTest" (fun _ -> |> Log "AppBuild-Output: " ) +Target "BuildTest.TestFrameworks" (fun _ -> + !! "src/Pickles/Pickles.TestFrameworks.UnitTests/Pickles.TestFrameworks.UnitTests.csproj" + |> MSBuildRelease testDir "Build" + |> Log "AppBuild-Output: " +) + let createZip (packageType : string) = !! (buildDir + "/" + packageType + "/*.*") -- "*.zip" |> Zip (buildDir + packageType) (deployDir + "Pickles-" + packageType + "-" + version + ".zip") @@ -87,6 +93,7 @@ Target "Default" (fun _ -> ==> "BuildPowerShell" ==> "BuildGui" ==> "BuildTest" + ==> "BuildTest.TestFrameworks" ==> "Zip" ==> "Default" diff --git a/test.fsx b/test.fsx index 4019932e9..a6f36e697 100644 --- a/test.fsx +++ b/test.fsx @@ -14,6 +14,15 @@ Target "Test" (fun _ -> OutputFile = testDir + "TestResults.xml" }) ) +Target "Test.TestFrameworks" (fun _ -> + !! (testDir + "PicklesDoc.Pickles.TestFrameworks.UnitTests") + |> NUnit (fun p -> + {p with + DisableShadowCopy = true; + OutputFile = testDir + "TestFrameworks.TestResults.xml" }) +) + +"Test" ==> "Test.TestFrameworks" // start build -RunTargetOrDefault "Test" \ No newline at end of file +RunTargetOrDefault "Test.TestFrameworks" \ No newline at end of file From 3ada4c61456e5409caf43380b132af563278f5c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 May 2016 08:45:11 +0200 Subject: [PATCH 11/12] Added missing method in StandardTestSuiteForScenarioOutlines.cs but deliberately failing it for trying to break the CI build --- .../StandardTestSuiteForScenarioOutlines.cs | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs index bb647fcb1..3906560f2 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs @@ -18,10 +18,11 @@ // // -------------------------------------------------------------------------------------------------------------------- -using System; using NFluent; +using NUnit.Framework; + using PicklesDoc.Pickles.ObjectModel; namespace PicklesDoc.Pickles.TestFrameworks.UnitTests @@ -129,5 +130,40 @@ public void ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSecti TestResult exampleResult6 = results.GetExampleResult(scenarioOutline, new[] { "fail_2" }); Check.That(exampleResult6).IsEqualTo(TestResult.Failed); } + + public void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() + { + Assert.Fail("Deliberately breaking tests to check the CI build..."); + + var results = ParseResultsFile(); + + var feature = new Feature { Name = "Scenarios With Special Characters" }; + + var scenarioOutline = new ScenarioOutline { Name = "This scenario contains examples with Regex-special characters", Feature = feature }; + + TestResult exampleResultOutline = results.GetScenarioOutlineResult(scenarioOutline); + Check.That(exampleResultOutline).IsEqualTo(TestResult.Passed); + + TestResult exampleResult1 = results.GetExampleResult(scenarioOutline, new[] { "**" }); + Check.That(exampleResult1).IsEqualTo(TestResult.Passed); + + TestResult exampleResult2 = results.GetExampleResult(scenarioOutline, new[] { "++" }); + Check.That(exampleResult2).IsEqualTo(TestResult.Passed); + + TestResult exampleResult3 = results.GetExampleResult(scenarioOutline, new[] { ".*" }); + Check.That(exampleResult3).IsEqualTo(TestResult.Passed); + + TestResult exampleResult4 = results.GetExampleResult(scenarioOutline, new[] { "[]" }); + Check.That(exampleResult4).IsEqualTo(TestResult.Passed); + + TestResult exampleResult5 = results.GetExampleResult(scenarioOutline, new[] { "{}" }); + Check.That(exampleResult5).IsEqualTo(TestResult.Passed); + + TestResult exampleResult6 = results.GetExampleResult(scenarioOutline, new[] { "()" }); + Check.That(exampleResult6).IsEqualTo(TestResult.Passed); + + TestResult exampleResult7 = results.GetExampleResult(scenarioOutline, new[] { @"^.*(?BAR)\s[^0-9]{3,4}A+$" }); + Check.That(exampleResult7).IsEqualTo(TestResult.Passed); + } } } From 6ca10add6ed784b9dde786c9e2d935408aabf0ec Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 May 2016 08:47:14 +0200 Subject: [PATCH 12/12] Fix the failing test --- .../StandardTestSuiteForScenarioOutlines.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs index 3906560f2..5a9a32eb6 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs @@ -133,8 +133,6 @@ public void ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSecti public void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() { - Assert.Fail("Deliberately breaking tests to check the CI build..."); - var results = ParseResultsFile(); var feature = new Feature { Name = "Scenarios With Special Characters" };