/
ctsuite.erl
125 lines (112 loc) · 3.78 KB
/
ctsuite.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
%%%' HEADER
%%% @author {{author_name}} <{{author_email}}>
%%% @since {{date}}
%%% @copyright {{copyright_year}} {{author_name}}
%%% @doc {{description}}
%%% @end
-module({{suite_name}}_SUITE).
%% Note: This directive should only be used in test suites.
-compile(export_all).
-include_lib("common_test/include/ct.hrl").
%%%.
%%%' CALLBACKS
%% @spec suite() -> Config
%% where
%% Config = [tuple()]
%% @doc returns list of tuples to set default properties for the suite.
suite() ->
[{timetrap,{minutes,10}}].
%% @spec init_per_suite(Config0) ->
%% Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
%% where
%% Config0 = Config1 = [tuple()],
%% Reason = term()
%% @doc runs initialization before matching test suite is executed.
%% This function may add key/value pairs to Config.
init_per_suite(Config) ->
Config.
%% @spec end_per_suite(Config0) -> ok | {save_config, Config1}
%% where
%% Config0 = Config1 = [tuple()]
%% @doc runs cleanup after matching test suite is executed.
end_per_suite(_Config) ->
ok.
%% @spec init_per_group(GroupName, Config0) ->
%% Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
%% where
%% GroupName = atom(),
%% Config0 = Config1 = [tuple()],
%% Reason = term()
%% @doc runs initialization before matching test group is executed.
init_per_group(_GroupName, Config) ->
Config.
%% @spec end_per_group(GroupName, Config0) -> ok | {save_config, Config1}
%% where
%% GroupName = atom(),
%% Config0 = Config1 = [tuple()]
%% @doc runs cleanup after matching test group is fully executed.
end_per_group(_GroupName, _Config) ->
ok.
%% @spec init_per_testcase(TestCase, Config0) ->
%% Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
%% where
%% TestCase = atom(),
%% Config0 = Config1 = [tuple],
%% Reason = term()
%% @doc runs initialization before matching test case. Should not alter or
%% remove any key/value pairs to the Config, but may add to it.
init_per_testcase(_TestCase, Config) ->
Config.
%% @spec end_per_testcase(TestCase, Config0) ->
%% ok | {save_config, Config1} | {fail, Reason}
%% where
%% TestCase = atom(),
%% Config0 = Config1 = [tuple()],
%% Reason = term()
%% @doc runs cleanup for matching test case.
end_per_testcase(_TestCase, _Config) ->
ok.
%% @spec groups() -> [Group]
%% where
%% Group = {GroupName, Properties, Members},
%% GroupName = atom(),
%% Properties = [parallel | sequence | Shuffle | {RepeatType, N}],
%% Members = [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
%% @doc returns list of test case group definitions.
groups() ->
[].
%% @spec all() -> Tests | {skip, Reason}
%% where
%% Tests = [{group, GroupName} | TestCase],
%% GroupName = atom(),
%% TestCase = atom(),
%% Reason = term()
%% @doc returns list of tests (group or testcase) to be run for all of suite.
all() ->
[my_test_case].
%%%.
%%%' TESTCASES
%% @spec TestCase() -> Info
%% where
%% Info = [tuple()]
%% @doc returns list of tuples to set properties for the test case.
my_test_case() ->
[].
%% @spec TestCase(Config0) ->
%% ok | exit() | {skip, Reason} | {comment, Comment} |
%% {save_config, Config} | {skip_and_save, Reason, Config1}
%% where
%% Config0 = Config1 = [tuple()],
%% Reason = term(),
%% Comment = term()
%% @doc the test function.
my_test_case(_Config) ->
ok.
%%%.
%%% vim: set filetype=erlang tabstop=2 foldmarker=%%%',%%%. foldmethod=marker: