From 6b3f6c92b667fbb3db471ccb998b124a5636083c Mon Sep 17 00:00:00 2001 From: Ryan Song Date: Mon, 16 Aug 2021 14:18:08 +1000 Subject: [PATCH] support specflow 3.x --- .gitignore | 12 +- Directory.Build.targets | 7 - LICENSE => LICENSE.txt | 2 +- README.md | 2 +- Specflow.DSL.Examples/App.config | 12 - Specflow.DSL.Examples/Examples.csproj | 143 ------- .../{Tests => Features}/Examples.feature | 8 +- .../Features/Examples.feature.cs | 366 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | Bin 2902 -> 0 bytes .../Specflow.DSL.Examples.csproj | 36 ++ .../ExamplesStepDefinitions.cs} | 219 ++++++----- .../Tests/Examples.feature.cs | 220 ----------- Specflow.DSL.Examples/packages.config | 17 - Specflow.DSL.SpecflowPlugin/App.config | 9 - .../App.config.transform | 11 - Specflow.DSL.SpecflowPlugin/DSLPlugin.cs | 38 +- .../ParameterTransform.cs | 3 + .../Specflow.DSL.SpecFlowPlugin.csproj | 67 +++- .../Specflow.DSL.SpecFlowPlugin.nuspec | 14 +- Specflow.DSL.SpecflowPlugin/packages.config | 5 - Specflow.DSL.sln | 29 +- 21 files changed, 615 insertions(+), 605 deletions(-) delete mode 100644 Directory.Build.targets rename LICENSE => LICENSE.txt (99%) delete mode 100644 Specflow.DSL.Examples/App.config delete mode 100644 Specflow.DSL.Examples/Examples.csproj rename Specflow.DSL.Examples/{Tests => Features}/Examples.feature (96%) create mode 100644 Specflow.DSL.Examples/Features/Examples.feature.cs delete mode 100644 Specflow.DSL.Examples/Properties/AssemblyInfo.cs create mode 100644 Specflow.DSL.Examples/Specflow.DSL.Examples.csproj rename Specflow.DSL.Examples/{Tests/ExampleSteps.cs => Steps/ExamplesStepDefinitions.cs} (60%) delete mode 100644 Specflow.DSL.Examples/Tests/Examples.feature.cs delete mode 100644 Specflow.DSL.Examples/packages.config delete mode 100644 Specflow.DSL.SpecflowPlugin/App.config delete mode 100644 Specflow.DSL.SpecflowPlugin/App.config.transform delete mode 100644 Specflow.DSL.SpecflowPlugin/packages.config diff --git a/.gitignore b/.gitignore index 87f6be8..7d39dfa 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,9 @@ ################################################################################ /packages -/.vs/Specflow.DSL/v14 -/Specflow.DSL.Examples/bin/Debug -/Specflow.DSL.Examples/obj/Debug -/Specflow.DSL.SpecflowPlugin/bin/Debug -/Specflow.DSL.SpecflowPlugin/obj/Debug -/Specflow.DSL.SpecflowPlugin/SpecFlow.DSL.0.0.3.nupkg +/.vs/ +/Specflow.DSL.Examples/bin/ +/Specflow.DSL.Examples/obj/ +/Specflow.DSL.Examples/TestResults/ +/Specflow.DSL.SpecflowPlugin/bin/ +/Specflow.DSL.SpecflowPlugin/obj/ diff --git a/Directory.Build.targets b/Directory.Build.targets deleted file mode 100644 index ebffaf2..0000000 --- a/Directory.Build.targets +++ /dev/null @@ -1,7 +0,0 @@ - - - - $(NuspecProperties);config=$(Configuration) - - - \ No newline at end of file diff --git a/LICENSE b/LICENSE.txt similarity index 99% rename from LICENSE rename to LICENSE.txt index 0a426f7..af9b3de 100644 --- a/LICENSE +++ b/LICENSE.txt @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 732f5c1..a946c3c 100644 --- a/README.md +++ b/README.md @@ -71,4 +71,4 @@ Your project's App.config file will be automatically added the following lines t - ``` + ``` \ No newline at end of file diff --git a/Specflow.DSL.Examples/App.config b/Specflow.DSL.Examples/App.config deleted file mode 100644 index e802547..0000000 --- a/Specflow.DSL.Examples/App.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/Specflow.DSL.Examples/Examples.csproj b/Specflow.DSL.Examples/Examples.csproj deleted file mode 100644 index abc8823..0000000 --- a/Specflow.DSL.Examples/Examples.csproj +++ /dev/null @@ -1,143 +0,0 @@ - - - - - Debug - AnyCPU - {214D07C8-07D4-44A0-B78C-E79D2750B0D1} - Library - Properties - Specflow.DSL.Examples - Specflow.DSL.Examples - v4.5.2 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\BoDi.1.4.1\lib\net45\BoDi.dll - - - ..\packages\Cucumber.Messages.6.0.1\lib\net45\Cucumber.Messages.dll - - - ..\packages\Gherkin.6.0.0\lib\net45\Gherkin.dll - - - ..\packages\Google.Protobuf.3.7.0\lib\net45\Google.Protobuf.dll - - - ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - - - ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll - - - - - ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll - - - ..\packages\System.Threading.Tasks.Extensions.4.4.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll - - - ..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll - - - ..\packages\SpecFlow.3.1.62\lib\net45\TechTalk.SpecFlow.dll - - - ..\packages\SpecFlow.MsTest.3.1.62\lib\net45\TechTalk.SpecFlow.MSTest.SpecFlowPlugin.dll - - - ..\packages\Utf8Json.1.3.7\lib\net45\Utf8Json.dll - - - - - - - - - - - - - - - - - - - SpecFlowSingleFileGenerator - Examples.feature.cs - - - - - {b94a7e43-b404-4dd0-b4f3-838854612569} - Specflow.DSL.SpecFlowPlugin - - - - - - - False - - - False - - - False - - - False - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - \ No newline at end of file diff --git a/Specflow.DSL.Examples/Tests/Examples.feature b/Specflow.DSL.Examples/Features/Examples.feature similarity index 96% rename from Specflow.DSL.Examples/Tests/Examples.feature rename to Specflow.DSL.Examples/Features/Examples.feature index bfb59d7..19659da 100644 --- a/Specflow.DSL.Examples/Tests/Examples.feature +++ b/Specflow.DSL.Examples/Features/Examples.feature @@ -1,11 +1,11 @@ @UT Feature: Examples -Scenario: int +Scenario: number test When entered int [[var=50]] Then verify int [[var]] equals 50 -Scenario: string +Scenario: string test When entered string "[[var=50]]" Then verify string "[[var]]" equals "50" @@ -15,7 +15,7 @@ Scenario: regex generate Scenario: table When use table with the following details: - | Field | Value | + | Field | Value | | name | [[var=DesiredValue]] | Then verify string "[[var]]" equals "DesiredValue" @@ -40,4 +40,4 @@ Scenario: add calculation Then verify int [[var2]] equals 25 When entered int [[var2=[[var]]-[[var]]]] Then verify int [[var2]] equals 0 - + \ No newline at end of file diff --git a/Specflow.DSL.Examples/Features/Examples.feature.cs b/Specflow.DSL.Examples/Features/Examples.feature.cs new file mode 100644 index 0000000..dea5a3e --- /dev/null +++ b/Specflow.DSL.Examples/Features/Examples.feature.cs @@ -0,0 +1,366 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by SpecFlow (https://www.specflow.org/). +// SpecFlow Version:3.9.0.0 +// SpecFlow Generator Version:3.9.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +#region Designer generated code +#pragma warning disable +namespace Specflow.DSL.Examples.Features +{ + using TechTalk.SpecFlow; + using System; + using System.Linq; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [TechTalk.SpecRun.FeatureAttribute("Examples", new string[] { + "UT"}, SourceFile="Features\\Examples.feature", SourceLine=1)] + public partial class ExamplesFeature + { + + private TechTalk.SpecFlow.ITestRunner testRunner; + + private string[] _featureTags = new string[] { + "UT"}; + +#line 1 "Examples.feature" +#line hidden + + [TechTalk.SpecRun.FeatureInitialize()] + public virtual void FeatureSetup() + { + testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); + TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "Examples", null, ProgrammingLanguage.CSharp, new string[] { + "UT"}); + testRunner.OnFeatureStart(featureInfo); + } + + [TechTalk.SpecRun.FeatureCleanup()] + public virtual void FeatureTearDown() + { + testRunner.OnFeatureEnd(); + testRunner = null; + } + + public virtual void TestInitialize() + { + } + + [TechTalk.SpecRun.ScenarioCleanup()] + public virtual void TestTearDown() + { + testRunner.OnScenarioEnd(); + } + + public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) + { + testRunner.OnScenarioInitialize(scenarioInfo); + } + + public virtual void ScenarioStart() + { + testRunner.OnScenarioStart(); + } + + public virtual void ScenarioCleanup() + { + testRunner.CollectScenarioErrors(); + } + + [TechTalk.SpecRun.ScenarioAttribute("number test", SourceLine=3)] + public virtual void NumberTest() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("number test", null, tagsOfScenario, argumentsOfScenario, this._featureTags); +#line 4 +this.ScenarioInitialize(scenarioInfo); +#line hidden + bool isScenarioIgnored = default(bool); + bool isFeatureIgnored = default(bool); + if ((tagsOfScenario != null)) + { + isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((this._featureTags != null)) + { + isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((isScenarioIgnored || isFeatureIgnored)) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); +#line 5 + testRunner.When("entered int [[var=50]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 6 + testRunner.Then("verify int [[var]] equals 50", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + } + this.ScenarioCleanup(); + } + + [TechTalk.SpecRun.ScenarioAttribute("string test", SourceLine=7)] + public virtual void StringTest() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("string test", null, tagsOfScenario, argumentsOfScenario, this._featureTags); +#line 8 +this.ScenarioInitialize(scenarioInfo); +#line hidden + bool isScenarioIgnored = default(bool); + bool isFeatureIgnored = default(bool); + if ((tagsOfScenario != null)) + { + isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((this._featureTags != null)) + { + isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((isScenarioIgnored || isFeatureIgnored)) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); +#line 9 + testRunner.When("entered string \"[[var=50]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 10 + testRunner.Then("verify string \"[[var]]\" equals \"50\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + } + this.ScenarioCleanup(); + } + + [TechTalk.SpecRun.ScenarioAttribute("regex generate", SourceLine=11)] + public virtual void RegexGenerate() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("regex generate", null, tagsOfScenario, argumentsOfScenario, this._featureTags); +#line 12 +this.ScenarioInitialize(scenarioInfo); +#line hidden + bool isScenarioIgnored = default(bool); + bool isFeatureIgnored = default(bool); + if ((tagsOfScenario != null)) + { + isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((this._featureTags != null)) + { + isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((isScenarioIgnored || isFeatureIgnored)) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); +#line 13 + testRunner.When("entered string \"[[var=RegEx([a-z]{3}[0-9]{1,9})]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 14 + testRunner.Then("verify string \"[[var]]\" matches \"[a-z]{3}[0-9]{1,9}\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + } + this.ScenarioCleanup(); + } + + [TechTalk.SpecRun.ScenarioAttribute("table", SourceLine=15)] + public virtual void Table() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("table", null, tagsOfScenario, argumentsOfScenario, this._featureTags); +#line 16 +this.ScenarioInitialize(scenarioInfo); +#line hidden + bool isScenarioIgnored = default(bool); + bool isFeatureIgnored = default(bool); + if ((tagsOfScenario != null)) + { + isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((this._featureTags != null)) + { + isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((isScenarioIgnored || isFeatureIgnored)) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); + TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { + "Field", + "Value"}); + table1.AddRow(new string[] { + "name", + "[[var=DesiredValue]]"}); +#line 17 + testRunner.When("use table with the following details:", ((string)(null)), table1, "When "); +#line hidden +#line 20 + testRunner.Then("verify string \"[[var]]\" equals \"DesiredValue\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + } + this.ScenarioCleanup(); + } + + [TechTalk.SpecRun.ScenarioAttribute("nested", SourceLine=21)] + public virtual void Nested() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("nested", null, tagsOfScenario, argumentsOfScenario, this._featureTags); +#line 22 +this.ScenarioInitialize(scenarioInfo); +#line hidden + bool isScenarioIgnored = default(bool); + bool isFeatureIgnored = default(bool); + if ((tagsOfScenario != null)) + { + isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((this._featureTags != null)) + { + isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((isScenarioIgnored || isFeatureIgnored)) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); +#line 23 + testRunner.When("entered string \"[[var=part1]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 24 + testRunner.And("entered string \"[[var2=[[var]] part2]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line hidden +#line 25 + testRunner.Then("verify string \"[[var2]]\" equals \"part1 part2\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + } + this.ScenarioCleanup(); + } + + [TechTalk.SpecRun.ScenarioAttribute("customerise pattern", SourceLine=26)] + public virtual void CustomerisePattern() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("customerise pattern", null, tagsOfScenario, argumentsOfScenario, this._featureTags); +#line 27 +this.ScenarioInitialize(scenarioInfo); +#line hidden + bool isScenarioIgnored = default(bool); + bool isFeatureIgnored = default(bool); + if ((tagsOfScenario != null)) + { + isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((this._featureTags != null)) + { + isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((isScenarioIgnored || isFeatureIgnored)) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); +#line 28 + testRunner.Given("I have a cutomerise pattern mapping \"MyKeyword\" to \"MyKeywordValue\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); +#line hidden +#line 29 + testRunner.When("entered string \"[[var=MyKeyword]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 30 + testRunner.Then("verify string \"[[var]]\" equals \"MyKeywordValue\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + } + this.ScenarioCleanup(); + } + + [TechTalk.SpecRun.ScenarioAttribute("add calculation", SourceLine=31)] + public virtual void AddCalculation() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("add calculation", null, tagsOfScenario, argumentsOfScenario, this._featureTags); +#line 32 +this.ScenarioInitialize(scenarioInfo); +#line hidden + bool isScenarioIgnored = default(bool); + bool isFeatureIgnored = default(bool); + if ((tagsOfScenario != null)) + { + isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((this._featureTags != null)) + { + isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); + } + if ((isScenarioIgnored || isFeatureIgnored)) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); +#line 33 + testRunner.Given("I have a cutomerise pattern to support calculation", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); +#line hidden +#line 34 + testRunner.When("entered int [[var=50]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 35 + testRunner.And("entered int [[var2=[[var]]+1]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line hidden +#line 36 + testRunner.Then("verify int [[var2]] equals 51", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden +#line 37 + testRunner.When("entered int [[var2=[[var]]*2]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 38 + testRunner.Then("verify int [[var2]] equals 100", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden +#line 39 + testRunner.When("entered int [[var2=[[var]]/2]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 40 + testRunner.Then("verify int [[var2]] equals 25", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden +#line 41 + testRunner.When("entered int [[var2=[[var]]-[[var]]]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 42 + testRunner.Then("verify int [[var2]] equals 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + } + this.ScenarioCleanup(); + } + } +} +#pragma warning restore +#endregion diff --git a/Specflow.DSL.Examples/Properties/AssemblyInfo.cs b/Specflow.DSL.Examples/Properties/AssemblyInfo.cs deleted file mode 100644 index 614532848cb93bbec25585a0d067aa92a3946654..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2902 zcmb`JT~AX%5QgX4#Q(7I1|(7|!GL(BB@z=+qexNM z)R^YL~gm|93Db{-{DSUkUZZ*!L~?HbrM z`p$7iC;Rd^V4wU>qTMbYg+%OBkk_y%OlL^klUDS+tPx;Vkxrwwb`RLs=f8#jPK-lX zr7b+mTx4{0yo}LovQwVg*a$HWSy;tWCDz9`G>ZHkpz&%!c7o+eV)By<9Q>YE7M>T+U1ujA3>)R>snu+Rs?>Ti*2Q)q8k_g!)Pnrm+pC+)S3YJXv ze8s26VmAcV2WYBai@q{8@7ycl(Sbhr5u~4s3w&rVB$-=Gse57Ntw6Jxh$or zkr_R?nS5na`N+P&ZetkPyC6b!XR_S3pD~YO z&(983m$NFY<+Jk$rn>A`kMGb|yF6FvuBPqVc6@3f+veIO%T=BltnRbEjh{Vx!TufY z&sl45wXl(UDsyzo?h%>w)81=j`IPXJZ3OOBr)4wdRCe?|q1r2QSC#|G)UU-;?BKTc zGD_9G|BgX$fu6LA*vogTGs||*S9r1=>~&QjRj#1`{P< zHGdl>R2#Ns8?0%jX$G7V)phJ&apPxq&RJMd&x_vz#oVdNpE2L6Tw8N>THYJ?w + + + netcoreapp2.1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Specflow.DSL.Examples/Tests/ExampleSteps.cs b/Specflow.DSL.Examples/Steps/ExamplesStepDefinitions.cs similarity index 60% rename from Specflow.DSL.Examples/Tests/ExampleSteps.cs rename to Specflow.DSL.Examples/Steps/ExamplesStepDefinitions.cs index e8a46ec..22f6e78 100644 --- a/Specflow.DSL.Examples/Tests/ExampleSteps.cs +++ b/Specflow.DSL.Examples/Steps/ExamplesStepDefinitions.cs @@ -1,110 +1,109 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Text.RegularExpressions; -using TechTalk.SpecFlow; - -namespace Specflow.DSL -{ - [Binding] - public sealed class ExampleSteps - { - - [When(@"entered int (.*)")] - public void GivenEnteredInt(int p0) - { - - } - - [Then(@"verify int (.*) equals (.*)")] - public void ThenVerifyIntEquals(int p0, int p1) - { - Assert.AreEqual(p1, p0); - } - - [When(@"entered string ""(.*)""")] - public void GivenEnteredString(string p0) - { - } - - [Given(@"I have a cutomerise pattern mapping ""(.*)"" to ""(.*)""")] - public void GivenIHaveACutomerisePatternMappingTo(string keyword, string value) - { - ((IParameterTransform) - (ScenarioContext.Current.GetBindingInstance(typeof(IParameterTransform)))) - .addTransformer(s => s.ToLower() == keyword.ToLower() ? value : s); - } - - [Given(@"I have a cutomerise pattern to support calculation")] - public void GivenIHaveACutomerisePatternToSupportCalculation() - { - ((IParameterTransform) - (ScenarioContext.Current.GetBindingInstance(typeof(IParameterTransform)))) - .addTransformer(s => - { - var m = Regex.Match(s, "([0-9]+)(\\+|\\-|\\*|\\/)([0-9]+)"); - if (m.Success) - { - switch (m.Groups[2].Value) - { - case "+": - return (int.Parse(m.Groups[1].Value) + int.Parse(m.Groups[3].Value)).ToString(); - case "-": - return (int.Parse(m.Groups[1].Value) - int.Parse(m.Groups[3].Value)).ToString(); - case "*": - return (int.Parse(m.Groups[1].Value) * int.Parse(m.Groups[3].Value)).ToString(); - case "/": - return (int.Parse(m.Groups[1].Value) / int.Parse(m.Groups[3].Value)).ToString(); - default: - return s; - } - } - return s; - } - ); - } - - - - [Given(@"I have a pattern to transform ""(.*)"" to ""(.*)""")] - public void GivenIHaveAPatternToTransformTo(string p0, string p1) - { - - } - - [Then(@"verify string ""(.*)"" equals ""(.*)""")] - public void ThenVerifyStringEquals(string p0, string p1) - { - Assert.AreEqual(p1, p0); - } - - [When(@"entered long string")] - public void GivenEnteredLongString(string multilineText) - { - var target = @" - ok, - 50"; - Assert.AreEqual(target, multilineText); - } - - [Then(@"verify string ""(.*)"" matches ""(.*)""")] - public void ThenVerifyStringMatches(string str2Match, string regex) - { - Assert.IsTrue(new Regex(regex).IsMatch(str2Match)); - } - - [Then(@"verify string ""(.*)"" is not defined")] - public void ThenVerifyStringIsNotDefined(string p0) - { - object var; - Assert.IsFalse(ScenarioContext.Current.TryGetValue(p0, out var)); - - } - - [When(@"use table with the following details:")] - public void WhenUseTableWithTheFollowingDetails(Table table) - { - - } - - - } -} +using Specflow.DSL; +using TechTalk.SpecFlow; +using FluentAssertions; +using System.Text.RegularExpressions; + +namespace Examples.Steps +{ + [Binding] + public sealed class ExamplesStepDefinitions + { + + [When(@"entered int (.*)")] + public void GivenEnteredInt(int p0) + { + + } + + [Then(@"verify int (.*) equals (.*)")] + public void ThenVerifyIntEquals(int p0, int p1) + { + p1.Should().Be(p0); + } + + [When(@"entered string ""(.*)""")] + public void GivenEnteredString(string p0) + { + } + + [Given(@"I have a cutomerise pattern mapping ""(.*)"" to ""(.*)""")] + public void GivenIHaveACutomerisePatternMappingTo(string keyword, string value) + { + ((IParameterTransform) + (ScenarioContext.Current.GetBindingInstance(typeof(IParameterTransform)))) + .addTransformer(s => s.ToLower() == keyword.ToLower() ? value : s); + } + + [Given(@"I have a cutomerise pattern to support calculation")] + public void GivenIHaveACutomerisePatternToSupportCalculation() + { + ((IParameterTransform) + (ScenarioContext.Current.GetBindingInstance(typeof(IParameterTransform)))) + .addTransformer(s => + { + var m = Regex.Match(s, "([0-9]+)(\\+|\\-|\\*|\\/)([0-9]+)"); + if (m.Success) + { + switch (m.Groups[2].Value) + { + case "+": + return (int.Parse(m.Groups[1].Value) + int.Parse(m.Groups[3].Value)).ToString(); + case "-": + return (int.Parse(m.Groups[1].Value) - int.Parse(m.Groups[3].Value)).ToString(); + case "*": + return (int.Parse(m.Groups[1].Value) * int.Parse(m.Groups[3].Value)).ToString(); + case "/": + return (int.Parse(m.Groups[1].Value) / int.Parse(m.Groups[3].Value)).ToString(); + default: + return s; + } + } + return s; + } + ); + } + + + + [Given(@"I have a pattern to transform ""(.*)"" to ""(.*)""")] + public void GivenIHaveAPatternToTransformTo(string p0, string p1) + { + + } + + [Then(@"verify string ""(.*)"" equals ""(.*)""")] + public void ThenVerifyStringEquals(string p0, string p1) + { + p1.Should().Be(p0); + } + + [When(@"entered long string")] + public void GivenEnteredLongString(string multilineText) + { + var target = @" + ok, + 50"; + target.Should().Be(multilineText); + } + + [Then(@"verify string ""(.*)"" matches ""(.*)""")] + public void ThenVerifyStringMatches(string str2Match, string regex) + { + new Regex(regex).IsMatch(str2Match).Should().BeTrue(); + } + + [Then(@"verify string ""(.*)"" is not defined")] + public void ThenVerifyStringIsNotDefined(string p0) + { + object var; + ScenarioContext.Current.TryGetValue(p0, out var).Should().BeFalse(); + + } + + [When(@"use table with the following details:")] + public void WhenUseTableWithTheFollowingDetails(Table table) + { + + } + } +} diff --git a/Specflow.DSL.Examples/Tests/Examples.feature.cs b/Specflow.DSL.Examples/Tests/Examples.feature.cs deleted file mode 100644 index 8d070c5..0000000 --- a/Specflow.DSL.Examples/Tests/Examples.feature.cs +++ /dev/null @@ -1,220 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by SpecFlow (http://www.specflow.org/). -// SpecFlow Version:1.9.0.77 -// SpecFlow Generator Version:1.9.0.0 -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ -#region Designer generated code -#pragma warning disable -namespace Specflow.DSL.Examples.Tests -{ - using TechTalk.SpecFlow; - - - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute()] - public partial class ExamplesFeature - { - - private static TechTalk.SpecFlow.ITestRunner testRunner; - -#line 1 "Examples.feature" -#line hidden - - [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()] - public static void FeatureSetup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext) - { - testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); - TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Examples", "", ProgrammingLanguage.CSharp, new string[] { - "UT"}); - testRunner.OnFeatureStart(featureInfo); - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute()] - public static void FeatureTearDown() - { - testRunner.OnFeatureEnd(); - testRunner = null; - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute()] - public virtual void TestInitialize() - { - if (((TechTalk.SpecFlow.FeatureContext.Current != null) - && (TechTalk.SpecFlow.FeatureContext.Current.FeatureInfo.Title != "Examples"))) - { - Specflow.DSL.Examples.Tests.ExamplesFeature.FeatureSetup(null); - } - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.TestCleanupAttribute()] - public virtual void ScenarioTearDown() - { - testRunner.OnScenarioEnd(); - } - - public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) - { - testRunner.OnScenarioStart(scenarioInfo); - } - - public virtual void ScenarioCleanup() - { - testRunner.CollectScenarioErrors(); - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("int")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Examples")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute("UT")] - public virtual void Int() - { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("int", ((string[])(null))); -#line 4 -this.ScenarioSetup(scenarioInfo); -#line 5 - testRunner.When("entered int [[var=50]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 6 - testRunner.Then("verify int [[var]] equals 50", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - this.ScenarioCleanup(); - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("string")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Examples")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute("UT")] - public virtual void String() - { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("string", ((string[])(null))); -#line 8 -this.ScenarioSetup(scenarioInfo); -#line 9 - testRunner.When("entered string \"[[var=50]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 10 - testRunner.Then("verify string \"[[var]]\" equals \"50\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - this.ScenarioCleanup(); - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("regex generate")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Examples")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute("UT")] - public virtual void RegexGenerate() - { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("regex generate", ((string[])(null))); -#line 12 -this.ScenarioSetup(scenarioInfo); -#line 13 - testRunner.When("entered string \"[[var=RegEx([a-z]{3}[0-9]{1,9})]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 14 - testRunner.Then("verify string \"[[var]]\" matches \"[a-z]{3}[0-9]{1,9}\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - this.ScenarioCleanup(); - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("table")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Examples")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute("UT")] - public virtual void Table() - { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("table", ((string[])(null))); -#line 16 -this.ScenarioSetup(scenarioInfo); -#line hidden - TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { - "Field", - "Value"}); - table1.AddRow(new string[] { - "name", - "[[var=DesiredValue]]"}); -#line 17 - testRunner.When("use table with the following details:", ((string)(null)), table1, "When "); -#line 20 - testRunner.Then("verify string \"[[var]]\" equals \"DesiredValue\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - this.ScenarioCleanup(); - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("nested")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Examples")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute("UT")] - public virtual void Nested() - { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("nested", ((string[])(null))); -#line 22 -this.ScenarioSetup(scenarioInfo); -#line 23 - testRunner.When("entered string \"[[var=part1]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 24 - testRunner.And("entered string \"[[var2=[[var]] part2]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 25 - testRunner.Then("verify string \"[[var2]]\" equals \"part1 part2\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - this.ScenarioCleanup(); - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("customerise pattern")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Examples")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute("UT")] - public virtual void CustomerisePattern() - { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("customerise pattern", ((string[])(null))); -#line 27 -this.ScenarioSetup(scenarioInfo); -#line 28 - testRunner.Given("I have a cutomerise pattern mapping \"MyKeyword\" to \"MyKeywordValue\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line 29 - testRunner.When("entered string \"[[var=MyKeyword]]\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 30 - testRunner.Then("verify string \"[[var]]\" equals \"MyKeywordValue\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - this.ScenarioCleanup(); - } - - [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] - [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("add calculation")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Examples")] - [Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute("UT")] - public virtual void AddCalculation() - { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("add calculation", ((string[])(null))); -#line 32 -this.ScenarioSetup(scenarioInfo); -#line 33 - testRunner.Given("I have a cutomerise pattern to support calculation", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line 34 - testRunner.When("entered int [[var=50]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 35 - testRunner.And("entered int [[var2=[[var]]+1]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 36 - testRunner.Then("verify int [[var2]] equals 51", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line 37 - testRunner.When("entered int [[var2=[[var]]*2]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 38 - testRunner.Then("verify int [[var2]] equals 100", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line 39 - testRunner.When("entered int [[var2=[[var]]/2]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 40 - testRunner.Then("verify int [[var2]] equals 25", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line 41 - testRunner.When("entered int [[var2=[[var]]-[[var]]]]", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); -#line 42 - testRunner.Then("verify int [[var2]] equals 0", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); -#line hidden - this.ScenarioCleanup(); - } - } -} -#pragma warning restore -#endregion diff --git a/Specflow.DSL.Examples/packages.config b/Specflow.DSL.Examples/packages.config deleted file mode 100644 index 226921e..0000000 --- a/Specflow.DSL.Examples/packages.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Specflow.DSL.SpecflowPlugin/App.config b/Specflow.DSL.SpecflowPlugin/App.config deleted file mode 100644 index f1489d7..0000000 --- a/Specflow.DSL.SpecflowPlugin/App.config +++ /dev/null @@ -1,9 +0,0 @@ - - - -
- - - - - \ No newline at end of file diff --git a/Specflow.DSL.SpecflowPlugin/App.config.transform b/Specflow.DSL.SpecflowPlugin/App.config.transform deleted file mode 100644 index cb93de3..0000000 --- a/Specflow.DSL.SpecflowPlugin/App.config.transform +++ /dev/null @@ -1,11 +0,0 @@ - - - -
- - - - - - - \ No newline at end of file diff --git a/Specflow.DSL.SpecflowPlugin/DSLPlugin.cs b/Specflow.DSL.SpecflowPlugin/DSLPlugin.cs index 0f7c64c..eb92a97 100644 --- a/Specflow.DSL.SpecflowPlugin/DSLPlugin.cs +++ b/Specflow.DSL.SpecflowPlugin/DSLPlugin.cs @@ -1,21 +1,21 @@ using TechTalk.SpecFlow; -using TechTalk.SpecFlow.Plugins; -using TechTalk.SpecFlow.UnitTestProvider; - -[assembly: RuntimePlugin(typeof(Specflow.DSL.DSLPlugin))] - -namespace Specflow.DSL -{ - public class DSLPlugin : IRuntimePlugin - { - public void Initialize(RuntimePluginEvents runtimePluginEvents, RuntimePluginParameters runtimePluginParameters, - UnitTestProviderConfiguration unitTestProviderConfiguration) - { - runtimePluginEvents.CustomizeTestThreadDependencies += (sender, args) => - { - args.ObjectContainer.RegisterTypeAs(); - args.ObjectContainer.RegisterTypeAs(); - }; - } - } +using TechTalk.SpecFlow.Plugins; +using TechTalk.SpecFlow.UnitTestProvider; + +[assembly: RuntimePlugin(typeof(Specflow.DSL.DSLPlugin))] + +namespace Specflow.DSL +{ + public class DSLPlugin : IRuntimePlugin + { + public void Initialize(RuntimePluginEvents runtimePluginEvents, RuntimePluginParameters runtimePluginParameters, + UnitTestProviderConfiguration unitTestProviderConfiguration) + { + runtimePluginEvents.CustomizeTestThreadDependencies += (sender, args) => + { + args.ObjectContainer.RegisterTypeAs(); + args.ObjectContainer.RegisterTypeAs(); + }; + } + } } \ No newline at end of file diff --git a/Specflow.DSL.SpecflowPlugin/ParameterTransform.cs b/Specflow.DSL.SpecflowPlugin/ParameterTransform.cs index cca1acb..839c368 100644 --- a/Specflow.DSL.SpecflowPlugin/ParameterTransform.cs +++ b/Specflow.DSL.SpecflowPlugin/ParameterTransform.cs @@ -6,6 +6,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using TechTalk.SpecFlow; +using TechTalk.SpecFlow.Bindings; namespace Specflow.DSL { @@ -14,6 +15,8 @@ public interface IParameterTransform string Transform(string param); IParameterTransform addTransformer(Func transform); } + + public class ParameterTransform : IParameterTransform { List> _additonalTransformers = new List>(); diff --git a/Specflow.DSL.SpecflowPlugin/Specflow.DSL.SpecFlowPlugin.csproj b/Specflow.DSL.SpecflowPlugin/Specflow.DSL.SpecFlowPlugin.csproj index 00048e6..22206e1 100644 --- a/Specflow.DSL.SpecflowPlugin/Specflow.DSL.SpecFlowPlugin.csproj +++ b/Specflow.DSL.SpecflowPlugin/Specflow.DSL.SpecFlowPlugin.csproj @@ -1,20 +1,49 @@ - - - - net45;netstandard2.0 - Specflow.DSL.SpecFlowPlugin - true - $(MSBuildThisFileDirectory)Specflow.DSL.SpecFlowPlugin.nuspec - 2.0.0 - - - - - - - + + + + net461;netstandard2.0 + Specflow.DSL.SpecFlowPlugin + true + SpecFlow.DSL + 3.0.0 + SpecFlow Additional DSL plugin + Wenyuan(Ryan) Song + + An enhancement to Specflow DSL to be able to use dynamic test data in specflow steps by bringing in variables, regular expressions and simple calculations. +**Examples**: + +- Create dynamic test data and refer it in another step + +When enter [[var=50]] //assign 50 to a variable named "var" + +Then [[var]] equals 50 // now get variable "var" value + +- Create dynamic test data using regular expression + +When enter [[var=RegEx([0-9]{3})]] //assign var with 3 digit random number + +Then [[var]] is a 3 digits number // now get variable "var" value + +- Calculations are currently NOT supported + Copyright © 2021 Wenyuan(Ryan) Song + https://github.com/wenyuansong/SpecFlow.DSL + https://github.com/wenyuansong/SpecFlow.DSL + specflow DSL variables context + v3.0.0 : support specflow 3.X + LICENSE.txt + git + + - - - - + + + + + + + True + + + + + diff --git a/Specflow.DSL.SpecflowPlugin/Specflow.DSL.SpecFlowPlugin.nuspec b/Specflow.DSL.SpecflowPlugin/Specflow.DSL.SpecFlowPlugin.nuspec index d4008c3..d8c13e1 100644 --- a/Specflow.DSL.SpecflowPlugin/Specflow.DSL.SpecFlowPlugin.nuspec +++ b/Specflow.DSL.SpecflowPlugin/Specflow.DSL.SpecFlowPlugin.nuspec @@ -2,7 +2,7 @@ SpecFlow.DSL - 2.0.0 + 3.0.0 SpecFlow Additional DSL plugin Wenyuan(Ryan) Song Wenyaun(Ryan) Song @@ -32,20 +32,20 @@ Then [[var]] is a 3 digits number // now get variable "var" value false specflow DSL variables context - - - + + + - - + + - + diff --git a/Specflow.DSL.SpecflowPlugin/packages.config b/Specflow.DSL.SpecflowPlugin/packages.config deleted file mode 100644 index 2066d61..0000000 --- a/Specflow.DSL.SpecflowPlugin/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Specflow.DSL.sln b/Specflow.DSL.sln index 38882dc..946b00e 100644 --- a/Specflow.DSL.sln +++ b/Specflow.DSL.sln @@ -1,16 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 -VisualStudioVersion = 16.0.28803.156 +VisualStudioVersion = 16.0.30330.147 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Specflow.DSL.SpecFlowPlugin", "Specflow.DSL.SpecflowPlugin\Specflow.DSL.SpecFlowPlugin.csproj", "{CACF906A-7230-4E37-984C-739AB1620995}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Specflow.DSL.SpecflowPlugin", "Specflow.DSL.SpecflowPlugin\Specflow.DSL.SpecflowPlugin.csproj", "{5B8AC786-1724-48C9-9DA2-C4E07B1EAF53}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F6B4EBE9-9995-403D-BC3F-AD26CD6E960F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{03CADB7D-4219-473D-8C15-CAEA12B6E0F4}" ProjectSection(SolutionItems) = preProject - Directory.Build.targets = Directory.Build.targets + LICENSE.txt = LICENSE.txt + README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Specflow.DSL.Examples\Examples.csproj", "{214D07C8-07D4-44A0-B78C-E79D2750B0D1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Specflow.DSL.Examples", "Specflow.DSL.Examples\Specflow.DSL.Examples.csproj", "{014AE8D9-95BD-4FC9-9A27-ED59E9D0EBBB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -18,19 +19,19 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CACF906A-7230-4E37-984C-739AB1620995}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CACF906A-7230-4E37-984C-739AB1620995}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CACF906A-7230-4E37-984C-739AB1620995}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CACF906A-7230-4E37-984C-739AB1620995}.Release|Any CPU.Build.0 = Release|Any CPU - {214D07C8-07D4-44A0-B78C-E79D2750B0D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {214D07C8-07D4-44A0-B78C-E79D2750B0D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {214D07C8-07D4-44A0-B78C-E79D2750B0D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {214D07C8-07D4-44A0-B78C-E79D2750B0D1}.Release|Any CPU.Build.0 = Release|Any CPU + {5B8AC786-1724-48C9-9DA2-C4E07B1EAF53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B8AC786-1724-48C9-9DA2-C4E07B1EAF53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B8AC786-1724-48C9-9DA2-C4E07B1EAF53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B8AC786-1724-48C9-9DA2-C4E07B1EAF53}.Release|Any CPU.Build.0 = Release|Any CPU + {014AE8D9-95BD-4FC9-9A27-ED59E9D0EBBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {014AE8D9-95BD-4FC9-9A27-ED59E9D0EBBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {014AE8D9-95BD-4FC9-9A27-ED59E9D0EBBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {014AE8D9-95BD-4FC9-9A27-ED59E9D0EBBB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {CF1B75FE-E67E-486F-9B92-BDBAD9A8B86A} + SolutionGuid = {80415254-3C3E-4ED6-8333-14B22B47F05C} EndGlobalSection EndGlobal