At which architecture level are you running BDD tests (e.g. Cucumber)

bddcucumberspecflow

I have in the last year gotten quite fond of using SpecFlow (which is a .NET port of Cucumber)

I have used it both to test a ASP.NET MVC application at the web layer, i.e. using browser automation, but also at the controller layer.
The first gives me a higher confidence in the correctness of the application, because JavaScript is tested, and improper controller configuration is also caught.

But those tests are slower to execute, and more complex to implement, than those just testing on the controller layer.

My tests are full functional tests, i.e. they exercise all layers of the application, all the way down to the database. So the first thing before any scenario is that the database is cleared of data, allowing the test to assume that only data specified in the "Given" block exists.

Then I see example on how to use it, where they test just exercise the model layer.

So what are your experiences with these tools? Which layer of the application do you test?

Best Answer

It is important to keep the testing triangle in mind when creating tests:

alt text

This means you should create many more tests at the lower levels of the triangle, and spend less time higher up. It is more costly to maintain end-to-end tests than unit tests.

Related Topic