From acd87425acf7705328b01aa8f0a804207ffe4790 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 10 Jan 2018 16:13:52 +0100 Subject: [ct] Add post_groups/2 and post_all/3 hook functions --- lib/common_test/doc/src/ct_hooks.xml | 123 +++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) (limited to 'lib/common_test/doc') diff --git a/lib/common_test/doc/src/ct_hooks.xml b/lib/common_test/doc/src/ct_hooks.xml index 954be0ffba..613b694796 100644 --- a/lib/common_test/doc/src/ct_hooks.xml +++ b/lib/common_test/doc/src/ct_hooks.xml @@ -108,6 +108,129 @@ + + Module:post_groups(SuiteName, GroupDefs) -> NewGroupDefs + Called after groups/0. + + SuiteName = atom() + GroupDefs = NewGroupDefs = [Group] + Group = {GroupName,Properties,GroupsAndTestCases} + GroupName = atom() + Properties = [parallel | sequence | Shuffle | {RepeatType,N}] + GroupsAndTestCases = [Group | {group,GroupName} | TestCase] + TestCase = atom() + Shuffle = shuffle | {shuffle,Seed} + Seed = {integer(),integer(),integer()} + RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | repeat_until_any_ok | repeat_until_any_fail + N = integer() | forever + + +

OPTIONAL

+ +

This function is called after + groups/0. + It is used to modify the test group definitions, for + instance to add or remove groups or change group properties.

+ +

GroupDefs is what + groups/0 + returned, that is, a list of group definitions.

+ +

NewGroupDefs is the possibly modified version of this list.

+ +

This function is called only if the CTH is added before + init_per_suite is run. For details, see section + CTH Scope + in the User's Guide.

+ +

Notice that for CTHs that are installed by means of the + suite/0 + function, post_groups/2 is called before + the init/2 + hook function. However, for CTHs that are installed by means + of the CT start flag, + the init/2 + function is called first.

+ + +

Prior to each test execution, Common Test does a + simulated test run in order to count test suites, groups + and cases for logging purposes. This causes + the post_groups/2 hook function to always be called + twice. For this reason, side effects are best avoided in + this callback.

+
+
+
+ + + Module:post_all(SuiteName, Return, GroupDefs) -> NewReturn + Called after all/0. + + SuiteName = atom() + Return = NewReturn = Tests | {skip,Reason} + Tests = [TestCase | {group,GroupName} | {group,GroupName,Properties} | {group,GroupName,Properties,SubGroups}] + TestCase = atom() + GroupName = atom() + Properties = GroupProperties | default + SubGroups = [{GroupName,Properties} | {GroupName,Properties,SubGroups}] + Shuffle = shuffle | {shuffle,Seed} + Seed = {integer(),integer(),integer()} + RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | repeat_until_any_ok | repeat_until_any_fail + N = integer() | forever + GroupDefs = NewGroupDefs = [Group] + Group = {GroupName,GroupProperties,GroupsAndTestCases} + GroupProperties = [parallel | sequence | Shuffle | {RepeatType,N}] + GroupsAndTestCases = [Group | {group,GroupName} | TestCase] + Reason = term() + + +

OPTIONAL

+ +

This function is called after + all/0. + It is used to modify the set of test cases and test group to + be executed, for instance to add or remove test cases and + groups, change group properties, or even skip all tests in + the suite.

+ +

Return is what + all/0 + returned, that is, a list of test cases and groups to be + executed, or a tuple {skip,Reason}.

+ +

GroupDefs is what + groups/0 + or the post_groups/2 hook returned, that is, a list + of group definitions.

+ +

NewReturn is the possibly modified version of Return.

+ +

This function is called only if the CTH is added before + init_per_suite is run. For details, see section + CTH Scope + in the User's Guide.

+ +

Notice that for CTHs that are installed by means of the + suite/0 + function, post_all/2 is called before + the init/2 + hook function. However, for CTHs that are installed by means + of the CT start flag, + the init/2 + function is called first.

+ + +

Prior to each test execution, Common Test does a + simulated test run in order to count test suites, groups + and cases for logging purposes. This causes + the post_all/3 hook function to always be called + twice. For this reason, side effects are best avoided in + this callback.

+
+
+
+ Module:pre_init_per_suite(SuiteName, InitData, CTHState) -> Result Called before init_per_suite. -- cgit v1.2.3