Testing from state-based specifications is a proven technique for exercising software components, to check for all expected and unwanted behaviours. However, in the Agile Methods community, there is a resistance even to simple state-based specifications and an over-reliance on manually created regression tests, which fail to find all faults. The "lazy systematic unit testing" method was created in response. It is based on the two notions of "lazy specification", the ability to defer finalising the software's apparent specification until a late stage in development; and "systematic testing", the ability to explore the state-space of a software component exhaustively, to Bounded depth.
The approach is exemplified in a Java unit testing tool, JWalk. This infers the apparent specification of compiled Java classes, by a combination of static and dynamic analysis, and limited interaction with the programmer. The tool is able to excercise all method protocols, all algebraic constructions and all high-level state transitions, to bounded depth. Once the oracle for the specification has been acquired, testing is fully automatic. The test sets adapt gracefully when changes are made to the code; and re-generated tests perform significantly better than regression tests. In a testing challenge, a JWalk tester was able to test two orders of magnitude more paths than an expert tester writing manual tests for JUnit.