Behaviour Driven Development using Specflow with Webdriver and Nunit – Part 2


Specflow allows you to create features which be executable specifications written in a business-readable language. Manual testers can assist in the automation process by writing these feature files in Gherkin syntax even if they can’t write the automation code itself. The beauty of this is that the end user can either help write these specifications or read and confirm the features are correct and thus gain a great deal of confidence when these executable specifications are run and passed.

Here is an example of a feature file:




So in the example above, we have a feature file with the user story I am testing below it usually given to us by the business. We then create all our business-facing tests also know as acceptance tests.

Each Gherkin Given, When and Then statement will be mapped to Webdriver automation code and thus allows for the executable nature of the specification. Personally I find that these can replace the traditional excel spreadsheet test cases and allow for a much more dynamic way of writing test scenarios allowing more types of people to contribute towards the creation of these and also more types of people to be able to read and understand the tests.

In our final part of this blog series, I will show you how to set up Specflow.