Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 months 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 (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-07-25T21:36:10.000Z (4 months ago)
- Last Synced: 2024-07-25T23:58:12.787Z (4 months ago)
- Topics: dotty, mersenne-twister, prng, property-based-testing, scala, scala-js, scala-native, scala3, scalaprops, scalaz, testing
- Language: Scala
- Homepage:
- Size: 1.85 MB
- Stars: 276
- Watchers: 13
- Forks: 22
- 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)
README
# scalaprops
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-1.0.0.svg)](https://www.scala-js.org)
[![scaladoc](https://javadoc.io/badge2/com.github.scalaprops/scalaprops-all_3/javadoc.svg)](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)
![screencast](screencast.gif)
### 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.
![deterministic-testing](deterministic-testing.gif)
### examples
See [scalaprops-example](https://github.com/scalaprops/scalaprops-examples) project.### for scalaz 7.1.x