7 comments so far
Your title is a bit extreme considering that the time savings for having automated unit tests add up substantially over time for long term code compared to having to manually test your code.
Unit testing is actually *very* productive when you look beyond the one time cost of writing a test before you write your code and after that the investment pays off in spades compared to having to repeat manual tests or reason about the code whenever you make a change to a complex or mission critical system.
Unit test aren’t recommended for quick throw away scripts that you believe won’t be reused though. Funny thing is a lot of code does end up getting reused again somehow so it’s not an easy call either.
Thing thing you are missing is when it comes to maintaining code. When something does break and you come along and fix it your unit tests make dammed sure that you fix it properly. You also then create another unit test to capture that issue.
Now im not a fanatical unit tester. I do write them but really only use them for ensuring things will still work later on. That said however they have saved myself from releasing broken code many times.
Yeah I guess you all make a good point. Unit tests aren’t for when you’re coding, they’re for two years later when you’re having problems.
Dunno, maybe I have to get used to them still, but right now they serve mostly to pull me out of the flow and keep jarring me to think about things I don’t feel like thinking about right then. I’m trying to solve a problem, being forced to also solve the problem of testing the solution is just … overkill.
Plus it is especially important in languages with dynamic typing. As you never know whether you have just destroyed one of the “old” functionalities implementing “new” one. For simple project though, I would not bother with all that TDD (its not that I would not bother with unit testing at all!); for really complex ones, developed by tens of devs – its a must (at least from my experience).
Additionally it took you considerable amount of time but you should be quicker with writting unit tests as you gain experience (YES – writting good unit tests in short time is a skill!).
Perhaps you just experienced a steep learning curve.
You wrote you were used to practice “reverse TDD”, but how do you test then ? manually ?
Then it is test-driven, however, it cannot be called TDD.
Do you think you would have achieved more by writing the test last ?

![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=6a93cdb1-80a6-48f1-b314-b9bba65bfebe)
[...] of you may remember mywriting about how unit testing is anti-productive and those of you I have to disapoint, I still dont’ think it’s the best productivity [...]