probably every time I see my tests failing.

Each time I am writing tests I'm convincing myself "it's an investment", "spend 2 hours now to save 2 days later", "unit-tests are good".

And each time I'm chasing away ideas like "perhaps they are right, perhaps writing unit tests is a waste of time..", "this code is simple, it should ever break - why test it??", "In the 2 hours I'll spend writing those UT I could build another feature"

Yes, it is terribly annoying to write tests, especially after writing the production code (code-first approach). Why test code that you know works, right?

But after a few weeks, months or years, when the time comes to change your feature: enhance it, refactor it, build an integration with/from it, etc, I feel like a child who found a forgotten favourite candy in his pocket when I see my tests failing.

It means I did a very good job writing them
It means it was not a waste of time
it means these tests will now save me hours or days of trial-and-error change→compile→deploy→test cycles.

So yeah, whenever I see my tests fail, I feel warm and fussy inside :)

  • 5
    Partially true.

    I am extremely happy when my tests fail after I make a change.

    I am absolutely terrified when my tests fail after absolutely nothing/I run them on a different machine/ they pass when I rerun them/I didn't pray hard enough to the Omnissiah.
  • 0
    I recently found an obvious bug when writing tests (somebody has copied and renamed a setter and forgot to change field it affected)
    It felt good to find and fix it.
  • 1
    In the backend of my main project the test coverage is so fucking awesone after all these years, that I can do big refactorings without even compiling the frontend at all. To know, that you can do the most fundamental and mercyless changes in the architecture without the fear of producing endless new bugs is absolutely priceless. Only downside: I can not work on any less covered projects without feeling extremely uncomfortable anymore.
Add Comment