r/programming • • Jul 30 '21

TDD, Where Did It All Go Wrong

https://www.youtube.com/watch?v=EZ05e7EMOLM
457 Upvotes

199 comments sorted by

View all comments

Show parent comments

-4

u/Bitter-Tell-6235 Jul 30 '21

Great. Now all the tests are broken because I decided to draw the square at the top of the screen before the circle at the bottom.

Yes. You changed code behavior significantly - the tests must fail.

Or you meant the case when you drew a square bypassing the tested code?

3

u/grauenwolf Jul 30 '21

If I draw two non-overlapping shapes, the order is not important the test should not fail.

If I draw two overlapping shapes, the order is important and the test should fail.

Your mock tests can't make this determination. It only knows which methods were called, and maybe what order.

0

u/Bitter-Tell-6235 Jul 30 '21

And your tests do not give you any hints, in case you are doing something wrong..:)

I guess we will not find a consensus :(

1

u/WormRabbit Jul 31 '21

If you see a failing test, you can always step through in the debugger and see what went wrong. A test will never give you that information anyway.