PropCheck - Property Testing v1.0.3 PropCheck.Properties View Source
This module defined the property/4 macro. It is automatically available
by using PropCheck.
Link to this section Summary
Functions
Defines a property as part of an ExUnit test
Link to this section Functions
Defines a property as part of an ExUnit test.
The property macro takes at minimum a name and a do-block containing
the code of the property to be tested. The property code is encapsulated
as ean ExUnit test case of category property, which is released as
part of Elixir 1.3 and allows a nice mix of regular unit test and property
based testing. This is the reason for the third parameter taking an
environment of variables defined in a test setup function.
The second parameter sets options for Proper (see PropCheck ). The default
is :quiet such that execution during ExUnit runs are silent, as normal
unit tests are. You can change it e.g. to :verbose or setting the
maximum size of the test data generated or what ever may be helpful. For
seeing the result of wrapper functions PropCheck.aggregate/2 etc, the
verbose mode is required.
Counter Examples
If a property fails, the counter example is in a file. The next time this
property is checked again, only the counter example is used to ensure that
the property now behaves correctly. Additionally, a property with an existing
counter example is embellished with the tag failing_prop. You can skip all
other tests and property by running mix test --only failing_prop. In this case
only the properties with counter example are run. Another option is to use
the --stale option of ExUnit to reduce the amount of tests and properties
while fixing the code tested by a property.