Property-based testing is a supplementary technique to the traditional unit testing and behavior-driven development. It allows one to describe program properties in the form of an abstract specification, and the test data in the form of rules to apply for its generation.
Properly generated data includes edge cases, which are often ignored during example-based testing, and allows for higher code coverage.
The ScalaCheck is a framework for property-based testing with Scala. It has three main components—properties, generators, and shrinkers.
Universally quantified properties must hold for any test data in any state of the program. Conditional properties are defined for some subset of the data or specific states of the system.
ScalaCheck provides a lots of generators for standard types out of the box. The best way to create generators for custom types is by combining...