SpecFlow tricks

I love Specflow. In fact, I rarely write a line of code unless a feature forces me to. It’s a wonderful tool and it’s Visual Studio integration is better than a lot people know. Here are a few things you may not know about.

Go to definition (F12) on a clause will take you straight to that step definition.

Are you running the tests in order to have missing steps generated so you can cut/paste them? This leads to a ton of Pending steps all mixed up and hard to maintain. Hit F12 on the clause you’re going to implement RIGHT NOW instead, and SpecFlow will place the definition, if missing, in your clipboard so you can stick it in the correct place.

Open a feature file and right-click on a single scenario. Choose Run SpecFlow Scenarios and only that specific scenario will be run.

If you’re using SpecFlow for SharePoint development you’ll know that SpecFlow will break your SharePoint features. Once you add a new SP feature, right-click it and clear the custom tool property in the property pane. The broken code-behind will be removed and things will work.

You can set breakpoints in your feature files, just be sure to select Debug SpecFlow Scenarios.

I keep finding new things about this tool, so I’m sure there will be more findings posted.

This entry was posted in Uncategorized and tagged . Bookmark the permalink.
  • Marcusoft Hammarberg

    Great post – proud to say that I pitched a few of those ideas.

    My personal favorite is the way tables are reformatted as you enter the last pipe-character of each row. It very easy but saves A LOT of time. Especially when you go back and change a sceanrio.

    • http://twitter.com/tobias_karlsson Tobias Karlsson

      I have a hard time picking a favourite, as all of these are things I do repeatedly, often several times an hour. It speeds things up A LOT.
      It’s funny how you’re so often talking to someone, saying “I just wish you could do this”, demonstrating what you would want it to do, and suddenly it works. Right-clicking a specific scenario was one of those, and that one saves me a lot of hours each week :)

  • http://damianbailey.webstarts.com/ ActonSantiago

    I am happy to find so many useful information here in the post, we need
    develop more strategies in this regard, thanks for sharing.