-
Notifications
You must be signed in to change notification settings - Fork 1
The competition
Americium fits in a wider ecosystem of property based testing tools.
A lot of these are based on a Haskell implementation, QuickCheck, and there are some others that take their own approaches, including Americium itself.
-
Jqwik - The author Johannes Link maintains a nice challenge repository here: The Shrinking Challenge that both Jqwik and Americium have Java submissions to, along with other tools for other languages. Jqwik is a powerful tool, making heavy use of annotations and is intended solely for use with JUnit5 framework, using its own engine instead of the Jupiter one. Like Americium, shrinking is integrated, so comes for free. The documentation is very comprehensive. Like Americium, it is agnostic about the assertion language, but is more prescriptive about test structure.
-
Quick Theories - not in the shrinking challenge, but again, shrinking is integrated. It uses a DSL based approach like Americium, and allows breakout from its own assertion language to using others. There is no integration with JUnit5 other than simply embedding a 'theory' into a JUnit test - this looks rather like using Americium's
.supplyTo
within a conventional@Test
JUnt5 test. -
JUnit-Quickcheck - not in the shrinking challenge, and follows the approach of QuickCheck, so you have to write your own shrinkage helpers if your test cases are of custom types. It integrates with JUnit5 using the Jupiter engine, and makes use of annotations.
-
Vavr Test - does not support shrinking. The website documentation is very sparse - go look at the code (which has good Javadoc). It is a port of the core concepts of Scalacheck to Java, using the Vavr framework, even leaner and meaner than Americium!
-
Scalacheck The incumbent tool in the Scala world. Can be used standalone or integrated with Scalatest. Documentation is fairly good, covering the basics; the assumption is that if you use Scala, most of the monadic DSL will be second nature. Not in the shrinking challenge, and as this follows the QuickCheck approach, you have to write your own shrinkage helpers if your test cases are of custom types - the defaults ones can break and are disabled by default these days. Has its own assertion language, but the Scalatest integration uses Scalatest assertions instead.
-
Hedgehog Lean and mean DSL approach, with integrated shrinking and its own assertion language - not in the shrinking challenge. Documentation is good. Has integrations with Minitest and MUnit.
There are several other such tools in the aforementioned shrinking challenge, including Hypothesis for Python folk, so if you came here but had another language in mind, here's the link again: The Shrinking Challenge.
Next topic: Arrived from Scalacheck?...
Start here: Project README
Topics:
-
Introducing Americium to your tests
Trials, supplying test cases to tests, shrinkage in action
-
Variations in making a trials instance
Choices, alternation, special cases
-
Collections, mapping, filtering, flat-mapping and recursion
-
Supplying independently varying test cases to a trial
-
Reproducing a failing test case quickly
Recipes and recipe hashes
-
What it means and how it is achieved
-
Configuration buttons, dials and levers
Case limit strategies, seeding, complexity, controlling shrinking
-
Sometimes the test doesn't even want to run itself
-
Going with the flow
-
Impress your friends with sleights of hand
-
Oh, that bunch?
-
Welcome to Americium - learn the local language
-
Strongly typed test supply
-
Yes, do pay attention to the man behind the curtain