Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Never have I tested anything and NOT found a bug, and most things I tested I thought were already OK to ship.

I have found that, in my own case, every time I’ve written a unit test, it has exposed bugs.

I don’t usually do the TDD thing, where I write failing tests first (but I do it, occasionally), so these tests are usually against code that I already think works.

That said, I generally prefer test harnesses to unit tests[0]. They still find bugs, but the workflow is less straightforward. They also cause me to do more testing, as I develop, so the bugs are fixed in situ, so to speak.

[0] https://littlegreenviper.com/testing-harness-vs-unit/



> That said, I generally prefer test harnesses to unit tests[0].

That's a strange redefinition of harness.

The larger-scoped tests are more often called integration or even system tests.

And while I'm here, those are slow tests that are harder to debug and require more maintenance (often maintenance of an entire environment to run them in!). Unit tests are closer to what they test, fast, and aren't tied to an environment - they can be run on every push.


Not “strange,” in my opinion. Back in The Day, we called what people insist are “test harnesses,” “unit tests.”

But these days, the term “unit test” has morphed into a particular configuration.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: