Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Step-by-Step SpecFlow testing for Dummies

Are there any really simple step-by-step examples/tutorials of how Unit Testing and Specflow testing works and can be done?

like image 204
Jack Allen Avatar asked Jan 21 '13 10:01

Jack Allen


People also ask

How do you run a SpecFlow test?

In order to execute your SpecFlow tests, you need to define the tests as Gherkin feature files, bind the steps defined in your feature files to your code, and configure a unit test provider to execute the tests. SpecFlow generates executable unit tests from your Gherkin files.

What is SpecFlow in testing?

Specflow is a testing framework supporting BDD practices in . NET framework. It's an open source framework hosted on GitHub. It aids in using ATDD (Acceptance test driver development) for . NET Applications.

Is SpecFlow a BDD tool?

What is SpecFlow? SpecFlow is a BDD framework for . NET which boosts your productivity by helping you with writing your feature files and automation code in your favorite IDE using C# and . NET methods.


2 Answers

Yes, there are, but the big problem is that to do TDD well and understand how Sepcfication By Example (such as SpecFlow) fits in, I'd recommend that you go a little deeper.

If you start with Gojko Adzic's http://gojko.net/2011/02/04/tdd-breaking-the-mould/ then it hopefully will set the big picture. I would recommend paying close attention to the section with the seven-step tdd or dual cycle section of the talk. For me, the specification by example is the outer circle, when we receive a new business requirement, encode it in Gherkin and use Specflow to validate that the feature doesnt work yet.

Then I recommend the use TDD to help develop your code technically. Use multiple tests to shape the development towards meeting your business goal. Having dome Keith Braithwaite's TDD as if you mean it exercise I can really recommend you have a go at this.

Finally your TDD drives your Specification to pass, and at this point I would recommend you consider refactoring everything, consider your production code, your unit tests and even your specifications for simplification and duplication removal. Make it clean.

Good luck.

like image 110
AlSki Avatar answered Sep 28 '22 01:09

AlSki


I learned a lot about BDD (and Specification by example) from this presentation by Matt Wynne: http://skillsmatter.com/podcast/agile-scrum/bdd-as-its-meant-to-be-done

It's not SpecFlow but I'm sure you can learn a lot by it anyway.

For the SpecFlow-tooling I would suggest the free TekPub video: http://vimeo.com/46915798.

like image 34
Marcus Hammarberg Avatar answered Sep 28 '22 00:09

Marcus Hammarberg