Jamie
Jamie

Reputation: 115

BDD And Unit Testing

I have been doing TDD and was using it more as unit testing than to drive my design. Recently I have read a lot about BDD; now that I have a better idea about them both, I was trying to figure out how to use BDD and unit testing concurrently.

For example I would drive my design using BDD, Dan North style, and lets say I am working on an app and I have a simple spec and I implement it. I have just enough bdd/spec to cover it. Now after I've re-factored it and am happy and it's passed as done for that spec, should I start writing Unit tests to cover all possible inputs, because that's what I did in TDD?

I am the only developer in the company and everything is on my shoulders, although the other team do try to manual test the app, I would like to lower the defect rate.

Upvotes: 9

Views: 2344

Answers (2)

Jon Kern
Jon Kern

Reputation: 3235

I agree. The RSpec Book book does a decent job of describing the "Outside - In" approach to development. Cucumber (outside) helps describe the expected behavior (in terms that the user understands); and RSpec/*Unit (inside) helps to describe your class' behavior.

Upvotes: 0

Michael Pardo
Michael Pardo

Reputation: 2600

Pick up "The RSpec Book". The book uses Cucumber & RSpec. Could easily be Cucumber & NUnit or something else though. Cucumber and BDD extend the red, green, refactor concept a level deeper.

http://www.pragprog.com/titles/achbd/the-rspec-book

Cucumber: http://cukes.info/
RSpec: http://rspec.info/
NUnit: http://www.nunit.org/
JUnit: http://www.junit.org/

Upvotes: 7

Related Questions