Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BDD And Unit Testing

Tags:

.net

tdd

bdd

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.

like image 293
Jamie Avatar asked Feb 24 '10 19:02

Jamie


People also ask

Can BDD be used for unit testing?

In this article, we'll see how Behavior Driven Development / Acceptance Test Driven Development (BDD/ATDD) can apply all the way from the Customer / User Tests to Unit Tests. These are the tests in the left column of the matrix. To illustrate this process, I'll use the example of an on-line ordering system.

Is unit testing TDD or BDD?

Unit testing is a type of automated testing. You can write unit testing without using TDD or BDD, just by writing the tests after the production code. TDD is a software development methodology, in which the developer writes code in very short cycles, always starting with a failing test.

Is Cucumber used for unit testing?

There is quite a lot of overhead in using cucumber for unit testing. Not only you have to write the features but then map them to the implementation using a separate bit of code. Unit testing is meant to be very fast to write and very fast to execute.

What is BDD approach in testing?

What is BDD (Behavior-Driven Development)? Behavior-driven development is a testing practice that follows the idea of specification by example (e.g., Test-Driven Development [TDD]). The idea is to describe how the application should behave in a very simple user/business-focused language.


1 Answers

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/

like image 110
Michael Pardo Avatar answered Nov 02 '22 00:11

Michael Pardo