Skip to main content

Sharing method between 2 step definitions

Answered

Comments

2 comments

  • Sam Shackleton

    Hello, here is a blog discussing this very topic: SpecFlow tips: Problems with placing step definitions to base classes.

    The TLDR is that step definitions are defined globally in SpecFlow, that is, step definitions can be accessed from any feature file. This is good in that it helps code reuse, but as you are learning, means that step definitions must be globally unique.

    Also, there aren't any sort of rules in SpecFlow about having 1 step definition class per feature file. You can have 100 features files all using the same single step definition class, or, conversely, have one feature file using 100 step definition classes. Those examples aren't a good idea, but I hope you get my point :)

     

    0
  • Mark Wong

    Interesting blog, many thanks Sam.

    0

Please sign in to leave a comment.

Powered by Zendesk