DEV Community

Discussion on: Why unit test culture is broken

pentacular profile image
pentacular • Edited on

You need to consider the problems you're trying to solve with unit tests.

These may be:

  1. Documentation in the form of examples.
  2. Defense against regression.
  3. Evidence that the code functions correctly.
  4. Something else.

Once you understand what problem you're trying to solve, you can try to figure out how well unit testing achieves these for you, or if there a better alternatives.

But if you don't know why you're doing unit testing, except that TDD is good, then you won't be able to make a reasoned assessment, since your position will be ideological.

So, I suggest focusing on the actual problems rather than on a particular approach.

francisluz profile image
Francis Luz Author

Thanks for enriching the discussion, completely valid points. I wrote this more because of past experiences and talks with friends. Unfortunately, some projects nowadays still don't have a good unit test base. I'm lucky enough to have it working quite well in my projects.