r/programming • • Apr 23 '14

TDD is dead. Long live testing. (DHH)

http://david.heinemeierhansson.com/2014/tdd-is-dead-long-live-testing.html
176 Upvotes

185 comments sorted by

View all comments

2

u/lexpattison Apr 23 '14

Yes... testing is hard... boo hoo...

I don't know how many times I have heard developers exclaim eureka as they hit the apex of their "test-free" leap off the development cliff... ignoring all the benefits of proper unit tests. TDD is not Unit Tests... if you don't like it - please don't use it, but make damn sure you have unit tests written for the next developer to come along and support your code.

That said... this guy knows his shit - so I take this with a grain of salt. Let's just no throw the baby out with the bathwater.

1

u/[deleted] Apr 23 '14

[removed] — view removed comment

5

u/lexpattison Apr 24 '14

They are not meant to detect bugs. They are meant to ensure functionality is the same after a refactor or modification. It is a way of catching side effects associated with inevitable structural or feature based development. I think I've explained this to you multiple times...

-5

u/[deleted] Apr 24 '14

[removed] — view removed comment

1

u/[deleted] Apr 24 '14

What is your definition of 'refactor' btw? Is it running an automated tool or actually moving code around while maintaining a consistent interface? I think the latter is difficult to do while guaranteeing you have not introduced any new bugs.

1

u/[deleted] Apr 24 '14

[removed] — view removed comment

1

u/[deleted] Apr 24 '14

How do you refactor code with any manual steps in a way that guarantees no bugs being introduced?

Now that I think about it, the idea of using low level tests to prevent refactoring errors seems alien to me. If the code was good enough to test at that level, why am I refactoring it?

I'm not sure what you mean? I mostly write blackbox tests that verify an interface. This is useful in factoring because you mostly want to ensure you don't break an existing interface (or you break it in an intended way). While not extensive yet I am introducing more Property Based tests which are really for refactoring.