TDD vs BDD
TDD
TDD stands for Test Driven Development.
It works like this, you decided what this section of your software does, and before you write the code for that section you write a set of tests to verify that it would work as you expect.
So your writing what your program should do before you ever start writing your actual application.
Why would we do this?
Because it helps you find bugs in your code and forces you to explicitly write what you expect from your program.
Steps to TDD:
- Write your test
- Run the test and any other tests you have in your suite. The new test should fail because no code was written to make it work.
- Write the code to make it pass
- Run the tests and make sure the test passes
- Refactor / Reorganize.
- Repeat from 1 until the project is finished.
BDD
BDD stands for Behavior Driven Development.
BDD is almost the exact same as TDD except for a few different ways of thinking about how you write the tests.
TDD describes how the software works. BDD describes how the user will interact with the application.
So when writing you should focuses on examples of your application and derive your tests from that example.
Which do we use?
We recommend that in this class you use TDD because it focuses more on the software that is being written but know that when you go from this class the company you work for may use BDD in their software development process.