Sometimes, we want our properties to be checked against a randomly generated set of inputs. These input values are generated within some bounds that we can define with conditions. One example is, when we have a compression algorithm that needs testing. Instead of using a predefined list of strings, we can have a generated set of strings so that our function is tested against them.
Generator-driven property tests make use of ScalaCheck; therefore, make sure ScalaCheck JAR is included in the classpath. Your test will need to mixin GeneratorDrivenPropertyCheck
. If your test uses both table-driven property checks and Generator-driven property checks, then mixin trait PropertyChecks
as it extends both TableDrivenPropertyChecks
and GeneratorDrivenPropertyChecks
.