DEV Community

Discussion on: What were your problems with "real world TDD"?

Collapse
 
bgadrian profile image
Adrian B.G. • Edited

Yes, I had a huge problem, it doesn't exists, at least in my "real world", outside of the corporate area or simple 100 LOC examples there are only a few areas it can be applied.
In the Real world we have legacy code, undecided business logic, coworkers that do not want to make tests and product owners that explicitly ignore the benefits, we also have projects with an uncertainty life span.

Anyway I have just one request, please do not make the same mistake as most of the religious articles I keep seeing: attributing all the glory to TDD.

Most of the benefits, ROI, less bugs, able to refactor, code flexibility, acting as code documentation, ....... are the results of doing "automatic tests" that includes unit tests, not because you apply one methodology like TDD or BDD.

Make a distinction between Unit tests and how you can write them. There are some benefits from doing TDD but in comparison to the entire AutomaticTests picture is a small list.

Collapse
 
n_develop profile image
Lars Richter

Hi BG Adrian,

I'm absolutely with you. This post / discussion is not meant to show TDD as a cure for everything.

You are right, that most of the benefits, like ability to refactor your code safely, are results of your test suite. It's important to point that out. Thanks for your feedback.

But: TDD is a great way to ensure this test suite. If you follow the TDD cycle, you get the benefits of an automated test suite "for free". As some of the community members already pointed out, writing tests after writing your code, is a pain in a lot of cases. And that's why a lot of people don't write tests at all.

But once again: Automated tests are the biggest / the main benefits of TDD.