DEV Community

Discussion on: Should one get good at test-last development before learning TDD?

Collapse
 
heatherw profile image
Heather Williams

TDD is mostly useful for brand new code that is well spec'ed and has good design and requirement analysis in place. In the real world though we seldom have that so while we may try and start with the tests on a new project things get messy fast and scope creep happens or the requirements shift or the project simply takes too long and ends up diverging from what we thought we needed.
As has already been stated in the discussion: write tests whenever it is most suitable in the project but make sure you write them. Yes testing last can lead to issues with missing edge cases and tailoring the tests to the code written. But that is also part of learning how to write good tests.
That said I believe in never slavishly adhering to anything but rather looking at the context in which you are working and adjusting what you do to that context. Some things are inherently hard to test and while tests would be great if you don't have a dedicated team for testing then tests might just not happen for those trickier cases.