Skip to content

Grouping Tests

jrwest edited this page Mar 30, 2011 · 4 revisions

Grouping Tests with the 'group_' prefix

Future support planned.

Grouping Tests with the easy_group module attribute

Using the -easy_group([Opt]) module (where Opt is a 2-tuple), common_test groups can be fully customized, including their parent group (what easy_test calls a context) and options like sequence and shuffle. Tests belonging to a group can also be listed in this module attribute as opposed to using -easy_test(...) (although, currently, the level of customization is the same as using the 'test_' prefix but support for customization like the easy_test module attribute is planned). If a context is not specified the group will be in the list returned by all/0.

The following Opt 2-tuples are required:

  • {group, GroupName::atom()} - the name of the group.

The following are optional:

  • {context, Context::atom()} - the parent group. Defaults to all.
  • {opts, [atom()]} - list of opts used in the group specification. This is the same list as the second element in a group tuple returned by groups/0 in a common_test suite.
  • {tests, [atom()]} - list of test names that are part of the group. Tests are automatically exported just like if they were prefixed with test_ or if specified with easy_test(...)..

Grouping Tests with the easy_test 'group' option

The 2-tuple {group, GroupName::atom()} can be one of the elements in an -easy_test(...) attribute. If given, the test will be part of the group, GroupName. If is not specified with a corresponding -easy_group(...) then all will be GroupName's parent group.