← Back to context

Comment by chuckadams

3 months ago

> Unit tests aren't meant to find bugs, they're meant to protect against regressions

That hasn't been the general consensus on unit tests for at least 30 years now. Regression tests are a small subset of tests, typically named for an ID in some bug tracker, and are about validating a fix. The majority of unit tests catch issues before a bug is even opened, and pretty much any random developer you talk to will consider that to be the point.

> Regression tests are a small subset of tests, typically named for an ID in some bug tracker, and are about validating a fix.

This is how I also tend to think of them, but it's not how the phrase is generally used. The general meaning of regression tests it to ensure known correct functionality doesn't break with a future change. There's no actual requirement it be tied to a known bug.

They do not "find" bugs in the way that exploratory testing or user operation might (or even in the way that broader integration tests might), that is they don't find bugs that are not in the known problem space. But they are very good at proving a method works correctly and covers the known execution permutations.

The majority of unit tests catch issues before a bug is even opened

The "issue" that is being caught is the bug the parent is talking about, not a "bug" in JIRA or something.