Generators in ScalaCheck

Automatic generators

We can unleash the full power of property-based testing with automatic generators. Different from table-driven property checking, generator-based tests can benefit from automatic generators of class instances. Normally, such an automatic generation tries to cover all the edge cases of our input domain.

We can’t generate input automatically with ScalaTest alone. In Scala the most popular property-based testing library is ScalaCheck. We’ll add it to our project (line 6).

Get hands-on with 1200+ tech skills courses.