Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 154 lines (136 sloc) 5.338 kB
e61019d @mbbx6spp Templates for rebar compiler and CT suite added.
authored
1 %%% @author {{author_name}} <{{author_email}}>
2 %%% @copyright {{copyright_year}} {{author_name}}
7defeb2 @mbbx6spp Create consistent 'name' var for all templates
authored
3 %%% @doc Test suite for {{name}} module which {{description}}
e61019d @mbbx6spp Templates for rebar compiler and CT suite added.
authored
4 %%% @end
5
7defeb2 @mbbx6spp Create consistent 'name' var for all templates
authored
6 -module({{name}}_SUITE).
e61019d @mbbx6spp Templates for rebar compiler and CT suite added.
authored
7 %% Note: This directive should only be used in test suites.
8 -compile(export_all).
9 -include_lib("common_test/include/ct.hrl").
10
11 %%--------------------------------------------------------------------
12 %% COMMON TEST CALLBACK FUNCTIONS
13 %%--------------------------------------------------------------------
14
15 %% @spec suite() -> Config
16 %% where
17 %% Config = [tuple()]
18 %% @doc returns list of tuples to set default properties for the suite.
19 suite() ->
20 [{timetrap,{minutes,10}}].
21
22 %% @spec init_per_suite(Config0) ->
23 %% Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
24 %% where
25 %% Config0 = Config1 = [tuple()],
26 %% Reason = term()
27 %% @doc runs initialization before matching test suite is executed.
28 %% This function may add key/value pairs to Config.
29 init_per_suite(Config) ->
30 Config.
31
32 %% @spec end_per_suite(Config0) -> ok | {save_config, Config1}
33 %% where
34 %% Config0 = Config1 = [tuple()]
35 %% @doc runs cleanup after matching test suite is executed.
36 end_per_suite(_Config) ->
37 ok.
38
39 %% @spec init_per_group(GroupName, Config0) ->
40 %% Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
41 %% where
42 %% GroupName = atom(),
43 %% Config0 = Config1 = [tuple()],
44 %% Reason = term()
45 %% @doc runs initialization before matching test group is executed.
46 init_per_group(_GroupName, Config) ->
47 Config.
48
49 %% @spec end_per_group(GroupName, Config0) -> ok | {save_config, Config1}
50 %% where
51 %% GroupName = atom(),
52 %% Config0 = Config1 = [tuple()]
53 %% @doc runs cleanup after matching test group is fully executed.
54 end_per_group(_GroupName, _Config) ->
55 ok.
56
57 %% @spec init_per_testcase(TestCase, Config0) ->
58 %% Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
59 %% where
60 %% TestCase = atom(),
61 %% Config0 = Config1 = [tuple],
62 %% Reason = term()
63 %% @doc runs initialization before matching test case. Should not alter or
64 %% remove any key/value pairs to the Config, but may add to it.
65 init_per_testcase(_TestCase, Config) ->
66 Config.
67
68 %% @spec end_per_testcase(TestCase, Config0) ->
69 %% ok | {save_config, Config1} | {fail, Reason}
70 %% where
71 %% TestCase = atom(),
72 %% Config0 = Config1 = [tuple()],
73 %% Reason = term()
74 %% @doc runs cleanup for matching test case.
75 end_per_testcase(_TestCase, _Config) ->
76 ok.
77
78 %% @spec groups() -> [Group]
79 %% where
80 %% Group = {GroupName, Properties, Members},
81 %% GroupName = atom(),
82 %% Properties = [parallel | sequence | Shuffle | {RepeatType, N}],
83 %% Members = [Group | {group, GroupName} | TestCase],
84 %% TestCase = atom(),
85 %% Shuffle = shuffle | {shuffle, Seed},
86 %% Seed = {integer(), integer(), integer()},
87 %% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |
88 %% repeat_until_any_ok | repeat_until_any_fail
89 %% N = integer() | forever
90 %% @doc returns list of test case group definitions.
91 groups() ->
92 [].
93
94 %% @spec all() -> Tests | {skip, Reason}
95 %% where
96 %% Tests = [{group, GroupName} | TestCase],
97 %% GroupName = atom(),
98 %% TestCase = atom(),
99 %% Reason = term()
100 %% @doc returns list of tests (group or testcase) to be run for all of suite.
101 all() ->
102 [test_compile_2_ok].
103
104 %%--------------------------------------------------------------------
105 %% TEST CASES
106 %%--------------------------------------------------------------------
107
108 %% @spec TestCase() -> Info
109 %% where
110 %% Info = [tuple()]
111 %% @doc returns list of tuples to set properties for the test case.
112 test_compile_2_ok() ->
113 %% TODO: modify proplist below for success case.
114 [{compiler_config, []}, {compiler_appfile, ""}].
115
116 %% @spec TestCase(Config0) ->
117 %% ok | exit() | {skip, Reason} | {comment, Comment} |
118 %% {save_config, Config} | {skip_and_save, Reason, Config1}
119 %% where
120 %% Config0 = Config1 = [tuple()],
121 %% Reason = term(),
122 %% Comment = term()
123 %% @doc runs the test case function. Verifies the cases where
7defeb2 @mbbx6spp Create consistent 'name' var for all templates
authored
124 %% {{name}}_compiler:compile/2 should return ok.
e61019d @mbbx6spp Templates for rebar compiler and CT suite added.
authored
125 test_compile_2_ok(Config) ->
126 CompilerConfig = proplists:get_value(compiler_config, Config),
127 CompilerAppfile = proplists:get_value(compiler_appfile, Config),
7defeb2 @mbbx6spp Create consistent 'name' var for all templates
authored
128 ok = {{name}}:compile(CompilerConfig, CompilerAppfile),
e61019d @mbbx6spp Templates for rebar compiler and CT suite added.
authored
129 ok.
130
131 %% @spec TestCase() -> Info
132 %% where
133 %% Info = [tuple()]
134 %% @doc returns list of tuples to set properties for the test case.
135 test_compile_2_skipped() ->
136 %% TODO: modify proplist below for skipped case.
137 [{compiler_config, []}, {compiler_appfile, ""}].
138
139 %% @spec TestCase(Config0) ->
140 %% ok | exit() | {skip, Reason} | {comment, Comment} |
141 %% {save_config, Config} | {skip_and_save, Reason, Config1}
142 %% where
143 %% Config0 = Config1 = [tuple()],
144 %% Reason = term(),
145 %% Comment = term()
146 %% @doc runs the test case function. Verifies the cases where
7defeb2 @mbbx6spp Create consistent 'name' var for all templates
authored
147 %% {{name}}_compiler:compile/2 should return ok.
e61019d @mbbx6spp Templates for rebar compiler and CT suite added.
authored
148 test_compile_2_skipped(Config) ->
149 CompilerConfig = proplists:get_value(compiler_config, Config),
150 CompilerAppfile = proplists:get_value(compiler_appfile, Config),
7defeb2 @mbbx6spp Create consistent 'name' var for all templates
authored
151 skipped = {{name}}:compile(CompilerConfig, CompilerAppfile),
e61019d @mbbx6spp Templates for rebar compiler and CT suite added.
authored
152 ok.
153
Something went wrong with that request. Please try again.