ScalaCheck libraries are used for Generator-driven, property-based testing. ScalaCheck can be used for testing both Java and Scala. ScalaCheck is written in Scala and was inspired by QuickCheck for Haskell.
It is quite easy to introduce ScalaCheck in you is test harness, as it only needs Scala to work with and is not dependent on any other external libraries.
Note
To include ScalaCheck in your application test harness, add this line to your build.sbt
file:
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.0" % "test"
For an in-depth view of ScalaCheck, check out, http://www.artima.com/shop/scalacheck.
ScalaCheck uses Generators for creating test data. Quite simply put, a Generator is a function that takes some parameters to generate some value. The generated value has a direct correlation to the generation parameters. Generators are represented by the org.scalacheck.Gen
object. The Gen
object provides many methods to create new Generators or modify the existing...