View Source Enfiladex.Suite (enfiladex v0.3.0)
use Enfiladex
is the drop-in Common Test
wrapper for ExUnit.
use Enfiladex.Suite
When you
use Enfiladex.Suite
, the tests in the case become available to use withcommon_test
:
- calls to
setup/2
andsetup_all/2
are also injected asinit_per_***/2
andend_per_***/2
groups/0
andall/0
are injectd based on yourdescribe/2
andtest/2
calls
@enfiladex_group_strategy
attribute can be set before each describe/2
call to one of the following values:
[]
(empty list / no option)- The test cases in the group are run one after the other. If a test fails, the others after it in the list are run.
:shuffle
- Runs the test in a random order. The random seed (the initialization value) used for the sequence will be printed in the HTML logs, of the form {A,B,C}. If a particular sequence of tests fails and you want to reproduce it, use that seed in the HTML logs and change the shuffle option to instead be {shuffle, {A,B,C}}. That way you can reproduce random runs in their precise order if you ever need to.
:parallel
- The tests are run in different processes. Be careful because if you forget to export the init_per_group and end_per_group functions, Common Test will silently ignore this option.
:sequence
- Doesn't necessarily mean that the tests are run in order, but rather that if a test fails in the group's list, then all the other subsequent tests are skipped. This option can be combined with shuffle if you want any random test failing to stop the ones after.
{:repeat, times}
- Repeats the group Times times. You could thus run all test cases in the group in parallel 9 times in a row by using the group properties [parallel, {repeat, 9}]. Times can also have the value forever, although 'forever' is a bit of a lie as it can't defeat concepts such as hardware failure or heat death of the Universe (ahem).
{:repeat_until_any_fail, n}
- Runs all the tests until one of them fails or they have been run N times. N can also be forever.
{:repeat_until_all_fail, n}
- Same as above, but the tests may run until all cases fail.
{:repeat_until_any_succeed, n}
- Same as before, except the tests may run until at least one case succeeds.
{:repeat_until_all_succeed, n}
- I think you can guess this one by yourself now, but just in case, it's the same as before except that the test cases may run until they all succeed.