Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do TDD and BDD relate to each other in Rails 3?

Im a beginner when it comes to TDD and BDD.

This is what I know:

To use TDD in Rails I use it's built-in unit-, functional and integration tests.

To use BDD in Rails I use Cucumber.

So are these two different techniques that shouldn't be used together?

If I use TDD, then I shouldn't use BBD/Cucumber and vice versa?

Please enlighten me on this topic.

Thanks

like image 398
never_had_a_name Avatar asked Aug 03 '10 19:08

never_had_a_name


People also ask

How are both BDD and TDD used together for testing?

BDD and TDD may seem very similar since they are both testing strategies for a software application. In both cases, the developer writes the test before writing the code to make the test pass. And in both cases, the tests can be used as part of an automated testing framework to prevent bugs.

What is BDD and TDD in rails?

As a rule, TDD is used to write tests by programmers for programmers, and BDD tests can be written not only by software developers, but also by managers, testers and even by the customer. BDD is a ready-to-use application documentation that allows you to describe software product scenarios in natural language.

Can we use both TDD and BDD together?

Short answer, yes.

How are test driven development TDD and behavior driven development BDD different?

The key difference is the scope. TDD is a development practice while BDD is a team methodology. In TDD, the developers write the tests while in BDD the automated specifications are created by users or testers (with developers wiring them to the code under test.)


1 Answers

Not that I'm a genius at this but here's my humble answer.

Cucumber is great for outline the behavior of your site, incorporating the business solutions and the code together and developing the site properly from it.

Then after this is complete, you create Rspecs to test how data holds in your MVC. Rspec is great for models.

I've been recommended using Factory-Girl for testing controllers.

In conclusion, using all of these provides a very rounded series of tests to ensure that first your business solutions are being met, and second that your architecture can withstand the many angles that can be tested with rspec and factory-girl.

like image 152
Trip Avatar answered Oct 05 '22 14:10

Trip