init_per_suite(Config) -> Config | {skip, Reason}
OTP 17.3
Initializes and extends Config
for property based testing.
This function investigates if support is available for either QuickCheck
, PropEr
or Triq
and compiles the properties with the first tool found. It is supposed to be called in the init_per_suite/1
function in a CommonTest test suite.
Which tools to check for, and in which order could be set with the option {prop_tools, list(eqc|proper|triq)}
in the CommonTest configuration Config
. The default value is [eqc, proper, triq]
with eqc
being the first one searched for.
If no support is found for any tool, this function returns {skip, Explanation}
.
If support is found, the option {property_test_tool,ToolModule}
with the selected tool main module name (eqc
, proper
or triq
) is added to the list Config
which then is returned.
The property tests are assumed to be in a subdirectory named property_test
. All found Erlang files in that directory are compiled with one of the macros 'EQC'
, 'PROPER'
or 'TRIQ'
set, depending on which tool that is first found. This could make parts of the Erlang property tests code to be included or excluded with the macro directives -ifdef(Macro).
or -ifndef(Macro).
.
The file(s) in the property_test
subdirectory could, or should, include the ct_property_test include file:
-include_lib("common_test/include/ct_property_test.hrl").
This included file will:
- Include the correct tool's include file
- Set the macro
'MOD_eqc'
to the correct module name for the selected tool. That is, the macro'MOD_eqc'
is set to eithereqc
,proper
ortriq
.