Test vs. Behavior Driven Development

Kevin Jung
2 min readSep 5, 2021

Test Driven Development, or TDD, is an extremely common workflow used throughout the software engineering field. It is the idea of writing the tests before the code that makes them work. It is a good way to lay out the specifics of what you want your program to do before it does it. This can help keep you on track and reduce the amount of bugs that will appear in your code as you write it (since there are already test written to make sure they don’t come up).

Behavior Driven Development is maybe a bit less talked about but is still very common and is very similar to TDD, in fact BDD is just another version of TDD. The main difference between TDD and BDD is the language used to write the tests. BDD has a focus on putting the expected behavior into plain language so it’s easy to understand what is being tested, how, and why. This makes it easy to collaborate on a project with lots of people, even those who aren’t necessarily going to be coding.

There are many benefits to BDD and one I think is important is the confidence it gives the person or people working on the project. With BDD it is clear to everyone what the product should look like so it’s easier to be confident while working on the project that you are making meaningful changes that are pushing the product toward the end goal. This means it’s also easier to share progress with the client as they can see and understand what updates to the project are changing in the final project.

For ruby we have Rspec to use for BDD and it is very effective and makes it easy to write Behavior focused tests. I would recommend this approach to anyone, even if you are just working on a project solo instead of on a team. I think a big benefit for solo developers using BDD is that coming back to a project you haven’t worked on in awhile is much faster and easier to understand where you left off, because of the plain language and easy to understand descriptions in your tests.

No matter what route you choose tests are an important part of software development and can save you a lot of headache in the long run. I would encourage you to take a deeper look at Behavior Driven Development if this is your first time hearing about it and give it a try. I think you’ll be amazed at how it will change your workflow.

--

--