0

I thought I read somewhere that step implementations could be tagged, and that tag would be inherited by any scenario consuming that step. I can no longer find any documentation in the API reference. Has anyone else seen or used that feature?

reuscam
  • 1,841
  • 2
  • 18
  • 23
  • 1
    No, and I'm pretty sure trying to tag step definitions even crashes Behave. Tags are meant to be used on features or scenarios. If you tell me exactly what you're tying to achieve, I may be able to find a workaround. – Verv Sep 19 '17 at 16:04
  • Use case: a step interacts with the UI (non ideal for us). This step is used in 100 scenarios, or 10% of all scenarios. We want all those scenarios tagged with "uses_ui" through inheritance. we can tag the step implementation a single time, and all 100 scenarios inherit it. – reuscam Sep 19 '17 at 16:15
  • Another example, we tag fast/slow/glacial. One step by default takes "glacial" time, so by tagging the implementation, we guarantee all scenarios using it are also tagged glacial. – reuscam Sep 19 '17 at 16:23
  • Pretty sure this isn't possible. You'll need to tag each scenarios using it individually. You could automate the process of tagging scenarios using your target step quite easily. Feature files should be relatively easy to parse, then all you have to do is identify which scenarios contain your step and tag them. – Verv Sep 21 '17 at 14:23
  • Setting the Background on the feature could be helpful, basically, you can extract all the common steps as a background and move all the varying stuff to context by tagging each scenario differently. One can use Examples as well, to generalize steps. – fanny Feb 21 '18 at 14:24

0 Answers0