Generics in Setup #376
-
I am migrating from SpecFlow to Reqnroll - understandably in a relative hurry. I chose to bypass the SpecFlow compatibiliy assembly and just rename Techtalk.Specflow to Reqnroll. That surprisingly made everything build without problems right away. That is something we can refactor around, but it brings two questions:
And apart from that: thanks for the fork, this is going to save us a lot of trouble now that SpecFlow will be gone in 3 days. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi, Looks like you trying to use open generics in bindings. Ideally add example proejct to get an idea where you using open generic types in Specflow or Reqnroll. [Binding] // this will throw you error
public class StepsBase<T> { }
[Binding]
public class UserSteps: StepsBase<User> { } code related to your error: |
Beta Was this translation helpful? Give feedback.
-
Can you show example project with valid code? (just create specflow/reqnroll empty project) and edit CalculatorStepDefinitions. BTW original specflow have this check too. |
Beta Was this translation helpful? Give feedback.
-
I believe you, Oleg, but ... my original project compiled and ran fine until klast week with SpecFlow 3.9 - after switching to reqnroll this problem started occurring. My previous post didn't show correclty, for some reason the discussion software removed the 'generic' indication. This is what I had:
I fixed the problem last night by doing this - moving the Binding to the concrete test. No idea how this always worked, we've been using it like above for over a year.
|
Beta Was this translation helpful? Give feedback.
It's new behaviour of reqnroll (maybe it was planned for specflow 4.0). Reqnroll validates all bindings inside
registry
and in case of invalid fails early.Binding attribute is applied to base and all child classes.
For you case you need to move
Binding
attribute from base to child classes that will be created by Reqnroll during steps.