Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use specflow at unit test level? [duplicate]

Possible Duplicate:
SpecFlow/BDD for Unit Tests?

Over the last few years I have worked in TDD using NUnit/Moq and over the last few months I have been getting to grips with BDD using mSpec.

So far so good but we now want to move more into acceptance criteria based tests where the business analysts are involved and we get an outside in development process.

So now we have predefined Gherkin syntax files and with specflow it feels the right way to work.

However, at a unit test level having predefined Gherkin files would go against what I understand about TDD. In other words, you design as you go a long evolving your design with behaviour.

As we are working using the outside in approach, now at unit test level could it be that we now have the specifications/behaviors that can now be used to drive my unit tests (just feels like it is against the way I have been doing TDD)?

Earlier these files were important for acceptance tests but as a developer I will work alone so they are not necessary unless I use SpecFlow.

Also what benefit would we have at a unit test level having GWT files maintained when we are using mspec? Developers should be able to just jump into the code and read the tests or just run the test runner to see what it is doing.

TIA JD

like image 684
JD. Avatar asked Nov 23 '11 12:11

JD.


People also ask

Can unit test be integrated with SpecFlow?

SpecFlow supports several unit test framework you can use to execute your tests. To use a specific unit test provider, you have to add it's dedicated NuGet package to your project. You can only have one of these packages added to your project at once.

Is it possible to replace unit test with SpecFlow?

Yes you might be right.

Why should I use SpecFlow?

SpecFlow helps to define, manage, and automatically execute human-readable tests in . NET projects. It facilitates collaboration between all business stakeholders. SpecFlow uses simple English language and acts as a bridge between business and technical languages.

Is BDD good for unit testing?

BDD test frameworks are not meant for writing unit tests. Unit tests are meant to be low-level, program-y tests for individual functions and methods. Writing Gherkin for unit tests is doable, but it is overkill. It is much better to use established unit test frameworks like JUnit, NUnit, and pytest.


1 Answers

My spontaneous answer is No.

Tha main benefit of BDD and tools like specflow and Cucumber is communication with the stakeholders of the project and creating a shared understanding of what is to be built.

The main benefit of TDD is to take small steps through a solutions implementation, ensuring that you build maintainable and great code.

Or if you want; BDD is about ensuring that we're building the right thing, TDD is about ensuring that we're building it right.

I answered a question like this the other day on my blog, if you want more details; http://www.marcusoft.net/2011/11/bdd-and-technical-scenarios.html

like image 154
Marcus Hammarberg Avatar answered Oct 11 '22 13:10

Marcus Hammarberg