views:

223

answers:

1

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

+3  A: 

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.

Trip
I agree that using both RSpec/Cucumber is a good idea. Personally I learn towards limiting myself to RSpec model tests though, just because Controller/View specs are comparatively hellish to write, and cucumber covers a lot of that ground.
Karl