|
| 1 | +%%%------------------------------------------------------------------- |
| 2 | +%%% @author {{author_name}} <{{author_email}}> |
| 3 | +%%% @copyright (c) {{copyright_year}} {{author_name}} |
| 4 | +%%% @doc |
| 5 | +%%% Tests {{name}} |
| 6 | +%%% @end |
| 7 | +%%% ------------------------------------------------------------------- |
| 8 | + |
| 9 | +-module({{name}}_SUITE). |
| 10 | + |
| 11 | +%% Common Test headers |
| 12 | +-include_lib("common_test/include/ct.hrl"). |
| 13 | + |
| 14 | +%% Include stdlib header to enable ?assert() for readable output |
| 15 | +-include_lib("stdlib/include/assert.hrl"). |
| 16 | + |
| 17 | +%% Test server callbacks |
| 18 | +-export([ |
| 19 | + suite/0, |
| 20 | + all/0, |
| 21 | + groups/0, |
| 22 | + init_per_suite/1, end_per_suite/1, |
| 23 | + init_per_group/2, end_per_group/2, |
| 24 | + init_per_testcase/2, end_per_testcase/2 |
| 25 | +]). |
| 26 | + |
| 27 | +%% Test cases |
| 28 | +-export([ |
| 29 | + basic/0, basic/1 |
| 30 | +]). |
| 31 | + |
| 32 | +%%-------------------------------------------------------------------- |
| 33 | +%% COMMON TEST CALLBACK FUNCTIONS |
| 34 | + |
| 35 | +%%-------------------------------------------------------------------- |
| 36 | +%% @doc Set up default Common Test behaviour. |
| 37 | +%% Recommended options: {timetrap, {seconds, ...}} to set up |
| 38 | +%% default test timeout. |
| 39 | +%% @see http://erlang.org/doc/man/common_test.html#Module:suite-0 |
| 40 | +%%-------------------------------------------------------------------- |
| 41 | +suite() -> |
| 42 | + [{timetrap, {seconds, 10}}]. |
| 43 | + |
| 44 | +%%-------------------------------------------------------------------- |
| 45 | +%% @doc Initialization before the suite. |
| 46 | +%% init_per_suite(Config0) -> |
| 47 | +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} |
| 48 | +%% |
| 49 | +%% Note: This function is free to add any key/value pairs to the Config |
| 50 | +%% variable, but should NOT alter/remove any existing entries. |
| 51 | +%%-------------------------------------------------------------------- |
| 52 | +init_per_suite(Config) -> |
| 53 | + Config. |
| 54 | + |
| 55 | +%%-------------------------------------------------------------------- |
| 56 | +%% @doc Cleanup after the suite. |
| 57 | +%% end_per_suite(Config0) -> term() | {save_config,Config1} |
| 58 | +%%-------------------------------------------------------------------- |
| 59 | +end_per_suite(_Config) -> |
| 60 | + ok. |
| 61 | + |
| 62 | +%%-------------------------------------------------------------------- |
| 63 | +%% @doc Initialization before each test case group. |
| 64 | +%% init_per_group(GroupName, Config0) -> |
| 65 | +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} |
| 66 | +%% @see http://erlang.org/doc/man/common_test.html#Module:groups-0 |
| 67 | +%%-------------------------------------------------------------------- |
| 68 | +init_per_group(_GroupName, Config) -> |
| 69 | + Config. |
| 70 | + |
| 71 | +%%-------------------------------------------------------------------- |
| 72 | +%% @doc Cleanup after each test case group. |
| 73 | +%% end_per_group(GroupName, Config0) -> |
| 74 | +%% term() | {save_config,Config1} |
| 75 | +%%-------------------------------------------------------------------- |
| 76 | +end_per_group(_GroupName, _Config) -> |
| 77 | + ok. |
| 78 | + |
| 79 | +%%-------------------------------------------------------------------- |
| 80 | +%% @doc Initialization before each test case. |
| 81 | +%% Function: init_per_testcase(TestCase, Config0) -> |
| 82 | +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} |
| 83 | +%% Note: This function is free to add any key/value pairs to the Config |
| 84 | +%% variable, but should NOT alter/remove any existing entries. |
| 85 | +%%-------------------------------------------------------------------- |
| 86 | +init_per_testcase(_TestCase, Config) -> |
| 87 | + Config. |
| 88 | + |
| 89 | +%%-------------------------------------------------------------------- |
| 90 | +%% @doc Cleanup after each test case. |
| 91 | +%% end_per_testcase(TestCase, Config0) -> |
| 92 | +%% term() | {save_config,Config1} | {fail,Reason} |
| 93 | +%%-------------------------------------------------------------------- |
| 94 | +end_per_testcase(_TestCase, _Config) -> |
| 95 | + ok. |
| 96 | + |
| 97 | +%%-------------------------------------------------------------------- |
| 98 | +%% @doc Returns a list of test case group definitions. |
| 99 | +%% groups() -> [Group] |
| 100 | +%%-------------------------------------------------------------------- |
| 101 | +groups() -> |
| 102 | + []. |
| 103 | + |
| 104 | +%%-------------------------------------------------------------------- |
| 105 | +%% @doc Returns the list of groups and test cases to run. |
| 106 | +%% all() -> GroupsAndTestCases | {skip,Reason} |
| 107 | +%%-------------------------------------------------------------------- |
| 108 | +all() -> |
| 109 | + [basic]. |
| 110 | + |
| 111 | + |
| 112 | +%%-------------------------------------------------------------------- |
| 113 | +%% TEST CASES |
| 114 | + |
| 115 | +%%-------------------------------------------------------------------- |
| 116 | +%% @doc test_case/0 function returns test-case related information. |
| 117 | +%% Recommended values to return: |
| 118 | +%% {doc, "What this test does} - test documentation line |
| 119 | +%% {timetrap, {seconds, 5}} - override default timeout |
| 120 | +%% |
| 121 | +%% Note: This function is only meant to be used to return a list of |
| 122 | +%% values, not perform any other operations. |
| 123 | +%% @see http://erlang.org/doc/man/common_test.html#Module:Testcase-0 |
| 124 | +%%-------------------------------------------------------------------- |
| 125 | + |
| 126 | +basic() -> |
| 127 | + [{doc, "Tests basic functionality"}]. |
| 128 | + |
| 129 | +%%-------------------------------------------------------------------- |
| 130 | +%% Basic test case |
| 131 | +basic(_Config) -> |
| 132 | + ?assert(false). |
0 commit comments