Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Unit tests are what keep your code on the straight and narrow path. A Lack of Unit Tests is analogous to the moral Deadly Sin of sloth, which is sometimes called moral laziness, and sometimes defined as not doing the things you should do.

Unit tests help keep bugs and regressions from slipping into production code. And when you make a change to existing code, they help you know that you didn't break it. They are your backstop in refactoring, and give you confidence, when you're eliminating duplications or reducing complexity, that you haven't just thrown a monkey wrench into the works.

If you're dealing with legacy code that doesn't have unit tests, it likely wasn't written with unit tests in mind. In that case, don't be intimidated by the volume of work you'll need to do to add tests. Instead, focus on covering your new code, and add tests for existing code as you can.

Data on unit tests and code coverage can be displayed .By on a project dashboard by adding the SCM Activity plugin, code coverage on new code (added or modified) is displayed.

Image RemovedImage Added

For more details, see:

...