diff options
author | Peter Andersson <[email protected]> | 2016-02-23 23:44:42 +0100 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2016-03-01 10:15:57 +0100 |
commit | 735c4bb91604f080d70de20b00ecd4711788e550 (patch) | |
tree | 86b79ac243a1a094dc64deb534ff680798efa2f8 /lib/common_test/src/ct_hooks.erl | |
parent | 6f8997c001a17b9d9322e26757690489d6111dac (diff) | |
download | otp-735c4bb91604f080d70de20b00ecd4711788e550.tar.gz otp-735c4bb91604f080d70de20b00ecd4711788e550.tar.bz2 otp-735c4bb91604f080d70de20b00ecd4711788e550.zip |
Introduce new CT hook functions
Diffstat (limited to 'lib/common_test/src/ct_hooks.erl')
-rw-r--r-- | lib/common_test/src/ct_hooks.erl | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl index 86d18696dc..4008ea998a 100644 --- a/lib/common_test/src/ct_hooks.erl +++ b/lib/common_test/src/ct_hooks.erl @@ -93,8 +93,10 @@ init_tc(Mod, {init_per_group, GroupName, Properties}, Config) -> call(fun call_generic/3, Config, [pre_init_per_group, GroupName]); init_tc(_Mod, {end_per_group, GroupName, _}, Config) -> call(fun call_generic/3, Config, [pre_end_per_group, GroupName]); -init_tc(_Mod, TC, Config) -> - call(fun call_generic/3, Config, [pre_init_per_testcase, TC]). +init_tc(_Mod, {init_per_testcase,TC}, Config) -> + call(fun call_generic/3, Config, [pre_init_per_testcase, TC]); +init_tc(_Mod, {end_per_testcase,TC}, Config) -> + call(fun call_generic/3, Config, [pre_end_per_testcase, TC]). %% @doc Called as each test case is completed. This includes all configuration %% tests. @@ -126,7 +128,10 @@ end_tc(Mod, {end_per_group, GroupName, Properties}, Config, Result, _Return) -> [post_end_per_group, GroupName, Config], '$ct_no_change'), maybe_stop_locker(Mod, GroupName, Properties), Res; -end_tc(_Mod, TC, Config, Result, _Return) -> +end_tc(_Mod, {init_per_testcase,TC}, Config, Result, _Return) -> + call(fun call_generic/3, Result, [post_init_per_testcase, TC, Config], + '$ct_no_change'); +end_tc(_Mod, {end_per_testcase,TC}, Config, Result, _Return) -> call(fun call_generic/3, Result, [post_end_per_testcase, TC, Config], '$ct_no_change'). @@ -244,6 +249,8 @@ remove(_, Else) -> %% Translate scopes, i.e. init_per_group,group1 -> end_per_group,group1 etc scope([pre_init_per_testcase, TC|_]) -> + [post_init_per_testcase, TC]; +scope([pre_end_per_testcase, TC|_]) -> [post_end_per_testcase, TC]; scope([pre_init_per_group, GroupName|_]) -> [post_end_per_group, GroupName]; @@ -317,7 +324,8 @@ get_hooks() -> %% If we are doing a cleanup call i.e. {post,pre}_end_per_*, all priorities %% are reversed. Probably want to make this sorting algorithm pluginable %% as some point... -resort(Calls,Hooks,[F|_R]) when F == post_end_per_testcase; +resort(Calls,Hooks,[F|_R]) when F == pre_end_per_testcase; + F == post_end_per_testcase; F == pre_end_per_group; F == post_end_per_group; F == pre_end_per_suite; |