Gathering Statistics: Collecting
Explore how to gather and analyze test metrics using the collect function in PropEr. Understand its role in wrapping property results to produce useful statistics, and learn how to adjust custom generators to improve test coverage and meaningful data collection.
Collect
The collect(Value, PropertyResult) function allows us to gather the values of one specific metric per test and build stats out of all the runs that happened for a property. It’s special in that we need to use it to wrap the actual property result and add context to it. Let’s go through using the function and understanding how it works. The function takes two arguments, which are Value and PropertyResult.
Value represents the metric from which the statistics will be built. PropertyResult is the result of the property. The collect function takes both of these values and wraps them in a way ...