talira

StreamData

Data generation and property-based testing for Elixir

open sourceApache-2.0free

StreamData is an Elixir library for data generation and property-based testing. Its StreamData module provides generators, and functions to combine them into custom ones, that are ordinary Elixir enumerables, so they also work as infinite streams of random data outside tests. Its ExUnitProperties module adds property and check all to ExUnit, generating inputs that try to falsify a property. It's inspired by the original QuickCheck paper and Clojure's test.check. Unlike PropEr, it has no stateful property-based testing and doesn't store counter-examples in a file.

Problems it solves

  • write property-based tests for my Elixir functions
  • generate random test data in Elixir
  • find edge cases my hand-written ExUnit examples miss

Features

  • generators that are Elixir enumerables, usable as random data streams
  • functions to combine generators into custom ones
  • ExUnitProperties: property and check all for ExUnit tests

Limitations

  • No stateful property-based testing, and failing counter-examples aren't stored in a file: you reuse the seed to reproduce one.1