You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the External Data Plugin, if the Scenario Outline that leverages the ExternalDataPlugin is contained within a Rule that happens to have a Background, the generation of code for that feature will not be correct.
The root cause is that the Feature AST visitor used by the External Data Plugin improperly handles Rule Backgrounds. I have a fix to submit against this issue.
Steps to Reproduce
Within a Reqnroll feature, have a feature such as this:
Feature: Calculator
Simple calculator for adding two numbers
Rule: Can also use Rule Backgrounds
Background:
Given the password is KEVIN
@DataSource:externaldata.csv
Scenario Outline: by using a table for inputs and outputs
Given the first number is <first>
And the second number is <second>
When the two numbers are added
Then the result should be <sum>
And the password should be KEVIN
Examples:
| first | second | sum |
| 50 | 70 | 120 |
along with an appropriately matched set of Step Definitions. (see sample repo linked below)
The generated code is:
// ------------------------------------------------------------------------------// <auto-generated>// This code was generated by Reqnroll (https://www.reqnroll.net/).// Reqnroll Version:2.0.0.0// Reqnroll Generator Version:2.0.0.0// // Changes to this file may cause incorrect behavior and will be lost if// the code is regenerated.// </auto-generated>// ------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable
namespaceReqnrollProject1.Features{usingReqnroll;usingSystem;usingSystem.Linq;[System.CodeDom.Compiler.GeneratedCodeAttribute("Reqnroll","2.0.0.0")][System.Runtime.CompilerServices.CompilerGeneratedAttribute()][NUnit.Framework.TestFixtureAttribute()][NUnit.Framework.DescriptionAttribute("Calculator")]publicpartialclassCalculatorFeature{privateglobal::Reqnroll.ITestRunnertestRunner;privatestaticstring[]featureTags=((string[])(null));
#line 1"Calculator.feature"
#line hidden
[NUnit.Framework.OneTimeSetUpAttribute()]publicvirtualasyncSystem.Threading.Tasks.TaskFeatureSetupAsync(){testRunner=global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly();global::Reqnroll.FeatureInfofeatureInfo=newglobal::Reqnroll.FeatureInfo(newSystem.Globalization.CultureInfo("en-US"),"Features","Calculator","Simple calculator for adding two numbers",global::Reqnroll.ProgrammingLanguage.CSharp,featureTags);awaittestRunner.OnFeatureStartAsync(featureInfo);}[NUnit.Framework.OneTimeTearDownAttribute()]publicvirtualasyncSystem.Threading.Tasks.TaskFeatureTearDownAsync(){awaittestRunner.OnFeatureEndAsync();global::Reqnroll.TestRunnerManager.ReleaseTestRunner(testRunner);testRunner=null;}[NUnit.Framework.SetUpAttribute()]publicasyncSystem.Threading.Tasks.TaskTestInitializeAsync(){}[NUnit.Framework.TearDownAttribute()]publicasyncSystem.Threading.Tasks.TaskTestTearDownAsync(){awaittestRunner.OnScenarioEndAsync();}publicvoidScenarioInitialize(global::Reqnroll.ScenarioInfoscenarioInfo){testRunner.OnScenarioInitialize(scenarioInfo);testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs<NUnit.Framework.TestContext>(NUnit.Framework.TestContext.CurrentContext);}publicasyncSystem.Threading.Tasks.TaskScenarioStartAsync(){awaittestRunner.OnScenarioStartAsync();}publicasyncSystem.Threading.Tasks.TaskScenarioCleanupAsync(){awaittestRunner.CollectScenarioErrorsAsync();}[NUnit.Framework.TestAttribute()][NUnit.Framework.DescriptionAttribute("by using a table for inputs and outputs")][NUnit.Framework.CategoryAttribute("DataSource:externaldata.csv")][NUnit.Framework.TestCaseAttribute("50","70","120",null)][NUnit.Framework.TestCaseAttribute("15","35","50",null)][NUnit.Framework.TestCaseAttribute("80","40","120",null)]publicasyncSystem.Threading.Tasks.TaskByUsingATableForInputsAndOutputs(stringfirst,stringsecond,stringsum,string[]exampleTags){string[]@__tags=newstring[]{"DataSource:externaldata.csv"};if((exampleTags!=null)){@__tags=System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Concat(@__tags,exampleTags));}string[]tagsOfScenario=@__tags;System.Collections.Specialized.OrderedDictionaryargumentsOfScenario=newSystem.Collections.Specialized.OrderedDictionary();argumentsOfScenario.Add("first",first);argumentsOfScenario.Add("second",second);argumentsOfScenario.Add("sum",sum);global::Reqnroll.ScenarioInfoscenarioInfo=newglobal::Reqnroll.ScenarioInfo("by using a table for inputs and outputs",null,tagsOfScenario,argumentsOfScenario,featureTags);
#line 8this.ScenarioInitialize(scenarioInfo);
#line hidden
if((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags)||global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))){testRunner.SkipScenario();}else{awaitthis.ScenarioStartAsync();
#line 9awaittestRunner.GivenAsync(string.Format("the first number is {0}",first),((string)(null)),((global::Reqnroll.Table)(null)),"Given ");
#line hidden
#line 10awaittestRunner.AndAsync(string.Format("the second number is {0}",second),((string)(null)),((global::Reqnroll.Table)(null)),"And ");
#line hidden
#line 11awaittestRunner.WhenAsync("the two numbers are added",((string)(null)),((global::Reqnroll.Table)(null)),"When ");
#line hidden
#line 12awaittestRunner.ThenAsync(string.Format("the result should be {0}",sum),((string)(null)),((global::Reqnroll.Table)(null)),"Then ");
#line hidden
#line 13awaittestRunner.AndAsync("the password should be KEVIN",((string)(null)),((global::Reqnroll.Table)(null)),"And ");
#line hidden
}awaitthis.ScenarioCleanupAsync();}}}
#pragma warning restore
#endregion
Note that there is no generated invocation of testRunner.Given for the Rule Background step.
* main:
Bump version
VS Code integration proper doc title (#280)
Fix: Reqnroll generates invalid code for rule backgrounds in Visual Basic (#284)
Update nunit.md (#276)
SolutionTests: Check if SDK version is installed and if not ignore the test (#266)
Fix for #271 This PR modifies the Feature AST visitor to appropriately handle Rule Background steps. (#272)
Bugfix/fix reqnroll.verify parallelization (#255)
Reqnroll Version
2.1
Which test runner are you using?
NUnit
Test Runner Version Number
3.14
.NET Implementation
.NET 8.0
Test Execution Method
Visual Studio Test Explorer
Content of reqnroll.json configuration file
none
Issue Description
When using the External Data Plugin, if the Scenario Outline that leverages the ExternalDataPlugin is contained within a Rule that happens to have a Background, the generation of code for that feature will not be correct.
The root cause is that the Feature AST visitor used by the External Data Plugin improperly handles Rule Backgrounds. I have a fix to submit against this issue.
Steps to Reproduce
Within a Reqnroll feature, have a feature such as this:
along with an appropriately matched set of Step Definitions. (see sample repo linked below)
The generated code is:
Note that there is no generated invocation of testRunner.Given for the Rule Background step.
Link to Repro Project
https://github.com/clrudolphi/DemonstrationOfReqnrollExternalDataPluginIssueWithRuleBackground
The text was updated successfully, but these errors were encountered: