4
%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
20
%%%-------------------------------------------------------------------
21
%%% File : happy_11_SUITE.erl
22
%%% Description : Happy test of all common_test callback functions.
23
%%%-------------------------------------------------------------------
24
-module(happy_11_SUITE).
26
%% Note: This directive should only be used in test suites.
29
-include_lib("common_test/include/ct.hrl").
31
%%--------------------------------------------------------------------
32
%% COMMON TEST CALLBACK FUNCTIONS
33
%%--------------------------------------------------------------------
35
%%--------------------------------------------------------------------
36
%% Function: suite() -> Info
39
%% List of key/value pairs.
41
%% Description: Returns list of tuples to set default properties
44
%% Note: The suite/0 function is only meant to be used to return
45
%% default data values, not perform any other operations.
46
%%--------------------------------------------------------------------
49
{timetrap,{seconds,10}},
51
{userdata, {info,"Happy test of CT callback functions."}}
54
%%--------------------------------------------------------------------
55
%% Function: init_per_suite(Config0) ->
56
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
58
%% Config0 = Config1 = [tuple()]
59
%% A list of key/value pairs, holding the test case configuration.
61
%% The reason for skipping the suite.
63
%% Description: Initialization before the suite.
65
%% Note: This function is free to add any key/value pairs to the Config
66
%% variable, but should NOT alter/remove any existing entries.
67
%%--------------------------------------------------------------------
68
init_per_suite(Config) ->
69
[{ips,ips_data} | Config].
71
%%--------------------------------------------------------------------
72
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
74
%% Config0 = Config1 = [tuple()]
75
%% A list of key/value pairs, holding the test case configuration.
77
%% Description: Cleanup after the suite.
78
%%--------------------------------------------------------------------
79
end_per_suite(Config) ->
80
ips_data = ?config(ips, Config).
82
%%--------------------------------------------------------------------
83
%% Function: init_per_testcase(TestCase, Config0) ->
84
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
87
%% Name of the test case that is about to run.
88
%% Config0 = Config1 = [tuple()]
89
%% A list of key/value pairs, holding the test case configuration.
91
%% The reason for skipping the test case.
93
%% Description: Initialization before each test case.
95
%% Note: This function is free to add any key/value pairs to the Config
96
%% variable, but should NOT alter/remove any existing entries.
97
%%--------------------------------------------------------------------
98
init_per_testcase(TestCase, Config) ->
99
[{TestCase,{TestCase,data}} | Config].
101
%%--------------------------------------------------------------------
102
%% Function: end_per_testcase(TestCase, Config0) ->
103
%% void() | {save_config,Config1}
106
%% Name of the test case that is finished.
107
%% Config0 = Config1 = [tuple()]
108
%% A list of key/value pairs, holding the test case configuration.
110
%% Description: Cleanup after each test case.
111
%%--------------------------------------------------------------------
112
end_per_testcase(TestCase, Config) ->
113
{TestCase,data} = ?config(TestCase, Config).
115
%%--------------------------------------------------------------------
116
%% Function: sequences() -> Sequences
118
%% Sequences = [{SeqName,TestCases}]
120
%% Name of a sequence.
121
%% TestCases = [atom()]
122
%% List of test cases that are part of the sequence
124
%% Description: Specifies test case sequences.
125
%%--------------------------------------------------------------------
127
[{seq1,[seq1_tc1, seq1_tc2]},
128
{seq2,[seq2_tc1, seq2_tc2]}].
130
%%--------------------------------------------------------------------
131
%% Function: all() -> TestCases | {skip,Reason}
133
%% TestCases = [TestCase | {sequence,SeqName}]
135
%% Name of a test case.
137
%% Name of a test case sequence.
139
%% The reason for skipping all test cases.
141
%% Description: Returns the list of test cases that are to be executed.
142
%%--------------------------------------------------------------------
152
%%--------------------------------------------------------------------
154
%%--------------------------------------------------------------------
157
[{userdata,{info, "This is a testcase"}}].
160
ips_data = ?config(ips, Config),
161
{tc1,data} = ?config(tc1, Config),
162
apple = ct:get_config(v1),
170
ips_data = ?config(ips, Config),
171
undefined = ?config(tc1, Config),
172
{tc2,data} = ?config(tc2, Config),
173
plum = ct:get_config(v2),
177
[{timetrap,{minutes,1}}].
181
[{v31, cherry},{v32, banana},{v33, coconut}] = ct:get_config(v3),
182
banana = ct:get_config({v3,v32}),
186
{skip,"Skipping this one"}.