https://github.com/scalaprops/scalaprops
property based testing library for Scala
https://github.com/scalaprops/scalaprops
dotty mersenne-twister prng property-based-testing scala scala-js scala-native scala3 scalaprops scalaz testing
Last synced: 1 day ago
JSON representation
property based testing library for Scala
- Host: GitHub
- URL: https://github.com/scalaprops/scalaprops
- Owner: scalaprops
- License: mit
- Created: 2015-05-05T03:19:11.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2025-03-31T20:05:22.000Z (15 days ago)
- Last Synced: 2025-04-14T19:18:37.025Z (1 day ago)
- Topics: dotty, mersenne-twister, prng, property-based-testing, scala, scala-js, scala-native, scala3, scalaprops, scalaz, testing
- Language: Scala
- Homepage:
- Size: 1.86 MB
- Stars: 278
- Watchers: 12
- Forks: 20
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-scala-native - scalaprops - Library for property-based testing. (Unit Tests)
- awesome-scala - scalaprops - activity/y/scalaprops/scalaprops) (Table of Contents / Testing)
- awesome-java - ScalaProps
README
# scalaprops
[](https://www.scala-js.org)
[](https://javadoc.io/doc/com.github.scalaprops/scalaprops-all_3)property based testing library for Scala
### features
- real `scala.FunctionN` generators using [`Cogen`](gen/src/main/scala/scalaprops/Cogen.scala) (aka [CoArbitrary](https://hackage.haskell.org/package/QuickCheck-2.8.1/docs/Test-QuickCheck-Arbitrary.html#t:CoArbitrary) in QuickCheck). scalaprops can generate not only constant Functions
- flexible parameter settings for each test( [ScalaCheck doesn't have this feature](https://github.com/typelevel/scalacheck/issues/120) )
- timeout as soon as possible
- flexible law checking like [discipline](https://github.com/typelevel/discipline)
- discipline uses only `String` for test id. but scalaprops can use other than `String`
- scalaz integration
- laws for scalaz typeclasses
- [`Gen`](gen/src/main/scala/scalaprops/Gen.scala) and [`Cogen`](gen/src/main/scala/scalaprops/Cogen.scala) instances of scalaz datatypes
- immutable random number generator
- scalaprops does not use `scala.util.Random` because `scala.util.Random` is mutable
- default implementation is [Mersenne Twister](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html) (JVM, scala-native) or [Tiny Mersenne Twister](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/) (Scala.js)
- [Scala.js](https://www.scala-js.org/) support
- [scala-native](http://scala-native.org) support. see
- [deterministic testing](#deterministic-testing)### latest stable version
[please use sbt plugin because there are some convenient features.](https://github.com/scalaprops/sbt-scalaprops)
setup without sbt plugin
```scala
testFrameworks += new TestFramework("scalaprops.ScalapropsFramework")parallelExecution in Test := false // currently, does not support parallel execution
libraryDependencies += "com.github.scalaprops" %% "scalaprops" % "0.9.1" % "test"
``````scala
libraryDependencies += "com.github.scalaprops" %% "scalaprops-scalaz" % "0.9.1" % "test"
```- [API Documentation](https://oss.sonatype.org/service/local/repositories/releases/archive/com/github/scalaprops/scalaprops-all_2.12/0.9.1/scalaprops-all_2.12-0.9.1-javadoc.jar/!/scalaprops/index.html)

### deterministic testing
Scalaprops emitting which seed it started with during a failing test, and providing an interface `--seed=` for re-running the failing test with the same seed.

### examples
See [scalaprops-example](https://github.com/scalaprops/scalaprops-examples) project.### for scalaz 7.1.x