Property-Based Testing with ScalaCheck
ScalaCheck allows property-based testing: verifying properties hold for many generated inputs.
Example
import org.scalacheck.Properties
import org.scalacheck.Prop.forAll
object StringProps extends Properties("String") {
property("concat length") = forAll { (a: String, b: String) =>
(a + b).length >= a.length && (a + b).length >= b.length
}
}
Run tests using sbt: sbt test