How are TDD and BDD related to each other in Rails 3?

I start when it comes to TDD and BDD.

This is what I know:

To use TDD in Rails, I use built-in unit, function, and integration tests.

To use BDD in Rails, I use Cucumber.

So, these are two different methods that cannot be used together?

If I use TDD, then I should not use BBD / Cucumber and vice versa?

Please enlighten me on this topic.

thanks

+6
ruby-on-rails tdd bdd cucumber
source share
2 answers

Not that I was a genius in this, but here is my humble answer.

Cucumber is great for describing the behavior of your site, including joint business solutions and code, as well as developing a site from it.

Then after that you will create Rspecs to check how the data is stored in your MVC. RSpec is great for models.

I was recommended to use Factory -Girl for testing controllers.

In conclusion, using all of this, you get a very rounded series of tests to make sure that your first business decisions are satisfied, and secondly, your architecture can withstand many angles that can be tested with rspec and Factory -girl.

+8
source share

I found that the right combination of what and when and why was the most difficult, given that the network is often present too . A nice blog post outside of BDD that takes you on a journey of testing using Cucumber and RSpec.

The author, Sarah May, explains the flow that the developer agrees to use BDD / TDD, and highlights some caveats when testing controllers, models, and views.

I tend to agree that Rspec is good for models, especially when you have the usual behavior that goes beyond what Rails gives you out of the box. It comes out in RSpec and Cucumber books, it's just that it takes a while to find this stone of testing information, what, when and why!

0
source share

All Articles