Dev Thoughts

Musings from my development journey.

Topics

Why Should I Use TDD or BDD?

large

There is a lot of talk about Test Driven Development (TTD) and Behavior Driven Development (BBD). Web developers often wonder which they should use, or if they should implement both at different times. The truth is that both are an important part of web development. Take a look at TDD and BDD, and then you will understand why you should utilize both when developing applications.

What is TDD?

TDD consists of automated tests that you can use when designing software. Every time you create a new feature for an application, you write a test for that feature. These tests are based on the developer’s opinion of what each feature should accomplish.

These tests are meant to fail. After all, if they passed, you would be writing code for a feature that already existed. Your job here is to perfect something new that hasn’t worked before. In this case, failure is important as it can guide you toward perfect the feature.

Once the test fails, you need to create the easiest possible solution so the test will pass the next time you run it. You might have to refactor your code to accomplish this. Then you need to write another test and continue with this process until the feature is perfected.

While some people avoid this type of testing, that is a huge mistake. If you fail to utilize TDD, your application might work for a short period of time, but the poorly written code will eventually cause it to fail. When that happens, it might take you weeks to sift through the code and come up with a solution. It is better to spend some extra time on testing before you publish the application. That way, you can fix the problems before the application goes live.

What is BDD?

While TDD is based on the developer’s opinion of what features the application needs, BDD is based on the end user. Starting with the functions that are most important to the end user, you create tests to optimize the user experience.

In order for this to work, you have to get a lot of feedback. Because of that, this is an ongoing process. You need to continue to gather data and use it to create better applications.

TDD or BDD?

In reality, you need to utilize both TDD and BDD. Start with TDD so you can get the fast feedback you need when developing an application. Then, move on to BDD to ensure that the application is built with the end user in mind. That way, you will incorporate all the user specs you need for a good experience.

Testing is the foundation of web development. If you run the right tests at the right times, you will create powerful applications that your users love. Take your time when running tests so you can perfect all the features before your app goes live. This will minimize downtime and create a positive user experience.

B497de5658a215d1da99c98e730ecacc
Here's one comment
Comment posted by Jordan almost 3 years ago
B497de5658a215d1da99c98e730ecacc
And here's another one!
Comment posted by Jordan almost 3 years ago
9837d3963e93ad10123526273ccea602
Hey there, just checking to see if you'll let me comment on your site, Jordan.
Comment posted by Chris over 2 years ago
B71c635e0d9eb72e7b349f9499bb8631
Thanks Jordan, I Just purchased your course and it's awesome! One issue while you are reading a blog content on tablet - side section overflow on the main blog content! I hope you can fix it soon. Thnx
Comment posted by Dev over 2 years ago