The Art of Unit Testing by Roy Osherove

A summary:

Why test?

Allows you to make changes with confidence that your functionality will be as expected.

What makes a good tests?

  • Must be deterministic.
  • Must be quick (otherwise you won’t run them, and as a result, may merge in bugs).
  • Allows for greater coverage of the logic in you code - almost every part is covered.
  • When refactoring - it tests that your tests are good.
  • Start with a failing test. Then make it pass.

But there’s still no guarantee…

  • Writing tests, doesn’t mean you’ll get a well designed system.
  • Writing bad tests? You’ll probably waste more time than you save.

Basics

Convention:

  • Project - Test project called: ProjectUnderTest.UnitTests.
Written on October 19, 2022