An Elixir library for data generation and property-based testing with an idiomatic Elixir API.
StreamData is an Elixir library that provides data generation and property-based testing capabilities. It allows developers to create infinite streams of random data using generators and write tests that verify properties of their code hold across many automatically generated inputs.
Elixir developers who want to implement property-based testing in their applications or need to generate complex test data for their test suites.
Developers choose StreamData for its native Elixir implementation with an idiomatic API, seamless integration with Elixir's enumerable protocol, and its dual focus on both data generation and property-based testing in a single library.
Data generation and property-based testing for Elixir. 🔮
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
StreamData is written entirely in Elixir with an idiomatic API, making it seamless to use within Elixir projects and compatible with core language abstractions like enumerables, as highlighted in its design philosophy.
It provides both data generators that can be used as infinite streams and property-based testing tools through ExUnitProperties, offering a comprehensive solution for robust testing and data creation.
All generators implement the Enumerable protocol, allowing them to be used with Elixir's Stream and Enum modules for easy manipulation and integration, as demonstrated in the data generation examples.
The library offers tools to create arbitrarily complex custom generators, enabling developers to generate domain-specific data structures efficiently, as shown in the email generator example in the README.
StreamData lacks built-in functionality for stateful property-based testing, which is available in alternatives like PropCheck, limiting its use for testing stateful systems, as admitted in the differences section.
Unlike some frameworks, StreamData does not store counter-examples in files; developers must manually reuse seeds to reproduce failures, adding overhead and complexity for debugging.
Being native to Elixir, it's not suitable for Erlang projects or mixed-language environments, restricting its applicability outside pure Elixir codebases, which may alienate broader BEAM ecosystem users.
stream_data is an open-source alternative to the following products:
PropCheck is a property-based testing tool for Elixir, inspired by QuickCheck, that generates random test cases to verify properties of code.
PropEr is a QuickCheck-inspired property-based testing tool for Erlang that automatically generates test cases to find edge cases and verify program properties.