January 2019
Intermediate to advanced
376 pages
8h 49m
English
While there’s nothing wrong with using in-shell samples to get a quick feel for how things work, a more pragmatic approach is to display values every time we run the tests, so that we can know at a glance whether anything looks odd or out of place. There are two functions that can be used for this: collect/2 and aggregate/2.
We’ll focus on collect/2 first, since it’s a bit more specific and straightforward, and then expand to aggregate/2.
The collect(Value, PropertyResult) function allows you 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 you need to use it to wrap the actual property result and add context to it:
About ... |
|---|