Your test are just your spec. NBD.

I find one of the important early mind shifts to be a switch from thinking of unit tests as test to thinking of the set of all tests as your spec.

If your spec is clean, you could delete your product code, hand it to someone, and they would implement the same product, with roughly the same design.

If your product code is clean, you could delete your spec. Hand the code to someone and they could extract the spec from the code, ending up with a similar spec.

The first of these is called TDD. The second is called working effectively with legacy code. Continue reading “Your test are just your spec. NBD.”