One of my favorite examples of property-based testing is in the docs for Haskell's Text.ParserCombinators.ReadP module. The semantics of the combinators are succinctly (but fully) documented in the form of QuickCheck properties.<p><a href="https://hackage.haskell.org/package/base-4.9.1.0/docs/Text-ParserCombinators-ReadP.html" rel="nofollow">https://hackage.haskell.org/package/base-4.9.1.0/docs/Text-P...</a>
The first line sounds like hubris, but amazingly it's actually true. QuickCheck makes extremely good (not over-complex or 'clever') use of return type polymorphism and applicatives.<p>Property testing is a good idea in any language, but its particularly elegant in Haskell.
Also: it's the coolest example of type classes Simon Peyton Jones knows and he explains why here (around 34-35 min):<p><a href="https://youtu.be/6COvD8oynmI" rel="nofollow">https://youtu.be/6COvD8oynmI</a>
This seems to be the way to go for testing.<p>I've wanted to use it for my current React-Native project. I found a JS implementation AND a babel plugin that creates the tests from flow-types.<p>The question for me here is, how long does this take compared to regular testing? I read people complained about AVA because of bad test performance (it does many parallel tests).<p>Also, where to put it in the chain?<p>Should I put it pre-push, pre-build, somewhere in the CI?
Has anyone here converted from 'regular' unit testing to quickcheck, or other property-based unit testing libraries? I'm wondering if it's worth taking the time out to learn, but I have my reservations regarding non-deterministic testing.
In Go's standard library there is a basic QuickCheck facility. But apparently it has only been imported by 20 opensource packages ever (see bottom of page):<p><a href="https://godoc.org/testing/quick" rel="nofollow">https://godoc.org/testing/quick</a>
You might also want to look into <a href="https://clojure.org/about/spec" rel="nofollow">https://clojure.org/about/spec</a>