Wednesday, June 17, 2015

BDD - Tagging Features in SpecFlow

I've been working with SpecFlow for a couple months now on one passion project and I'm starting to get a handle on how to manage features and how to use tags for better organization.


Without further ado, I'll dive into an example:


Suppose you have a requirement with some business rules to determine if a project can start. These rules determine canStart, a boolean. There's another feature that sends some notifications on the project's scheduled start date. The recipients and the contents of the email are to be determined by project.canStart? value. Other logo is also driven by canStart including UI elements and some unicorns and trolls.


How can we organize these features and still keep track of every feature that uses canStart?


Firstly, whatever rules determine can start should be defined in its own feature since that sounds like it could be really complex logic that is highly volatile.


That feature could be tagged as @canStart, @businessLigic, @volatile, whatever else.


The notify start date feature would be in it's own .feature file. It would have several scenarios each tagged with several tags including @canStart since that is a dependency for the notifications.


When you need to change some logic that depends on @canStart, you can just do a tag search and voila! You now know all the dependencies!

No comments:

Post a Comment