@@ -157,4 +157,194 @@ snippet gen_server
157
157
%%%===================================================================
158
158
%%% Internal functions
159
159
%%%===================================================================
160
+ # common_test test_SUITE
161
+ snippet testsuite
162
+ -module(${1: `vim_snippets#Filename('', 'my')` } ).
163
+
164
+ -include_lib("common_test/include/ct.hrl").
165
+
166
+ %% Test server callbacks
167
+ -export([suite/0, all/0, groups/0,
168
+ init_per_suite/1, end_per_suite/1,
169
+ init_per_group/2, end_per_group/2,
170
+ init_per_testcase/2, end_per_testcase/2]).
171
+
172
+ %% Test cases
173
+ -export([
174
+ ]).
175
+
176
+ %%--------------------------------------------------------------------
177
+ %% COMMON TEST CALLBACK FUNCTIONS
178
+ %%--------------------------------------------------------------------
179
+
180
+ %%--------------------------------------------------------------------
181
+ %% Function: suite() -> Info
182
+ %%
183
+ %% Info = [tuple()]
184
+ %% List of key/value pairs.
185
+ %%
186
+ %% Description: Returns list of tuples to set default properties
187
+ %% for the suite.
188
+ %%
189
+ %% Note: The suite/0 function is only meant to be used to return
190
+ %% default data values, not perform any other operations.
191
+ %%--------------------------------------------------------------------
192
+ suite() ->
193
+ [{timetrap,{minutes,10}}].
194
+
195
+ %%--------------------------------------------------------------------
196
+ %% Function: init_per_suite(Config0) ->
197
+ %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
198
+ %%
199
+ %% Config0 = Config1 = [tuple()]
200
+ %% A list of key/value pairs, holding the test case configuration.
201
+ %% Reason = term()
202
+ %% The reason for skipping the suite.
203
+ %%
204
+ %% Description: Initialization before the suite.
205
+ %%
206
+ %% Note: This function is free to add any key/value pairs to the Config
207
+ %% variable, but should NOT alter/remove any existing entries.
208
+ %%--------------------------------------------------------------------
209
+ init_per_suite(Config) ->
210
+ Config.
211
+
212
+ %%--------------------------------------------------------------------
213
+ %% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
214
+ %%
215
+ %% Config0 = Config1 = [tuple()]
216
+ %% A list of key/value pairs, holding the test case configuration.
217
+ %%
218
+ %% Description: Cleanup after the suite.
219
+ %%--------------------------------------------------------------------
220
+ end_per_suite(_Config) ->
221
+ ok.
222
+
223
+ %%--------------------------------------------------------------------
224
+ %% Function: init_per_group(GroupName, Config0) ->
225
+ %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
226
+ %%
227
+ %% GroupName = atom()
228
+ %% Name of the test case group that is about to run.
229
+ %% Config0 = Config1 = [tuple()]
230
+ %% A list of key/value pairs, holding configuration data for the group.
231
+ %% Reason = term()
232
+ %% The reason for skipping all test cases and subgroups in the group.
233
+ %%
234
+ %% Description: Initialization before each test case group.
235
+ %%--------------------------------------------------------------------
236
+ init_per_group(_GroupName, Config) ->
237
+ Config.
238
+
239
+ %%--------------------------------------------------------------------
240
+ %% Function: end_per_group(GroupName, Config0) ->
241
+ %% void() | {save_config,Config1}
242
+ %%
243
+ %% GroupName = atom()
244
+ %% Name of the test case group that is finished.
245
+ %% Config0 = Config1 = [tuple()]
246
+ %% A list of key/value pairs, holding configuration data for the group.
247
+ %%
248
+ %% Description: Cleanup after each test case group.
249
+ %%--------------------------------------------------------------------
250
+ end_per_group(_GroupName, _Config) ->
251
+ ok.
252
+
253
+ %%--------------------------------------------------------------------
254
+ %% Function: init_per_testcase(TestCase, Config0) ->
255
+ %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
256
+ %%
257
+ %% TestCase = atom()
258
+ %% Name of the test case that is about to run.
259
+ %% Config0 = Config1 = [tuple()]
260
+ %% A list of key/value pairs, holding the test case configuration.
261
+ %% Reason = term()
262
+ %% The reason for skipping the test case.
263
+ %%
264
+ %% Description: Initialization before each test case.
265
+ %%
266
+ %% Note: This function is free to add any key/value pairs to the Config
267
+ %% variable, but should NOT alter/remove any existing entries.
268
+ %%--------------------------------------------------------------------
269
+ init_per_testcase(_TestCase, Config) ->
270
+ Config.
271
+
272
+ %%--------------------------------------------------------------------
273
+ %% Function: end_per_testcase(TestCase, Config0) ->
274
+ %% void() | {save_config,Config1} | {fail,Reason}
275
+ %%
276
+ %% TestCase = atom()
277
+ %% Name of the test case that is finished.
278
+ %% Config0 = Config1 = [tuple()]
279
+ %% A list of key/value pairs, holding the test case configuration.
280
+ %% Reason = term()
281
+ %% The reason for failing the test case.
282
+ %%
283
+ %% Description: Cleanup after each test case.
284
+ %%--------------------------------------------------------------------
285
+ end_per_testcase(_TestCase, _Config) ->
286
+ ok.
287
+
288
+ %%--------------------------------------------------------------------
289
+ %% Function: groups() -> [Group]
290
+ %%
291
+ %% Group = {GroupName,Properties,GroupsAndTestCases}
292
+ %% GroupName = atom()
293
+ %% The name of the group.
294
+ %% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]
295
+ %% Group properties that may be combined.
296
+ %% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]
297
+ %% TestCase = atom()
298
+ %% The name of a test case.
299
+ %% Shuffle = shuffle | {shuffle,Seed}
300
+ %% To get cases executed in random order.
301
+ %% Seed = {integer(),integer(),integer()}
302
+ %% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |
303
+ %% repeat_until_any_ok | repeat_until_any_fail
304
+ %% To get execution of cases repeated.
305
+ %% N = integer() | forever
306
+ %%
307
+ %% Description: Returns a list of test case group definitions.
308
+ %%--------------------------------------------------------------------
309
+ groups() ->
310
+ [].
311
+
312
+ %%--------------------------------------------------------------------
313
+ %% Function: all() -> GroupsAndTestCases | {skip,Reason}
314
+ %%
315
+ %% GroupsAndTestCases = [{group,GroupName} | TestCase]
316
+ %% GroupName = atom()
317
+ %% Name of a test case group.
318
+ %% TestCase = atom()
319
+ %% Name of a test case.
320
+ %% Reason = term()
321
+ %% The reason for skipping all groups and test cases.
322
+ %%
323
+ %% Description: Returns the list of groups and test cases that
324
+ %% are to be executed.
325
+ %%--------------------------------------------------------------------
326
+ all() ->
327
+ [].
328
+
329
+
330
+ %%--------------------------------------------------------------------
331
+ %% TEST CASES
332
+ %%--------------------------------------------------------------------
333
+
334
+ %%--------------------------------------------------------------------
335
+ %% Function: TestCase(Config0) ->
336
+ %% ok | exit() | {skip,Reason} | {comment,Comment} |
337
+ %% {save_config,Config1} | {skip_and_save,Reason,Config1}
338
+ %%
339
+ %% Config0 = Config1 = [tuple()]
340
+ %% A list of key/value pairs, holding the test case configuration.
341
+ %% Reason = term()
342
+ %% The reason for skipping the test case.
343
+ %% Comment = term()
344
+ %% A comment about the test case that will be printed in the html log.
345
+ %%
346
+ %% Description: Test case function. (The name of it must be specified in
347
+ %% the all/0 list or in a test case group for the test case
348
+ %% to be executed).
349
+ %%--------------------------------------------------------------------
160
350
0 commit comments