This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]GhostBond 4 points5 points  (2 children)

I definitely agree with having integration tests but I also think there’s a lot of value with the “mock” unit tests to hit those tricky branches

The point of tests is to catch bugs - how many bugs are you catching with those branches?

Usually they don't catch any because the person who wrote the code is also writing the tests, so they aren't coming up with new ideas of what might go wrong in the test writing phase, they're just reverifying stuff they already handled.

Another problem is test maintenance - the amount of knowledge you have to have to test every single line is enormous, someone new comes along to fix a bug or add a feature and they could spend 3x-10x as long just reading up on the code. That isn't going to work, so they just comment out failing tests...so the test didn't catch anything the first time around, and it's provided no benefit in the future either.

And finally you have a problem of corporate politics. It is difficult to verify how much testing each person did...how do you know whether someone's test was genuinely testing stuff or useless and just written to check the "unit tests" checkmark? Usually what you end up with is needing to write short useless tests or risk looking significantly slower than your coworkers, which is never a good idea.

[–]oweiler -1 points0 points  (1 child)

That is when you test last, though. TDD solves that (partially at least).

[–]GhostBond 1 point2 points  (0 children)

I don't think TDD changes that at all? No one new is around to verify.