The Competition

Americium in the property-based testing ecosystem

Table of contents

  1. Oh, That Bunch?
  2. Java Tools
    1. Jqwik
    2. Quick Theories
    3. JUnit-Quickcheck
    4. Vavr Test
  3. Scala Tools
    1. Scalacheck
    2. Hedgehog
    3. Other Scala Options
  4. The Shrinking Challenge
  5. Summary

Oh, That Bunch?

Americium fits into a wider ecosystem of property-based testing tools. Many of these are based on a Haskell implementation called QuickCheck, while others, including Americium, take their own unique approaches.


Java Tools

Jqwik

Author: Johannes Link

Jqwik is a powerful property-based testing library designed specifically for the JUnit5 framework.

Key Features:

  • Integrated shrinking (comes for free, like Americium).
  • The Shrinking Challenge: Both Jqwik and Americium have Java submissions to this benchmark repository.
  • ✅ Uses its own engine instead of the standard Jupiter one.
  • ✅ Heavy use of annotations for configuration.

Philosophy:

  • More prescriptive about test structure than Americium.
  • Assertion language agnostic.
  • Comprehensive and well-structured documentation.

Quick Theories

Approach: DSL-based (similar to Americium).

Key Features:

  • Integrated shrinking.
  • ✅ Allows breakout from its own assertion language to use others.
  • JUnit5 Integration: Limited; typically involves embedding a ‘theory’ into a standard @Test.

JUnit-Quickcheck

Approach: QuickCheck-style.

Key Features:

  • ✅ Integrates with JUnit5 using the Jupiter engine.
  • ✅ Heavy use of annotations.
  • Manual shrinkage: You must write your own shrinkage helpers for custom types.

Vavr Test

Approach: Port of Scalacheck concepts to Java using the Vavr framework.

Key Features:

  • No shrinking support.
  • ✅ Lean and mean API.
  • ❌ Sparse documentation (better to consult the Javadoc).

Scala Tools

Scalacheck

Status: The incumbent tool in the Scala world.

Key Features:

  • ✅ Can be used standalone or integrated with Scalatest.
  • Manual shrinkage: Based on the QuickCheck approach; default shrinkers can sometimes be problematic and are often disabled by default.
  • ✅ Own assertion language, but often used with Scalatest assertions.

Hedgehog

Approach: Lean and mean DSL.

Key Features:

  • Integrated shrinking.
  • ✅ Own assertion language.
  • ✅ Integrations with Minitest and MUnit.

Other Scala Options


The Shrinking Challenge

If you are interested in how different tools handle complex shrinkage scenarios, check out The Shrinking Challenge. It provides a set of standard problems and compares how various libraries across different languages (including Python’s Hypothesis) perform.


Summary

Feature Americium Jqwik Scalacheck Hedgehog
Language Java & Scala Java Scala Scala
Shrinking Integrated Integrated Manual Integrated
JUnit5 Flexible Core Third-party Third-party
API Style DSL Annotations Monadic DSL DSL

Americium’s unique position is offering integrated shrinkage with a consistent DSL-based API for both Java and Scala, without forcing a specific test framework or assertion style.


↑ Back to top

Copyright © 2024 Gerard Murphy. Distributed under the MIT License.

This site uses Just the Docs, a documentation theme for Jekyll.