Generator-driven properties
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access