Replies: 2 comments 1 reply
-
You are running into an undocumented feature that has stopped working in the unreleased v4 version of specflow which was used as the basis for ReqnRoll. |
Beta Was this translation helpful? Give feedback.
-
I have found the related things, so posting it here as well: See discussion at #238. Based on that @olegKoshmeliuk has made the interface to override the behavior per-project (to support legacy / migration cases). Could you please try if overriding that integrace and implementing the more SpecFlow-compatibility handling way of regex groups would work for you? If yes, we could add it as a sample solution to https://docs.reqnroll.net/latest/guides/how-to-configure-cucumber-expression-behavior.html |
Beta Was this translation helpful? Give feedback.
-
This used to work in SpecFlow v3 (with SpecFlow+ Runner), but now trying ReqnRoll (with MSTest) and there are RegEx matching and binding problems.
The C# code. There are "optional" parameters (capturing groups)
My first example Gherkin step
The step is matched, but the binding is confused.
-> binding error: Parameter count mismatch! The binding method '...MySteps.RememberTest(String, String, String, String)' should have 2 parameters
My 2nd example Gherkin step
The step is not matched
The suggestion is
[Given("I test {string} as {string} plus {string}")]
public void GivenITestAsPlus(string variable0, string p1, string p2)
In my external C# test program, I've confimed the regex matching / groups
DoMatch: I test 'variable' as 'nameOrValue1-A'
Matched:
Full Match: I test 'variable' as 'nameOrValue1-A'
Group 1 - keyword : 'test'
Group 2 - variable : 'variable'
Group 3 - nameOrValue1 : 'nameOrValue1-A'
Group 4 - deviationKeyword : ''
Group 5 - nameOrValue2 : ''
DoMatch: I test 'variable' as 'nameOrValue1-A' plus 'nameOrValue2-B'
Matched:
Full Match: I test 'variable' as 'nameOrValue1-A' plus 'nameOrValue2-B'
Group 1 - keyword : 'test'
Group 2 - variable : 'variable'
Group 3 - nameOrValue1 : 'nameOrValue1-A'
Group 4 - deviationKeyword : 'plus'
Group 5 - nameOrValue2 : 'nameOrValue2-B'
I've also tried " = null" for the optional parameters, and get the same errors.
public void RememberTest(string label, string nameOrValue2, string deviateTypeKeyword = null, string nameOrValue3 = null)
I've also tried removing initial capture group "(test)"
[Given(@"I\s*test\s+'([^']+)'\s+as\s+'([^']+)'(?:\s+(plus|minus)\s+'([^']+)')?")]
public void RememberTest(string label, string nameOrValue2, string deviateTypeKeyword, string nameOrValue3)
Beta Was this translation helpful? Give feedback.
All reactions