Gathering Statistics: Aggregating
Explore how the aggregate function helps collect and analyze statistics for generated test data. Learn to identify patterns and improve custom generators for more effective property-based testing with PropEr in Elixir.
Aggregate
The aggregate function is similar to the collect function with one simple exception. The aggregate function can take a list of categories to store. Let’s look at the function in action.
Code
Let’s start off with a basic property that uses the aggregate function. It is provided in the code widget below:
defmodule Pbt do
@moduledoc """
Documentation for Pbt.
"""
@doc """
Hello world.
## Examples
iex> Pbt.hello
:world
"""
def hello do
:world
end
end
The aggregate function
...