开发者

BDD And Unit Testing

开发者 https://www.devze.com 2022-12-21 16:35 出处:网络
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

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.


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/


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消