Skip to content

Commit b81aa63

Browse files
committed
Common Test SUITE template
Contains boilerplate code and a few hints how Common Tests are to be used
1 parent af9d208 commit b81aa63

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

priv/templates/ct_suite.erl

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
%%%-------------------------------------------------------------------
2+
%% @copyright (c) {{copyright_year}} {{author_name}}
3+
%%%-------------------------------------------------------------------
4+
5+
-module({{name}}_SUITE).
6+
-author("{{author_email}}").
7+
8+
-include_lib("common_test/include/ct.hrl").
9+
10+
%% Enables ?assert() for readable output
11+
-include_lib("stdlib/include/assert.hrl").
12+
13+
-compile(nowarn_export_all).
14+
-compile(export_all).
15+
16+
%%%-------------------------------------------------------------------
17+
%% Test server callbacks
18+
19+
suite() ->
20+
[].
21+
22+
init_per_suite(Config) ->
23+
Config.
24+
25+
end_per_suite(_Config) ->
26+
ok.
27+
28+
init_per_group(_GroupName, Config) ->
29+
Config.
30+
31+
end_per_group(_GroupName, _Config) ->
32+
ok.
33+
34+
init_per_testcase(_TestCase, Config) ->
35+
Config.
36+
37+
end_per_testcase(_TestCase, _Config) ->
38+
ok.
39+
40+
groups() ->
41+
[].
42+
43+
all() ->
44+
[basic].
45+
46+
%%%-------------------------------------------------------------------
47+
%% Test cases
48+
basic() ->
49+
[{doc, "Tests basic functionality"}].
50+
51+
basic(_Config) ->
52+
?assert(true).
53+

priv/templates/ct_suite.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{description, "Common Test suite"}.
2+
{variables, [
3+
{name, "suite", "Name of the suite, prepended to the standard _SUITE suffix"}
4+
]}.
5+
{dir, "test"}.
6+
{template, "ct_suite.erl", "test/{{name}}_SUITE.erl"}.

0 commit comments

Comments
 (0)