9

If I had a nickel every time the unit tests failed not because something was wrong in the code, but because someone had messed up the unit test I'd be able to retire early.

I just spent the better part of 10 hours hunting down a bug in some production code only for the test to be wrong because the person who wrote it had mocked the http response incorrectly.

Nothing I did to "fix" the code worked, because nothing was wrong with it...

Comments
  • 4
    Always put your best people in testing.

    -Someone
  • 2
    Solution: trust nothing
  • 2
    Even with my own tests I first validate that the test is correct. Most of the time it is.
    The problem here is likely the everything needs a unit test approach leading to mocking/faking everything till the point you are basically testing mocks more than the actual code.

    A lot of code is just plumbing (with slight transformations) so flip the pyramid and do more end to end/integration tests only where the tests explode you have doing actual business logic worthy of a unit test.
  • 0
    @hjk101 well the issue is that I didn't write the test, my boss did. No wonder it failed if you give it the wrong assumptions
Add Comment