diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d94ecb60..ee10c0a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,18 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt ### Security +## [2.19.0] - 2018-07-20 + +### Added + +- Hide Tags from Living Documentation ([516](https://github.com/picklesdoc/pickles/pull/516)) (by [@spacehole1](https://github.com/spacehole1)) +- Exclude Feature Files that have no included scenarios ([453](https://github.com/picklesdoc/pickles/issues/453)) (by [@janosmagyar](https://github.com/janosmagyar)) + +### Fixed + +- Scenario Outline special characters workaround ([509](https://github.com/picklesdoc/pickles/pull/509)) (by [@DominikBaran](https://github.com/DominikBaran)) +- Fix example matching for VSTest ([528](https://github.com/picklesdoc/pickles/pull/528)) (by [@jvandertil](https://github.com/jvandertil)) + ## [2.18.2] - 2018-04-28 ### Changed diff --git a/build.bat b/build.bat index 79b45ef10..a0825c98f 100644 --- a/build.bat +++ b/build.bat @@ -1,5 +1,5 @@ @echo off -set "picklesVersion=2.18.2" +set "picklesVersion=2.19.0" cls diff --git a/docs/Output/Dhtml/pickledFeatures.js b/docs/Output/Dhtml/pickledFeatures.js index 1c15c2ecb..a40ef7078 100644 --- a/docs/Output/Dhtml/pickledFeatures.js +++ b/docs/Output/Dhtml/pickledFeatures.js @@ -3133,7 +3133,7 @@ jsonPWrapper ({ }, "Configuration": { "SutName": "Pickles", - "SutVersion": "2.18.1", - "GeneratedOn": "20 April 2018 22:33:00" + "SutVersion": "2.19.0", + "GeneratedOn": "20 Juli 2018 19:39:00" } }); \ No newline at end of file diff --git a/docs/Output/Excel/features.xlsx b/docs/Output/Excel/features.xlsx index 1c0ea039d..9635a6ea7 100644 Binary files a/docs/Output/Excel/features.xlsx and b/docs/Output/Excel/features.xlsx differ diff --git a/docs/Output/Html/Features/00BasicGherkin/BasicGherkin.html b/docs/Output/Html/Features/00BasicGherkin/BasicGherkin.html index ee3d01cd7..194a2d1ed 100644 --- a/docs/Output/Html/Features/00BasicGherkin/BasicGherkin.html +++ b/docs/Output/Html/Features/00BasicGherkin/BasicGherkin.html @@ -305,9 +305,9 @@

Using And and But

diff --git a/docs/Output/Html/Features/00BasicGherkin/index.html b/docs/Output/Html/Features/00BasicGherkin/index.html index 572887d72..6e2a56997 100644 --- a/docs/Output/Html/Features/00BasicGherkin/index.html +++ b/docs/Output/Html/Features/00BasicGherkin/index.html @@ -268,9 +268,9 @@

00 Basic Gherkin

diff --git a/docs/Output/Html/Features/01TestRunner/TestRunnerIsNotImportant.html b/docs/Output/Html/Features/01TestRunner/TestRunnerIsNotImportant.html index eb00e73fc..6fdf7678f 100644 --- a/docs/Output/Html/Features/01TestRunner/TestRunnerIsNotImportant.html +++ b/docs/Output/Html/Features/01TestRunner/TestRunnerIsNotImportant.html @@ -278,9 +278,9 @@

A couple of simple steps

diff --git a/docs/Output/Html/Features/01TestRunner/index.html b/docs/Output/Html/Features/01TestRunner/index.html index dab8c92c7..94ca61745 100644 --- a/docs/Output/Html/Features/01TestRunner/index.html +++ b/docs/Output/Html/Features/01TestRunner/index.html @@ -266,9 +266,9 @@

01 Test Runner

diff --git a/docs/Output/Html/Features/02TagsAndHooks/Hooks.html b/docs/Output/Html/Features/02TagsAndHooks/Hooks.html index 176b7ec4e..cdf351cf1 100644 --- a/docs/Output/Html/Features/02TagsAndHooks/Hooks.html +++ b/docs/Output/Html/Features/02TagsAndHooks/Hooks.html @@ -340,9 +340,9 @@

Hooking into pre conditions for Steps in SpecFlow

diff --git a/docs/Output/Html/Features/02TagsAndHooks/TagDemo.html b/docs/Output/Html/Features/02TagsAndHooks/TagDemo.html index d3dea1e83..da9e4043e 100644 --- a/docs/Output/Html/Features/02TagsAndHooks/TagDemo.html +++ b/docs/Output/Html/Features/02TagsAndHooks/TagDemo.html @@ -358,9 +358,9 @@

A scenario with 2 tags

diff --git a/docs/Output/Html/Features/02TagsAndHooks/index.html b/docs/Output/Html/Features/02TagsAndHooks/index.html index 2b8cf4a80..1e14b407b 100644 --- a/docs/Output/Html/Features/02TagsAndHooks/index.html +++ b/docs/Output/Html/Features/02TagsAndHooks/index.html @@ -275,9 +275,9 @@

02 Tags And Hooks

diff --git a/docs/Output/Html/Features/031ScenarioContext/ScenarioContext.html b/docs/Output/Html/Features/031ScenarioContext/ScenarioContext.html index 3be6ad800..00a702ab7 100644 --- a/docs/Output/Html/Features/031ScenarioContext/ScenarioContext.html +++ b/docs/Output/Html/Features/031ScenarioContext/ScenarioContext.html @@ -344,9 +344,9 @@

Pending step

diff --git a/docs/Output/Html/Features/031ScenarioContext/index.html b/docs/Output/Html/Features/031ScenarioContext/index.html index 250601b3a..8cc6ac1bc 100644 --- a/docs/Output/Html/Features/031ScenarioContext/index.html +++ b/docs/Output/Html/Features/031ScenarioContext/index.html @@ -266,9 +266,9 @@

031 Scenario Context

diff --git a/docs/Output/Html/Features/032FeatureContext/FeatureContextFeatures.html b/docs/Output/Html/Features/032FeatureContext/FeatureContextFeatures.html index d90eb6208..6a4dcda75 100644 --- a/docs/Output/Html/Features/032FeatureContext/FeatureContextFeatures.html +++ b/docs/Output/Html/Features/032FeatureContext/FeatureContextFeatures.html @@ -295,9 +295,9 @@

Showing information of the feature

diff --git a/docs/Output/Html/Features/032FeatureContext/index.html b/docs/Output/Html/Features/032FeatureContext/index.html index 87ff6dffd..71ce134de 100644 --- a/docs/Output/Html/Features/032FeatureContext/index.html +++ b/docs/Output/Html/Features/032FeatureContext/index.html @@ -266,9 +266,9 @@

032 Feature Context

diff --git a/docs/Output/Html/Features/03ScenarioOutline/ScenarioOutline.html b/docs/Output/Html/Features/03ScenarioOutline/ScenarioOutline.html index a0f468357..3c97ec15b 100644 --- a/docs/Output/Html/Features/03ScenarioOutline/ScenarioOutline.html +++ b/docs/Output/Html/Features/03ScenarioOutline/ScenarioOutline.html @@ -434,9 +434,9 @@

Examples: more than 100

diff --git a/docs/Output/Html/Features/03ScenarioOutline/index.html b/docs/Output/Html/Features/03ScenarioOutline/index.html index aedfc47b3..06d78bda6 100644 --- a/docs/Output/Html/Features/03ScenarioOutline/index.html +++ b/docs/Output/Html/Features/03ScenarioOutline/index.html @@ -266,9 +266,9 @@

03 Scenario Outline

diff --git a/docs/Output/Html/Features/04Background/BackgroundFeature.html b/docs/Output/Html/Features/04Background/BackgroundFeature.html index b511262fa..25f5d62b2 100644 --- a/docs/Output/Html/Features/04Background/BackgroundFeature.html +++ b/docs/Output/Html/Features/04Background/BackgroundFeature.html @@ -305,9 +305,9 @@

Add 2 to the sum

diff --git a/docs/Output/Html/Features/04Background/index.html b/docs/Output/Html/Features/04Background/index.html index da901e7bb..86598f802 100644 --- a/docs/Output/Html/Features/04Background/index.html +++ b/docs/Output/Html/Features/04Background/index.html @@ -266,9 +266,9 @@

04 Background

diff --git a/docs/Output/Html/Features/05TablesAndAssist/TableScenario.html b/docs/Output/Html/Features/05TablesAndAssist/TableScenario.html index daa58ecd4..70a818473 100644 --- a/docs/Output/Html/Features/05TablesAndAssist/TableScenario.html +++ b/docs/Output/Html/Features/05TablesAndAssist/TableScenario.html @@ -326,9 +326,9 @@

Example of a wide table

diff --git a/docs/Output/Html/Features/05TablesAndAssist/index.html b/docs/Output/Html/Features/05TablesAndAssist/index.html index c90c79949..28bf65518 100644 --- a/docs/Output/Html/Features/05TablesAndAssist/index.html +++ b/docs/Output/Html/Features/05TablesAndAssist/index.html @@ -266,9 +266,9 @@

05 Tables And Assist

diff --git a/docs/Output/Html/Features/06CompareToAssist/CompareTo.html b/docs/Output/Html/Features/06CompareToAssist/CompareTo.html index 5d6fc4d59..3ebb42362 100644 --- a/docs/Output/Html/Features/06CompareToAssist/CompareTo.html +++ b/docs/Output/Html/Features/06CompareToAssist/CompareTo.html @@ -298,9 +298,9 @@

CompareToSet

diff --git a/docs/Output/Html/Features/06CompareToAssist/index.html b/docs/Output/Html/Features/06CompareToAssist/index.html index bd7010072..e48c9576d 100644 --- a/docs/Output/Html/Features/06CompareToAssist/index.html +++ b/docs/Output/Html/Features/06CompareToAssist/index.html @@ -266,9 +266,9 @@

06 Compare To Assist

diff --git a/docs/Output/Html/Features/07Localization/Svenska.html b/docs/Output/Html/Features/07Localization/Svenska.html index 4222a8169..77744276f 100644 --- a/docs/Output/Html/Features/07Localization/Svenska.html +++ b/docs/Output/Html/Features/07Localization/Svenska.html @@ -280,9 +280,9 @@

Summera 5 och 7 ska vara 12

diff --git a/docs/Output/Html/Features/07Localization/Vlaams.html b/docs/Output/Html/Features/07Localization/Vlaams.html index 515ed1ddc..3604544ce 100644 --- a/docs/Output/Html/Features/07Localization/Vlaams.html +++ b/docs/Output/Html/Features/07Localization/Vlaams.html @@ -277,9 +277,9 @@

Het Scenario

diff --git a/docs/Output/Html/Features/07Localization/index.html b/docs/Output/Html/Features/07Localization/index.html index 49fa0e65f..1fcf10902 100644 --- a/docs/Output/Html/Features/07Localization/index.html +++ b/docs/Output/Html/Features/07Localization/index.html @@ -273,9 +273,9 @@

07 Localization

diff --git a/docs/Output/Html/Features/08AttributeOverloading/AttributeOverloading.html b/docs/Output/Html/Features/08AttributeOverloading/AttributeOverloading.html index 0499c2197..849b62668 100644 --- a/docs/Output/Html/Features/08AttributeOverloading/AttributeOverloading.html +++ b/docs/Output/Html/Features/08AttributeOverloading/AttributeOverloading.html @@ -286,9 +286,9 @@

Checking number for evenness

diff --git a/docs/Output/Html/Features/08AttributeOverloading/index.html b/docs/Output/Html/Features/08AttributeOverloading/index.html index 05b7a23ea..d829e4063 100644 --- a/docs/Output/Html/Features/08AttributeOverloading/index.html +++ b/docs/Output/Html/Features/08AttributeOverloading/index.html @@ -266,9 +266,9 @@

08 Attribute Overloading

diff --git a/docs/Output/Html/Features/09CallingStepsFromSteps/CallingStepsFromSteps.html b/docs/Output/Html/Features/09CallingStepsFromSteps/CallingStepsFromSteps.html index ea421a6bc..feaeade71 100644 --- a/docs/Output/Html/Features/09CallingStepsFromSteps/CallingStepsFromSteps.html +++ b/docs/Output/Html/Features/09CallingStepsFromSteps/CallingStepsFromSteps.html @@ -298,9 +298,9 @@

Do something meaningful

diff --git a/docs/Output/Html/Features/09CallingStepsFromSteps/index.html b/docs/Output/Html/Features/09CallingStepsFromSteps/index.html index 5c27cbe36..cf01a81a7 100644 --- a/docs/Output/Html/Features/09CallingStepsFromSteps/index.html +++ b/docs/Output/Html/Features/09CallingStepsFromSteps/index.html @@ -266,9 +266,9 @@

09 Calling Steps From Steps

diff --git a/docs/Output/Html/Features/10StepTransformation/StepTransformation.html b/docs/Output/Html/Features/10StepTransformation/StepTransformation.html index 8f737f20b..895782309 100644 --- a/docs/Output/Html/Features/10StepTransformation/StepTransformation.html +++ b/docs/Output/Html/Features/10StepTransformation/StepTransformation.html @@ -278,9 +278,9 @@

Steps with non-string arguments

diff --git a/docs/Output/Html/Features/10StepTransformation/index.html b/docs/Output/Html/Features/10StepTransformation/index.html index 3210b3c91..632e44e45 100644 --- a/docs/Output/Html/Features/10StepTransformation/index.html +++ b/docs/Output/Html/Features/10StepTransformation/index.html @@ -266,9 +266,9 @@

10 Step Transformation

diff --git a/docs/Output/Html/Features/11ContextInjection/ContextInjection.html b/docs/Output/Html/Features/11ContextInjection/ContextInjection.html index 5734e7cb2..b076f6420 100644 --- a/docs/Output/Html/Features/11ContextInjection/ContextInjection.html +++ b/docs/Output/Html/Features/11ContextInjection/ContextInjection.html @@ -346,9 +346,9 @@

Feature with a dependent context

diff --git a/docs/Output/Html/Features/11ContextInjection/index.html b/docs/Output/Html/Features/11ContextInjection/index.html index d7a8f4885..0cf18a2cb 100644 --- a/docs/Output/Html/Features/11ContextInjection/index.html +++ b/docs/Output/Html/Features/11ContextInjection/index.html @@ -268,9 +268,9 @@

11 Context Injection

diff --git a/docs/Output/Html/Features/12NestedFolders/ChildFolder/ChildChildFolder/NestedFolderExample.html b/docs/Output/Html/Features/12NestedFolders/ChildFolder/ChildChildFolder/NestedFolderExample.html index f58594ed6..d588164d9 100644 --- a/docs/Output/Html/Features/12NestedFolders/ChildFolder/ChildChildFolder/NestedFolderExample.html +++ b/docs/Output/Html/Features/12NestedFolders/ChildFolder/ChildChildFolder/NestedFolderExample.html @@ -281,9 +281,9 @@

Nested - Add two numbers

diff --git a/docs/Output/Html/Features/12NestedFolders/ChildFolder/ChildChildFolder/index.html b/docs/Output/Html/Features/12NestedFolders/ChildFolder/ChildChildFolder/index.html index f46e8cf13..6cf643fd1 100644 --- a/docs/Output/Html/Features/12NestedFolders/ChildFolder/ChildChildFolder/index.html +++ b/docs/Output/Html/Features/12NestedFolders/ChildFolder/ChildChildFolder/index.html @@ -266,9 +266,9 @@

Child Child Folder

diff --git a/docs/Output/Html/Features/12NestedFolders/ChildFolder/index.html b/docs/Output/Html/Features/12NestedFolders/ChildFolder/index.html index cd6376810..e999b18ef 100644 --- a/docs/Output/Html/Features/12NestedFolders/ChildFolder/index.html +++ b/docs/Output/Html/Features/12NestedFolders/ChildFolder/index.html @@ -256,9 +256,9 @@

Child Folder

diff --git a/docs/Output/Html/Features/14MarkdownExample/MarkdownExamples.html b/docs/Output/Html/Features/14MarkdownExample/MarkdownExamples.html index bf0b4915c..1ea8ef047 100644 --- a/docs/Output/Html/Features/14MarkdownExample/MarkdownExamples.html +++ b/docs/Output/Html/Features/14MarkdownExample/MarkdownExamples.html @@ -396,9 +396,9 @@

Examples:

diff --git a/docs/Output/Html/Features/14MarkdownExample/index.html b/docs/Output/Html/Features/14MarkdownExample/index.html index 1f56a81a7..e1c1812d2 100644 --- a/docs/Output/Html/Features/14MarkdownExample/index.html +++ b/docs/Output/Html/Features/14MarkdownExample/index.html @@ -298,9 +298,9 @@

14 Markdown Example

diff --git a/docs/Output/Html/Features/15Pickles/InteractiveDHTMLView.html b/docs/Output/Html/Features/15Pickles/InteractiveDHTMLView.html index 1f507b5fd..a962a57eb 100644 --- a/docs/Output/Html/Features/15Pickles/InteractiveDHTMLView.html +++ b/docs/Output/Html/Features/15Pickles/InteractiveDHTMLView.html @@ -278,9 +278,9 @@

Scenario with large data table

diff --git a/docs/Output/Html/Features/15Pickles/index.html b/docs/Output/Html/Features/15Pickles/index.html index 0997383af..7fe6ca04f 100644 --- a/docs/Output/Html/Features/15Pickles/index.html +++ b/docs/Output/Html/Features/15Pickles/index.html @@ -267,9 +267,9 @@

15 Pickles

diff --git a/docs/Output/Html/Features/Arithmetic.html b/docs/Output/Html/Features/Arithmetic.html index 657e02a16..e6acd9793 100644 --- a/docs/Output/Html/Features/Arithmetic.html +++ b/docs/Output/Html/Features/Arithmetic.html @@ -350,9 +350,9 @@

Divide two numbers

diff --git a/docs/Output/Html/Features/Trigonometry.html b/docs/Output/Html/Features/Trigonometry.html index 3df99d816..cd0c4d97b 100644 --- a/docs/Output/Html/Features/Trigonometry.html +++ b/docs/Output/Html/Features/Trigonometry.html @@ -317,9 +317,9 @@

Tangent

diff --git a/docs/Output/Html/Features/Workflow/ClearingScreen.html b/docs/Output/Html/Features/Workflow/ClearingScreen.html index 3e1cd36c8..fb6b185b6 100644 --- a/docs/Output/Html/Features/Workflow/ClearingScreen.html +++ b/docs/Output/Html/Features/Workflow/ClearingScreen.html @@ -281,9 +281,9 @@

Clear the screen

diff --git a/docs/Output/Html/Features/Workflow/index.html b/docs/Output/Html/Features/Workflow/index.html index 55415a7fe..fb101c5da 100644 --- a/docs/Output/Html/Features/Workflow/index.html +++ b/docs/Output/Html/Features/Workflow/index.html @@ -266,9 +266,9 @@

Workflow

diff --git a/docs/Output/Html/Features/index.html b/docs/Output/Html/Features/index.html index e10531d98..d76248f6b 100644 --- a/docs/Output/Html/Features/index.html +++ b/docs/Output/Html/Features/index.html @@ -278,9 +278,9 @@

Features

diff --git a/docs/Output/Html/index.html b/docs/Output/Html/index.html index a1920fc0f..0518db3b6 100644 --- a/docs/Output/Html/index.html +++ b/docs/Output/Html/index.html @@ -256,9 +256,9 @@

Examples

- If you prefer to download the .zip files, you can so from the Github release page. + If you prefer to download the .zip files, you can so from the Github release page.

+ \ No newline at end of file diff --git a/src/Pickles/Pickles.DocumentationBuilders.Json.UnitTests/packages.config b/src/Pickles/Pickles.DocumentationBuilders.Json.UnitTests/packages.config index 315a489d8..20d33e431 100644 --- a/src/Pickles/Pickles.DocumentationBuilders.Json.UnitTests/packages.config +++ b/src/Pickles/Pickles.DocumentationBuilders.Json.UnitTests/packages.config @@ -1,8 +1,11 @@  + + + \ No newline at end of file diff --git a/src/Pickles/Pickles.MSBuild/Pickles.cs b/src/Pickles/Pickles.MSBuild/Pickles.cs index d9fbee1d0..d7edfc3e7 100644 --- a/src/Pickles/Pickles.MSBuild/Pickles.cs +++ b/src/Pickles/Pickles.MSBuild/Pickles.cs @@ -55,6 +55,8 @@ public class Pickles : Task public string ExcludeTags { get; set; } + public string HideTags { get; set; } + public override bool Execute() { try @@ -124,6 +126,11 @@ private void CaptureConfiguration(IConfiguration configuration, IFileSystem file configuration.ExcludeTags = this.ExcludeTags; } + if (!string.IsNullOrEmpty(this.HideTags)) + { + configuration.HideTags = this.HideTags; + } + bool shouldEnableExperimentalFeatures; if (bool.TryParse(this.IncludeExperimentalFeatures, out shouldEnableExperimentalFeatures)) diff --git a/src/Pickles/Pickles.ObjectModel/IConfiguration.cs b/src/Pickles/Pickles.ObjectModel/IConfiguration.cs index b5ddad121..11353f03c 100644 --- a/src/Pickles/Pickles.ObjectModel/IConfiguration.cs +++ b/src/Pickles/Pickles.ObjectModel/IConfiguration.cs @@ -48,6 +48,7 @@ public interface IConfiguration bool ShouldIncludeExperimentalFeatures { get; } string ExcludeTags { get; set; } + string HideTags { get; set; } void AddTestResultFile(FileInfoBase fileInfoBase); diff --git a/src/Pickles/Pickles.PowerShell/Pickle_Features.cs b/src/Pickles/Pickles.PowerShell/Pickle_Features.cs index 0fe5e8c0f..a9e84238b 100644 --- a/src/Pickles/Pickles.PowerShell/Pickle_Features.cs +++ b/src/Pickles/Pickles.PowerShell/Pickle_Features.cs @@ -33,39 +33,43 @@ namespace PicklesDoc.Pickles.PowerShell [Cmdlet("Pickle", "Features")] public class Pickle_Features : PSCmdlet { - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpFeatureDir, Mandatory = true)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpFeatureDir, Mandatory = true)] public string FeatureDirectory { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpOutputDir, Mandatory = true)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpOutputDir, Mandatory = true)] public string OutputDirectory { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpLanguageFeatureFiles, Mandatory = false)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpLanguageFeatureFiles, Mandatory = false)] public string Language { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpTestResultsFormat, Mandatory = false)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpTestResultsFormat, Mandatory = false)] public string TestResultsFormat { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpTestResultsFile, Mandatory = false)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpTestResultsFile, Mandatory = false)] public string TestResultsFile { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpSutName, Mandatory = false)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpSutName, Mandatory = false)] public string SystemUnderTestName { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpSutVersion, Mandatory = false)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpSutVersion, Mandatory = false)] public string SystemUnderTestVersion { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpDocumentationFormat, Mandatory = false)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpDocumentationFormat, Mandatory = false)] public string DocumentationFormat { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpIncludeExperimentalFeatures, Mandatory = false)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpIncludeExperimentalFeatures, Mandatory = false)] public SwitchParameter IncludeExperimentalFeatures { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpEnableComments, Mandatory = false)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpEnableComments, Mandatory = false)] public string EnableComments { get; set; } - [Parameter(HelpMessage = CommandLinArgumentHelpTexts.HelpExcludeTags, Mandatory = false)] + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpExcludeTags, Mandatory = false)] public string ExcludeTags { get; set; } + [Parameter(HelpMessage = CommandLineArgumentHelpTexts.HelpHideTags, Mandatory = false)] + public string HideTags { get; set; } + + protected override void ProcessRecord() { var builder = new ContainerBuilder(); @@ -131,6 +135,11 @@ private void ParseParameters(IConfiguration configuration, IFileSystem fileSyste configuration.ExcludeTags = this.ExcludeTags; } + if (!string.IsNullOrEmpty(this.HideTags)) + { + configuration.HideTags = this.HideTags; + } + bool shouldEnableComments; if (bool.TryParse(this.EnableComments, out shouldEnableComments)) diff --git a/src/Pickles/Pickles.Test/BaseFixture.cs b/src/Pickles/Pickles.Test/BaseFixture.cs index 60c1cd4e8..a2f4635f0 100644 --- a/src/Pickles/Pickles.Test/BaseFixture.cs +++ b/src/Pickles/Pickles.Test/BaseFixture.cs @@ -55,7 +55,7 @@ protected IContainer Container { var builder = new ContainerBuilder(); - var configuration = new Configuration() { ExcludeTags = "exclude-tag" }; + var configuration = new Configuration() { ExcludeTags = "exclude-tag", HideTags = "TagsToHideFeature;TagsToHideScenario" }; builder.RegisterAssemblyTypes(typeof(Runner).Assembly); builder.Register(_ => CreateMockFileSystem()).As().SingleInstance(); builder.RegisterModule(); @@ -102,7 +102,7 @@ protected void AddFakeFolderStructures() this.AddFakeFolderAndFiles("AcceptanceTest", new[] { "AdvancedFeature.feature", "LevelOne.feature" }); this.AddFakeFolderAndFiles("EmptyFolderTests", new string[0]); - this.AddFakeFolderAndFiles("FeatureCrawlerTests", new[] { "index.md", "LevelOne.feature", "image.png", "LevelOneIgnoredFeature.feature" }); + this.AddFakeFolderAndFiles("FeatureCrawlerTests", new[] { "index.md", "LevelOne.feature", "image.png", "LevelOneIgnoredFeature.feature", "LevelOneRemoveTagsToHide.feature" }); this.AddFakeFolderAndFiles(@"FeatureCrawlerTests\SubLevelOne", new[] { "ignorethisfile.ignore", "LevelOneSublevelOne.feature", "LevelOneSublevelTwo.feature" }); this.AddFakeFolderAndFiles(@"FeatureCrawlerTests\SubLevelOne\SubLevelTwo", new[] { "LevelOneSublevelOneSubLevelTwo.feature" }); this.AddFakeFolderAndFiles(@"FeatureCrawlerTests\SubLevelOne\SubLevelTwo\IgnoreThisDirectory", new[] { "IgnoreThisFile.ignore" }); diff --git a/src/Pickles/Pickles.Test/FakeFolderStructures/FeatureCrawlerTests/LevelOneRemoveTagsToHide.feature b/src/Pickles/Pickles.Test/FakeFolderStructures/FeatureCrawlerTests/LevelOneRemoveTagsToHide.feature new file mode 100644 index 000000000..5d44d27ce --- /dev/null +++ b/src/Pickles/Pickles.Test/FakeFolderStructures/FeatureCrawlerTests/LevelOneRemoveTagsToHide.feature @@ -0,0 +1,13 @@ +@TagsToHideFeature +Feature: LevelOneRemoveTagsToHide + In order to avoid silly mistakes + As a math idiot + I want to be told the sum of two numbers + +@mytag +@TagsToHideScenario +Scenario: Add two numbers + Given I have entered 50 into the calculator + And I have entered 70 into the calculator + When I press add + Then the result should be 120 on the screen diff --git a/src/Pickles/Pickles.Test/Pickles.Test.csproj b/src/Pickles/Pickles.Test/Pickles.Test.csproj index ffec5dfa8..b561177c1 100644 --- a/src/Pickles/Pickles.Test/Pickles.Test.csproj +++ b/src/Pickles/Pickles.Test/Pickles.Test.csproj @@ -169,6 +169,10 @@ + + {F69AAC03-A2A6-4B3F-A4EF-ACCB145C64AD} + Pickles.DocumentationBuilders.Cucumber + {8AC3AAFA-84DD-4437-962B-E6C5D6078E09} Pickles.DocumentationBuilders.Dhtml @@ -225,6 +229,7 @@ a-b.feature.cs + ResXFileCodeGenerator diff --git a/src/Pickles/Pickles.Test/WhenCrawlingFoldersForFeatures.cs b/src/Pickles/Pickles.Test/WhenCrawlingFoldersForFeatures.cs index 1954b9268..9198aa487 100644 --- a/src/Pickles/Pickles.Test/WhenCrawlingFoldersForFeatures.cs +++ b/src/Pickles/Pickles.Test/WhenCrawlingFoldersForFeatures.cs @@ -58,13 +58,19 @@ public void Then_can_crawl_all_folders_including_subfolders_for_features_success Check.That(image.RelativePathFromRoot).IsEqualTo("image.png"); Check.That(image).IsInstanceOf(); - INode subLevelOneDirectory = features.ChildNodes[3].Data; + INode levelOneRemoveTagsToHide = features.ChildNodes[3].Data; + Check.That(levelOneRemoveTagsToHide).IsNotNull(); + Check.That(levelOneRemoveTagsToHide.Name).IsEqualTo("LevelOneRemoveTagsToHide"); + Check.That(levelOneRemoveTagsToHide.RelativePathFromRoot).IsEqualTo("LevelOneRemoveTagsToHide.feature"); + Check.That(levelOneRemoveTagsToHide).IsInstanceOf(); + + INode subLevelOneDirectory = features.ChildNodes[4].Data; Check.That(subLevelOneDirectory).IsNotNull(); Check.That(subLevelOneDirectory.Name).IsEqualTo("Sub Level One"); Check.That(subLevelOneDirectory.RelativePathFromRoot).IsEqualTo(@"SubLevelOne\"); Check.That(subLevelOneDirectory).IsInstanceOf(); - Tree subLevelOneNode = features.ChildNodes[3]; + Tree subLevelOneNode = features.ChildNodes[4]; Check.That(subLevelOneNode.ChildNodes.Count).IsEqualTo(3); INode levelOneSublevelOneFeature = subLevelOneNode.ChildNodes[0].Data; diff --git a/src/Pickles/Pickles.Test/WhenParsingFeatureFiles.cs b/src/Pickles/Pickles.Test/WhenParsingFeatureFiles.cs index 49cdc2262..f07695535 100644 --- a/src/Pickles/Pickles.Test/WhenParsingFeatureFiles.cs +++ b/src/Pickles/Pickles.Test/WhenParsingFeatureFiles.cs @@ -418,6 +418,30 @@ When it runs Check.That(feature).IsNull(); } + [Test] + public void Then_can_parse_and_remove_technical_tag_in_configuration_remove_technical_tag() + { + var featureText = + @"# ignore this comment +@feature-tag @TagsToHideFeature +Feature: Test + In order to do something + As a user + I want to run this scenario + + @scenario-tag-1 @scenario-tag-2 + Scenario: A scenario + Given some feature + When it runs + Then I should see that this thing happens"; + + var parser = Container.Resolve(); + var feature = parser.Parse(new StringReader(featureText)); + Check.That(feature).IsNotNull(); + + Check.That(feature.Tags).ContainsExactly("@feature-tag"); + } + [Test] public void Then_can_parse_and_ignore_scenario_with_tag_in_configuration_ignore_tag() { @@ -457,7 +481,46 @@ When it runs } [Test] - public void Then_can_parse_and_ignore_scenario_with_tag_in_configuration_ignore_tag_and_keep_feature() + public void Then_can_parse_and_remove_tag_in_configuration_remove_technical_tag_from_scenario() + { + var featureText = + @"# ignore this comment +@feature-tag +Feature: Test + In order to do something + As a user + I want to run this scenario + + @scenario-tag-1 @scenario-tag-2 + Scenario: A scenario + Given some feature + When it runs + Then I should see that this thing happens + + @scenario-tag-1 @scenario-tag-2 @TagsToHideScenario + Scenario: B scenario + Given some feature + When it runs + Then I should see that this thing happens + + @scenario-tag-1 @scenario-tag-2 + Scenario: C scenario + Given some feature + When it runs + Then I should see that this thing happens"; + + var parser = Container.Resolve(); + var feature = parser.Parse(new StringReader(featureText)); + + Check.That(feature.FeatureElements.Count).IsEqualTo(3); + Check.That(feature.FeatureElements.FirstOrDefault(fe => fe.Name == "A scenario")).IsNotNull(); + Check.That(feature.FeatureElements.FirstOrDefault(fe => fe.Name == "B scenario")).IsNotNull(); + Check.That(feature.FeatureElements.FirstOrDefault(fe => fe.Name == "B scenario").Tags).ContainsExactly("@scenario-tag-1", "@scenario-tag-2"); + Check.That(feature.FeatureElements.FirstOrDefault(fe => fe.Name == "C scenario")).IsNotNull(); + } + + [Test] + public void Then_can_parse_and_ignore_scenario_with_tag_in_configuration_ignore_tag_and_do_not_keep_feature() { var featureText = @"# ignore this comment @@ -482,8 +545,7 @@ When it runs var parser = Container.Resolve(); var feature = parser.Parse(new StringReader(featureText)); - Check.That(feature).IsNotNull(); - Check.That(feature.FeatureElements).IsEmpty(); + Check.That(feature).IsNull(); } [Test] @@ -512,6 +574,12 @@ Then I should see that this thing happens @scenario-tag-1 @scenario-tag-2 @ExClUdE-tAg Scenario: C scenario + Given some feature + When it runs + Then I should see that this thing happens + + @scenario-tag-1 @scenario-tag-2 + Scenario: D scenario Given some feature When it runs Then I should see that this thing happens"; @@ -519,8 +587,11 @@ When it runs var parser = Container.Resolve(); var feature = parser.Parse(new StringReader(featureText)); - Check.That(feature).IsNotNull(); - Check.That(feature.FeatureElements).IsEmpty(); + Check.That(feature.FeatureElements.Count).IsEqualTo(1); + Check.That(feature.FeatureElements.FirstOrDefault(fe => fe.Name == "A scenario")).IsNull(); + Check.That(feature.FeatureElements.FirstOrDefault(fe => fe.Name == "B scenario")).IsNull(); + Check.That(feature.FeatureElements.FirstOrDefault(fe => fe.Name == "C scenario")).IsNull(); + Check.That(feature.FeatureElements.FirstOrDefault(fe => fe.Name == "D scenario")).IsNotNull(); } } } diff --git a/src/Pickles/Pickles.Test/WhenResolvingADocumentationBuilder.cs b/src/Pickles/Pickles.Test/WhenResolvingADocumentationBuilder.cs index 545175280..7862b0121 100644 --- a/src/Pickles/Pickles.Test/WhenResolvingADocumentationBuilder.cs +++ b/src/Pickles/Pickles.Test/WhenResolvingADocumentationBuilder.cs @@ -23,84 +23,59 @@ using NFluent; using NUnit.Framework; using PicklesDoc.Pickles.DocumentationBuilders; +using PicklesDoc.Pickles.DocumentationBuilders.Dhtml; using PicklesDoc.Pickles.DocumentationBuilders.Excel; using PicklesDoc.Pickles.DocumentationBuilders.Html; +using PicklesDoc.Pickles.DocumentationBuilders.Json; using PicklesDoc.Pickles.DocumentationBuilders.Word; +using PicklesDoc.Pickles.DocumentationBuilders.Cucumber; namespace PicklesDoc.Pickles.Test { public class WhenResolvingADocumentationBuilder : BaseFixture { - [Test] - public void ThenCanResolveIDocumentationBuilderAsHtmlDocumentationBuilderAsSingletonIfTheUserSelectsHtmlOutput() + private static readonly object[] DocumentationFormatCases = { - var configuration = this.Configuration; - configuration.DocumentationFormat = DocumentationFormat.Html; - - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); - } + new object[] { DocumentationFormat.Html, typeof(HtmlDocumentationBuilder) }, + new object[] { DocumentationFormat.Word, typeof(WordDocumentationBuilder) }, + new object[] { DocumentationFormat.Excel, typeof(ExcelDocumentationBuilder) }, + new object[] { DocumentationFormat.DHtml, typeof(DhtmlDocumentationBuilder) }, + new object[] { DocumentationFormat.Json, typeof(JsonDocumentationBuilder) }, + new object[] { DocumentationFormat.Cucumber, typeof(CucumberDocumentationBuilder) }, + }; [Test] - public void ThenCanResolveIDocumentationBuilderAsWordDocumentationBuilderIfTheUserSelectsWordOutput() + [TestCaseSource(nameof(DocumentationFormatCases))] + public void ThenCanResolveTheSelectedIDocumentationBuilder(DocumentationFormat documentationFormat, Type builderType) { - var configuration = this.Configuration; - configuration.DocumentationFormat = DocumentationFormat.Word; + this.SetDocumentationFormat(documentationFormat); var item = Container.Resolve(); Check.That(item).IsNotNull(); - Check.That(item).IsInstanceOf(); + Check.That(item).IsInstanceOfType(builderType); } [Test] - public void ThenCanResolveIDocumentationBuilderAsWordDocumentationBuilderAsSingletonIfTheUserSelectsWordOutput() + [TestCaseSource(nameof(DocumentationFormatCases))] + public void ThenCanResolveTheSelectedIDocumentationBuilderAsSingleton(DocumentationFormat documentationFormat, Type builderType) { - var configuration = this.Configuration; - configuration.DocumentationFormat = DocumentationFormat.Word; + this.SetDocumentationFormat(documentationFormat); var item1 = Container.Resolve(); var item2 = Container.Resolve(); Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); + Check.That(item1).IsInstanceOfType(builderType); Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); + Check.That(item2).IsInstanceOfType(builderType); Check.That(item1).IsSameReferenceAs(item2); } - [Test] - public void ThenCanResolveIDocumentationBuilderAsExcelDocumentationBuilderIfTheUserSelectsExcelOutput() + private void SetDocumentationFormat(DocumentationFormat documentationFormat) { var configuration = this.Configuration; - configuration.DocumentationFormat = DocumentationFormat.Excel; - - var item = Container.Resolve(); - - Check.That(item).IsNotNull(); - Check.That(item).IsInstanceOf(); - } - - [Test] - public void ThenCanResolveIDocumentationBuilderAsExcelDocumentationBuilderAsSingletonIfTheUserSelectsExcelOutput() - { - var configuration = this.Configuration; - configuration.DocumentationFormat = DocumentationFormat.Excel; - - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); + configuration.DocumentationFormat = documentationFormat; } } -} +} \ No newline at end of file diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuite.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuite.cs index c7cc64f73..8e1b7422f 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuite.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuite.cs @@ -1,4 +1,4 @@ -// -------------------------------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // // Copyright 2011 Jeffrey Cameron // Copyright 2012-present PicklesDoc team and community contributors @@ -276,7 +276,7 @@ public void ThenCanReadResultOfScenarioOutlineWithUmlauts() var feature = new Feature { Name = "Scenarios With Special Characters" }; - var scenarioOutline = new ScenarioOutline { Name = "This is a scenario outline with german umlauts äöüß ÄÖÜ", Feature = feature }; + var scenarioOutline = new ScenarioOutline { Name = "This is a scenario outline with german umlauts äöüß ÄÖÜ", Feature = feature }; var actualResult = results.GetExampleResult(scenarioOutline, new string[] { "pass_1" }); @@ -289,7 +289,7 @@ public void ThenCanReadResultOfScenarioWithDanishCharacters() var feature = new Feature { Name = "Scenarios With Special Characters" }; - var scenario = new Scenario { Name = "This is a scenario with danish characters æøå ÆØÅ", Feature = feature }; + var scenario = new Scenario { Name = "This is a scenario with danish characters æøå ÆØÅ", Feature = feature }; var actualResult = results.GetScenarioResult(scenario); @@ -302,7 +302,7 @@ public void ThenCanReadResultOfScenarioWithSpanishCharacters() var feature = new Feature { Name = "Scenarios With Special Characters" }; - var scenario = new Scenario { Name = "This is a scenario with spanish characters ñáéíóú", Feature = feature }; + var scenario = new Scenario { Name = "This is a scenario with spanish characters ñáéíóú", Feature = feature }; var actualResult = results.GetScenarioResult(scenario); diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs index 526a0652c..c0a26b56f 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/StandardTestSuiteForScenarioOutlines.cs @@ -19,6 +19,7 @@ // -------------------------------------------------------------------------------------------------------------------- +using System.Collections.Generic; using NFluent; @@ -136,7 +137,30 @@ public void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestRe var feature = new Feature { Name = "Scenarios With Special Characters" }; - var scenarioOutline = new ScenarioOutline { Name = "This scenario contains examples with Regex-special characters", Feature = feature }; + var scenarioOutline = new ScenarioOutline + { + Name = "This scenario contains examples with Regex-special characters", + Feature = feature, + Examples = new List + { + new Example + { + TableArgument = new ExampleTable + { + DataRows = new List + { + new TableRow("**"), + new TableRow("++"), + new TableRow(".*"), + new TableRow("[]"), + new TableRow("{}"), + new TableRow("()"), + new TableRow(@"^.*(?BAR)\s[^0-9]{3,4}A+$"), + } + } + } + } + }; TestResult exampleResultOutline = results.GetScenarioOutlineResult(scenarioOutline); Check.That(exampleResultOutline).IsEqualTo(TestResult.Passed); diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/VsTest/WhenParsingVsTestResultsFileWithIndividualResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/VsTest/WhenParsingVsTestResultsFileWithIndividualResults.cs index c93cdcac0..d5c760146 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/VsTest/WhenParsingVsTestResultsFileWithIndividualResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/VsTest/WhenParsingVsTestResultsFileWithIndividualResults.cs @@ -57,6 +57,12 @@ public WhenParsingVsTestResultsFileWithIndividualResults() base.ThenCanReadIndividualResultsFromScenarioOutline_MultipleExampleSections_ShouldBeTestResultFailed(); } + [Test] + public new void ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed() + { + base.ThenCanReadExamplesWithRegexValuesFromScenarioOutline_ShouldBeTestResultPassed(); + } + [Test] public new void ThenCanReadExamplesWithLongExampleValues() { diff --git a/src/Pickles/Pickles.TestFrameworks.UnitTests/WhenResolvingTestResults.cs b/src/Pickles/Pickles.TestFrameworks.UnitTests/WhenResolvingTestResults.cs index d30e43318..3f667121b 100644 --- a/src/Pickles/Pickles.TestFrameworks.UnitTests/WhenResolvingTestResults.cs +++ b/src/Pickles/Pickles.TestFrameworks.UnitTests/WhenResolvingTestResults.cs @@ -42,300 +42,63 @@ namespace PicklesDoc.Pickles.TestFrameworks.UnitTests [TestFixture] public class WhenResolvingTestResults : BaseFixture { - private const string TestResultsResourcePrefix = "PicklesDoc.Pickles.TestFrameworks.UnitTests."; + private static readonly object[] TestFormatCases = + { + new object[] { null, null, null, typeof(NullTestResults)}, + new object[] { "results-example-mstest.trx", "MsTest.results-example-mstest.trx", TestResultsFormat.MsTest, typeof(MsTestResults)}, + new object[] { "results-example-nunit.xml", "NUnit.NUnit2.results-example-nunit.xml", TestResultsFormat.NUnit, typeof(NUnit2Results)}, + new object[] { "results-example-nunit3.xml", "NUnit.NUnit3.results-example-nunit3.xml", TestResultsFormat.NUnit3, typeof(NUnit3Results)}, + new object[] { "results-example-xunit.xml", "XUnit.XUnit1.results-example-xunit.xml", TestResultsFormat.XUnit1, typeof(XUnit1Results)}, + new object[] { "results-example-xunit2.xml", "XUnit.XUnit2.results-example-xunit2.xml", TestResultsFormat.xUnit2, typeof(XUnit2Results)}, + new object[] { "results-example-json.json", "CucumberJson.results-example-json.json", TestResultsFormat.CucumberJson, typeof(CucumberJsonResults)}, + new object[] { "results-example-specrun.html", "SpecRun.results-example-specrun.html", TestResultsFormat.SpecRun, typeof(SpecRunResults)}, + new object[] { "results-example-vstest.trx", "VsTest.results-example-vstest.trx", TestResultsFormat.VsTest, typeof(VsTestResults)}, + }; + + [Test, TestCaseSource(nameof(TestFormatCases))] + public void ThenCanResolve(string exampleFilename, string resourceName, TestResultsFormat resultFormat, Type resultType) + { + if (exampleFilename != null) + { + this.SetFileSystem(exampleFilename, resourceName); + this.SetConfiguration(exampleFilename, resultFormat); + } - [Test] - public void ThenCanResolveAsSingletonWhenNoTestResultsSelected() - { - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); - } - - [Test] - public void ThenCanResolveAsSingletonWhenTestResultsAreMsTest() - { - FileSystem.AddFile("results-example-mstest.trx", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "MsTest.results-example-mstest.trx")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.MsTest; - configuration.AddTestResultFiles(new[] { FileSystem.FileInfo.FromFileName("results-example-mstest.trx") }); - - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); - } - - [Test] - public void ThenCanResolveAsSingletonWhenTestResultsAreNUnit() - { - FileSystem.AddFile("results-example-nunit.xml", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "NUnit.NUnit2.results-example-nunit.xml")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.NUnit; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-nunit.xml")); - - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); - } - - [Test] - public void ThenCanResolveAsSingletonWhenTestResultsAreNUnit3() - { - FileSystem.AddFile("results-example-nunit3.xml", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "NUnit.NUnit3.results-example-nunit3.xml")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.NUnit3; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-nunit3.xml")); - - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); - } - - [Test] - public void ThenCanResolveAsSingletonWhenTestResultsArexUnit() - { - FileSystem.AddFile("results-example-xunit.xml", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "XUnit.XUnit1.results-example-xunit.xml")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.XUnit1; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-xunit.xml")); - - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); - } - - [Test] - public void ThenCanResolveAsSingletonWhenTestResultsArexUnit2() - { - FileSystem.AddFile("results-example-xunit2.xml", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "XUnit.XUnit2.results-example-xunit2.xml")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.xUnit2; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-xunit2.xml")); - - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); - } - - [Test] - public void ThenCanResolveAsSingletonWhenTestResultsAreCucumberJson() - { - FileSystem.AddFile("results-example-json.json", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "CucumberJson.results-example-json.json")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.CucumberJson; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-json.json")); - - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); - } - - [Test] - public void ThenCanResolveAsSingletonWhenTestResultsAreSpecrun() - { - FileSystem.AddFile("results-example-specrun.html", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "SpecRun.results-example-specrun.html")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.SpecRun; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-specrun.html")); - - var item1 = Container.Resolve(); - var item2 = Container.Resolve(); + var item = Container.Resolve(); - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); - Check.That(item1).IsSameReferenceAs(item2); + Check.That(item).IsNotNull(); + Check.That(item).IsInstanceOfType(resultType); } - [Test] - public void ThenCanResolveAsSingletonWhenTestResultsAreVsTest() + [Test, TestCaseSource(nameof(TestFormatCases))] + public void ThenCanResolveAsSingleton(string exampleFilename, string resourceName, TestResultsFormat resultFormat, Type resultType) { - FileSystem.AddFile("results-example-vstest.trx", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "VsTest.results-example-vstest.trx")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.VsTest; - configuration.AddTestResultFiles(new[] { FileSystem.FileInfo.FromFileName("results-example-vstest.trx") }); + if (exampleFilename != null) + { + this.SetFileSystem(exampleFilename, resourceName); + this.SetConfiguration(exampleFilename, resultFormat); + } var item1 = Container.Resolve(); var item2 = Container.Resolve(); Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); + Check.That(item1).IsInstanceOfType(resultType); Check.That(item2).IsNotNull(); - Check.That(item2).IsInstanceOf(); + Check.That(item2).IsInstanceOfType(resultType); Check.That(item1).IsSameReferenceAs(item2); } - [Test] - public void ThenCanResolveWhenNoTestResultsSelected() - { - var item = Container.Resolve(); - - Check.That(item).IsNotNull(); - Check.That(item).IsInstanceOf(); - } - - [Test] - public void ThenCanResolveWhenTestResultsAreMsTest() - { - FileSystem.AddFile("results-example-mstest.trx", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "MsTest.results-example-mstest.trx")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.MsTest; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-mstest.trx")); - - var item = Container.Resolve(); - - Check.That(item).IsNotNull(); - Check.That(item).IsInstanceOf(); - } - - [Test] - public void ThenCanResolveWhenTestResultsAreNUnit() + private void SetFileSystem(string example, string resource) { - FileSystem.AddFile("results-example-nunit.xml", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "NUnit.NUnit2.results-example-nunit.xml")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.NUnit; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-nunit.xml")); - - var item = Container.Resolve(); - - Check.That(item).IsNotNull(); - Check.That(item).IsInstanceOf(); - } - - [Test] - public void ThenCanResolveWhenTestResultsAreNUnit3() - { - FileSystem.AddFile("results-example-nunit3.xml", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "NUnit.NUnit3.results-example-nunit3.xml")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.NUnit3; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-nunit3.xml")); - - var item1 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); + FileSystem.AddFile(example, RetrieveContentOfFileFromResources("PicklesDoc.Pickles.TestFrameworks.UnitTests." + resource)); } - [Test] - public void ThenCanResolveWhenTestResultsArexUnit() + private void SetConfiguration(string example, TestResultsFormat format) { - FileSystem.AddFile("results-example-xunit.xml", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "XUnit.XUnit1.results-example-xunit.xml")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.XUnit1; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-xunit.xml")); - - var item = Container.Resolve(); - - Check.That(item).IsNotNull(); - Check.That(item).IsInstanceOf(); - } - - [Test] - public void ThenCanResolveWhenTestResultsArexUnit2() - { - FileSystem.AddFile("results-example-xunit2.xml", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "XUnit.XUnit2.results-example-xunit2.xml")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.xUnit2; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-xunit2.xml")); - - var item1 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); - } - - [Test] - public void ThenCanResolveWhenTestResultsAreCucumberJson() - { - FileSystem.AddFile("results-example-json.json", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "CucumberJson.results-example-json.json")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.CucumberJson; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-json.json")); - - var item = Container.Resolve(); - - Check.That(item).IsNotNull(); - Check.That(item).IsInstanceOf(); - } - - [Test] - public void ThenCanResolveWhenTestResultsAreSpecrun() - { - FileSystem.AddFile("results-example-specrun.html", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "SpecRun.results-example-specrun.html")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.SpecRun; - configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName("results-example-specrun.html")); - - var item = Container.Resolve(); - - Check.That(item).IsNotNull(); - Check.That(item).IsInstanceOf(); - } - - [Test] - public void ThenCanResolveWhenTestResultsAreVsTest() - { - FileSystem.AddFile("results-example-vstest.trx", RetrieveContentOfFileFromResources(TestResultsResourcePrefix + "VsTest.results-example-vstest.trx")); - - var configuration = Container.Resolve(); - configuration.TestResultsFormat = TestResultsFormat.VsTest; - configuration.AddTestResultFiles(new[] { FileSystem.FileInfo.FromFileName("results-example-vstest.trx") }); - - var item1 = Container.Resolve(); - - Check.That(item1).IsNotNull(); - Check.That(item1).IsInstanceOf(); + var configuration = this.Container.Resolve(); + configuration.TestResultsFormat = format; + configuration.AddTestResultFiles(new[] { this.FileSystem.FileInfo.FromFileName(example) }); } } } diff --git a/src/Pickles/Pickles.TestFrameworks/VsTest/VsTestScenarioOutlineExampleMatcher.cs b/src/Pickles/Pickles.TestFrameworks/VsTest/VsTestScenarioOutlineExampleMatcher.cs index 913cdf2eb..8f873685f 100644 --- a/src/Pickles/Pickles.TestFrameworks/VsTest/VsTestScenarioOutlineExampleMatcher.cs +++ b/src/Pickles/Pickles.TestFrameworks/VsTest/VsTestScenarioOutlineExampleMatcher.cs @@ -18,6 +18,8 @@ // // -------------------------------------------------------------------------------------------------------------------- +using System.Linq; +using System.Text.RegularExpressions; using System.Xml.Linq; using PicklesDoc.Pickles.ObjectModel; @@ -26,6 +28,9 @@ namespace PicklesDoc.Pickles.TestFrameworks.VsTest { public class VsTestScenarioOutlineExampleMatcher : IScenarioOutlineExampleMatcher { + private static readonly Regex VariantRegex = new Regex(@"(.*)_Variant([\d*])", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private const int VariantNumberGroup = 2; + public bool IsMatch(ScenarioOutline scenarioOutline, string[] exampleValues, object scenarioElement) { var element = (XElement)scenarioElement; @@ -51,7 +56,23 @@ public bool IsMatch(ScenarioOutline scenarioOutline, string[] exampleValues, obj .Replace('Ø', 'O') .Replace('Ã…', 'A'); - var isMatch = element.Name().ToUpperInvariant() + var variantMatch = VariantRegex.Match(element.Name().ToUpperInvariant()); + if (variantMatch.Success) + { + int variantNumber; + if (int.TryParse(variantMatch.Groups[VariantNumberGroup].Value, out variantNumber)) + { + if (scenarioOutline.Examples?.Count > 0) + { + var allExamples = scenarioOutline.Examples.SelectMany(x => x.TableArgument.DataRows); + var example = allExamples.ElementAt(variantNumber); + + return example.Cells.SequenceEqual(exampleValues); + } + } + } + + var isMatch = element.Name().ToUpperInvariant() .EndsWith(matchValue); return isMatch; diff --git a/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2ScenarioOutlineExampleMatcher.cs b/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2ScenarioOutlineExampleMatcher.cs index aaa3c3efa..a0be0de4a 100644 --- a/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2ScenarioOutlineExampleMatcher.cs +++ b/src/Pickles/Pickles.TestFrameworks/XUnit/XUnit2/XUnit2ScenarioOutlineExampleMatcher.cs @@ -36,10 +36,18 @@ public bool IsMatch(ScenarioOutline scenarioOutline, string[] exampleValues, obj private bool ScenarioOutlineExampleIsMatch(assembliesAssemblyCollectionTest exampleElement, Regex signature) { - var testNameWithExample = exampleElement.name; - var testNameOnly = testNameWithExample.Split('(')[0]; - testNameWithExample = testNameWithExample.Replace(testNameOnly, Regex.Replace(testNameOnly, @"\s+", string.Empty)); - return signature.IsMatch(exampleElement.name) || signature.IsMatch(testNameWithExample); + // split scenario outline title to name + parameters + var nameAndArgumentsSplitter = new Regex(@"^(?(.*))(\(.*\))$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); + var groups = nameAndArgumentsSplitter.Match(exampleElement.name).Groups; + var scenarioName = groups["name"].Value; + var scenariotNameWithNoSpacesAndSpecialCharacters = exampleElement.name.Replace(scenarioName, exampleElement.method); + + var esc = Regex.Escape("\""); + var escapedScenariotNameWithNoSpacesAndSpecialCharacters = scenariotNameWithNoSpacesAndSpecialCharacters.Replace(@"\\""", "\"").Replace(@"\""", esc); + var escapedExampleElementName = exampleElement.name.Replace(@"\\""", "\"").Replace(@"\""", esc); + var escapedSignature = signature.ToString().Replace(@"\""", esc); + + return Regex.IsMatch(escapedExampleElementName, escapedSignature, RegexOptions.IgnoreCase) || Regex.IsMatch(escapedScenariotNameWithNoSpacesAndSpecialCharacters, escapedSignature, RegexOptions.IgnoreCase); } } } \ No newline at end of file diff --git a/src/Pickles/Pickles.UserInterface/MainWindow.xaml b/src/Pickles/Pickles.UserInterface/MainWindow.xaml index 09b0bd769..a4f3b933a 100644 --- a/src/Pickles/Pickles.UserInterface/MainWindow.xaml +++ b/src/Pickles/Pickles.UserInterface/MainWindow.xaml @@ -47,6 +47,7 @@ + @@ -73,7 +74,10 @@