summaryrefslogtreecommitdiff
path: root/lib/common_test/doc/src/ct_suite.xml
blob: cc926fbcbb2091533feec208fcef1ccf78aba4f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2020</year><year>2021</year>
      <holder>Ericsson AB, All Rights Reserved</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

      The Initial Developer of the Original Code is Ericsson AB.
    </legalnotice>
    <title>ct_suite</title>
    <prepared></prepared>
    <docno></docno>
    <date></date>
    <rev></rev>
  </header>
  <module since="">ct_suite</module>
  <modulesummary>-behaviour(ct_suite).
  </modulesummary>
  <description>
    <p>The following section describes the mandatory and optional test suite
      functions that <c>Common Test</c> calls during test execution.
      For more details, see section
      <seeguide marker="write_test_chapter">Writing Test Suites</seeguide>
      in the User's Guide.</p>
  </description>

  <datatypes>
    <datatype>
      <name name="ct_testname" n_vars="0"/>
      <desc><p>The name of the testcase function.</p></desc>
    </datatype>
    <datatype>
      <name name="ct_groupname" n_vars="0"/>
      <desc><p>The name of the test group.</p></desc>
    </datatype>
    <datatype>
      <name name="ct_config" n_vars="0"/>
      <desc><p>The configuration data that can be modified.</p></desc>
    </datatype>
    <datatype>
      <name name="ct_status" n_vars="0"/>
      <desc><p>The status value for a nested subgroup.</p></desc>
    </datatype>
    <datatype>
      <name>ct_group_def()</name>
      <desc><p>The test group definition, as returned by <seemfa marker="#Module:groups/0"><c>Module:groups/0</c></seemfa>.</p></desc>
    </datatype>
    <datatype>
      <name>ct_test_def()</name>
      <desc><p>The test suite definition, as returned by <seemfa marker="#Module:all/0"><c>Module:all/0</c></seemfa>.</p></desc>
    </datatype>
    <datatype>
      <name>ct_info()</name>
      <desc><p>The test suite information, as returned by <seemfa marker="#Module:suite/0"><c>Module:suite/0</c></seemfa>, <seemfa marker="#Module:group/1"><c>Module:group/1</c></seemfa> and <seemfa marker="#Module:Testcase/0"><c>Module:Testcase/0</c></seemfa>.</p></desc>
    </datatype>
  </datatypes>

  <funcs>
    <fsdescription>
      <title>Callback Functions</title>
      <p>
        The following functions are to be exported from a
        <c>ct_suite</c> callback module in order to define
        the callback interface for a test suite.
      </p>
    </fsdescription>

    <func>
      <name since="">Module:all() -> [ct_test_def()] | {skip, Reason}</name>
      <fsummary>Returns the list of all test case groups and test cases
	in the module.</fsummary>
      <type>
	<v><seetype marker="#ct_test_def">ct_test_def()</seetype> = TestCase |
        {group, GroupName} | {group, GroupName, Properties} | {group, GroupName,
        Properties, SubGroups} | {testcase, TestCase, TestCaseRepeatType}</v>
	<v>TestCase = <seetype marker="#ct_testname">ct_testname()</seetype></v>
	<v>GroupName = <seetype marker="#ct_groupname">ct_groupname()</seetype></v>
	<v>Properties = [parallel | sequence | Shuffle | {RepeatType, N}] | default</v>
	<v>SubGroups = [{GroupName, Properties} | {GroupName, Properties, SubGroups}]</v>
	<v>Shuffle = shuffle | {shuffle, Seed}</v>
	<v>Seed = {integer(), integer(), integer()}</v>
	<v>RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | repeat_until_any_ok | repeat_until_any_fail</v>
        <v>TestCaseRepeatType = [{repeat, N} | {repeat_until_ok, N} | {repeat_until_fail, N}]</v>
	<v>N = integer() | forever</v>
	<v>Reason = term()</v>
      </type>

      <desc>
	<p>MANDATORY</p>

	<p>Returns the list of all test cases and test case groups in the
          test suite module to be executed. This list also specifies the
          order the cases and groups are executed by <c>Common Test</c>.
          A test case is represented by an atom,
	  the name of the test case function, or a <c>testcase</c> tuple
	  indicating that the test case shall be repeated. A test case group is
	  represented by a <c>group</c> tuple, where <c>GroupName</c>,
	  an atom, is the name of the group (defined in
	  <seemfa marker="#Module:groups/0"><c>Module:groups/0</c></seemfa>).
	  Execution properties for groups can also be specified, both
	  for a top-level group and for any of its subgroups.
	  Group execution properties specified here override
	  properties in the group definition (see
	  <seemfa marker="#Module:groups/0"><c>Module:groups/0</c></seemfa>).
	  (With value <c>default</c>, the group definition properties
	  are used).</p>

	<p>If <c>{skip, Reason}</c> is returned, all test cases
          in the module are skipped and <c>Reason</c>
          is printed on the HTML result page.</p>

	<p>For details on groups, see section
	  <seeguide marker="write_test_chapter#test_case_groups">Test Case
	  Groups</seeguide> in the User's Guide.</p>

    </desc>
    </func>

    <func>
      <name since="">Module:groups() -> [ct_group_def()]</name>
      <fsummary>Returns a list of test case group definitions.</fsummary>
      <type>
        <v><seetype marker="#ct_group_def">ct_group_def()</seetype> = {GroupName, Properties, GroupsAndTestCases}</v>
        <v>GroupName = <seetype marker="#ct_groupname">ct_groupname()</seetype></v>
        <v>Properties = [parallel | sequence | Shuffle | {RepeatType, N}]</v>
        <v>GroupsAndTestCases = [Group | {group, GroupName} | TestCase | {testcase, TestCase, TestCaseRepeatType}]</v>
        <v>TestCase = <seetype marker="#ct_testname">ct_testname()</seetype></v>
        <v>Shuffle = shuffle | {shuffle, Seed}</v>
        <v>Seed = {integer(), integer(), integer()}</v>
        <v>RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | repeat_until_any_ok | repeat_until_any_fail</v>
        <v>TestCaseRepeatType = [{repeat, N} | {repeat_until_ok, N} | {repeat_until_fail, N}]</v>
        <v>N = integer() | forever</v>
      </type>

      <desc>
	<p>OPTIONAL</p>

	<p>Defines test case groups. For details, see section
	  <seeguide marker="write_test_chapter#test_case_groups">Test Case
	  Groups</seeguide> in the User's Guide.</p>
      </desc>
    </func>

      <func>
	<name since="">Module:suite() -> [ct_info()]</name>
	<fsummary>Test suite info function (providing default data
	  for the suite).</fsummary>
	<type>
	  <v><seetype marker="#ct_info">ct_info()</seetype> = {timetrap, Time} | {require, Required} | {require, Name, Required} | {userdata, UserData} | {silent_connections, Conns} | {stylesheet, CSSFile} | {ct_hooks, CTHs}</v>
	  <v>Time = TimeVal | TimeFunc</v>
	  <v>TimeVal = MilliSec | {seconds, integer()} | {minutes, integer()} | {hours, integer()}</v>
	  <v>TimeFunc = {Mod, Func, Args} | Fun</v>
	  <v>MilliSec = integer()</v>
	  <v>Mod = atom()</v>
	  <v>Func = atom()</v>
	  <v>Args = list()</v>
	  <v>Fun = fun()</v>
	  <v>Required = Key | {Key, SubKeys} | {Key, SubKey} | {Key, SubKey, SubKeys}</v>
	  <v>Key = atom()</v>
	  <v>SubKeys = SubKey | [SubKey]</v>
	  <v>SubKey = atom()</v>
	  <v>Name = atom()</v>
	  <v>UserData = term()</v>
	  <v>Conns = [atom()]</v>
	  <v>CSSFile = string()</v>
	  <v>CTHs = [CTHModule |</v>
	  <v>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{CTHModule, CTHInitArgs} |</v>
	  <v>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{CTHModule, CTHInitArgs, CTHPriority}]</v>
	  <v>CTHModule = atom()</v>
	  <v>CTHInitArgs = term()</v>
	  <v>CTHPriority = integer()</v>
	</type>
	<desc>

        <p>OPTIONAL</p>

	<p>The test suite information function.	Returns a list of tagged
          tuples specifying various properties related to the execution of
          this test suite (common for all test cases in the suite).</p>

	<p>Tag <c>timetrap</c> sets the maximum time that each
	  test case is allowed to execute (including
	  <seemfa marker="#Module:init_per_testcase/2"><c>Module:init_per_testcase/2</c></seemfa>
	  and
	  <seemfa marker="#Module:end_per_testcase/2"><c>Module:end_per_testcase/2</c></seemfa>).
	  If the timetrap time is exceeded, the test case fails with reason
	  <c>timetrap_timeout</c>. A <c>TimeFunc</c> function can be used to
	  set a new timetrap by returning a <c>TimeVal</c>. It can also be
	  used to trigger a timetrap time-out by, at some point, returning a
	  value other than a <c>TimeVal</c>. For details, see section
	  <seeguide marker="write_test_chapter#timetraps">Timetrap Time-Outs</seeguide>
	  in the User's Guide.</p>

	<p>Tag <c>require</c> specifies configuration variables
	  required by test cases (or configuration functions)
	  in the suite. If the required configuration variables are not found
	  in any of the configuration files, all test cases are skipped.
	  For details about the <c>require</c> functionality, see function
	  <seemfa marker="ct#require/1"><c>ct:require/1,2</c></seemfa>.</p>

	<p>With <c>userdata</c>, the user can
	  specify any test suite-related information, which can be
	  read by calling
	  <seemfa marker="ct#userdata/2"><c>ct:userdata/2</c></seemfa>.</p>

	<p>Tag <c>ct_hooks</c> specifies the
	  <seeguide marker="ct_hooks_chapter">Common Test Hooks</seeguide>
	  to be run with this suite.</p>

	<p>Other tuples than the ones defined are ignored.</p>

	<p>For details about the test suite information function, see section
	  <seeguide marker="write_test_chapter#suite">Test
	  Suite Information Function</seeguide> in the User's Guide.</p>
    </desc>
    </func>

      <func>
	<name since="">Module:init_per_suite(Config) -> NewConfig | {skip, Reason} |
	  {skip_and_save, Reason, SaveConfig}</name>
	<fsummary>Test suite initializations.</fsummary>
	<type>
	  <v>Config = NewConfig = SaveConfig = <seetype marker="#ct_config">ct_config()</seetype></v>
	  <v>Reason = term()</v>
	</type>
	<desc>

	  <p>OPTIONAL; if this function is defined, then <seemfa
	  marker="#Module:end_per_suite/1"><c>Module:end_per_suite/1</c></seemfa>
	  must also be defined.</p>

	  <p>This configuration function is called as the first function in the
	  suite. It typically contains initializations that are common for
	  all test cases in the suite, and that must only be done
	  once. Parameter <c>Config</c> is the configuration data
	  that can be modified. Whatever is returned from this
	  function is specified as <c>Config</c> to all configuration functions
	  and test cases in the suite.</p>

	  <p>If <c>{skip, Reason}</c>
	  is returned, all test cases in the suite are skipped
	  and <c>Reason</c> is printed in the overview log for the suite.</p>

	  <p>For information on <c>save_config</c> and <c>skip_and_save</c>,
	  see section
	  <seeguide marker="dependencies_chapter#save_config">Saving
	  Configuration Data</seeguide> in the User's Guide.</p>
    </desc>
    </func>

    <func>
      <name since="">Module:end_per_suite(Config) -> term() |
	{save_config, SaveConfig}</name>
      <fsummary>Test suite finalization.</fsummary>
      <type>
	<v>Config = SaveConfig = <seetype marker="#ct_config">ct_config()</seetype></v>
      </type>

      <desc>
	<p>OPTIONAL; if this function is defined, then <seemfa
	  marker="#Module:init_per_suite/1"><c>Module:init_per_suite/1</c></seemfa>
	  must also be defined.</p>

	<p>This function is called as the last test case in the
	  suite. It is meant to be used for cleaning up after
	  <seemfa marker="#Module:init_per_suite/1"><c>Module:init_per_suite/1</c></seemfa>.</p>
	<p>For information on <c>save_config</c>, see section
	  <seeguide marker="dependencies_chapter#save_config">Saving
	  Configuration Data</seeguide> in the User's Guide.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B">Module:group(GroupName) -> [ct_info()]</name>
      <fsummary>Test case group information function (providing default data
        for a test case group, that is, its test cases and
        subgroups).</fsummary>
      <type>
	<v>GroupName = <seetype marker="#ct_groupname">ct_groupname()</seetype></v>
	<v><seetype marker="#ct_info">ct_info()</seetype> = {timetrap, Time} | {require, Required} | {require, Name, Required} | {userdata, UserData} | {silent_connections, Conns} | {stylesheet, CSSFile} | {ct_hooks, CTHs}</v>
	<v>Time = TimeVal | TimeFunc</v>
	<v>TimeVal = MilliSec | {seconds, integer()} | {minutes, integer()} | {hours, integer()}</v>
	<v>TimeFunc = {Mod, Func, Args} | Fun</v>
	<v>MilliSec = integer()</v>
	<v>Mod = atom()</v>
	<v>Func = atom()</v>
	<v>Args = list()</v>
	<v>Fun = fun()</v>
	<v>Required = Key | {Key, SubKeys} | {Key, SubKey} | {Key, SubKey, SubKeys}</v>
	<v>Key = atom()</v>
	<v>SubKeys = SubKey | [SubKey]</v>
	<v>SubKey = atom()</v>
	<v>Name = atom()</v>
	<v>UserData = term()</v>
	<v>Conns = [atom()]</v>
	<v>CSSFile = string()</v>
	<v>CTHs = [CTHModule |</v>
	<v>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{CTHModule, CTHInitArgs} |</v>
	<v>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{CTHModule, CTHInitArgs, CTHPriority}]</v>
	<v>CTHModule = atom()</v>
	<v>CTHInitArgs = term()</v>
	<v>CTHPriority = integer()</v>
      </type>
      <desc>

	<p>OPTIONAL</p>

	<p>The test case group information function. It is supposed to
	  return a list of tagged tuples that specify various properties
	  related to the execution of a test case group (that is, its test
	  cases and subgroups). Properties set by
	  <seemfa marker="#Module:group/1"><c>Module:group/1</c></seemfa> override
	  properties with the same key that have been set previously by
	  <seemfa marker="#Module:suite/0"><c>Module:suite/0</c></seemfa>.</p>

	<p>Tag <c>timetrap</c> sets the maximum time that each
	  test case is allowed to execute (including
	  <seemfa marker="#Module:init_per_testcase/2"><c>Module:init_per_testcase/2</c></seemfa>
	  and
	  <seemfa marker="#Module:end_per_testcase/2"><c>Module:end_per_testcase/2</c></seemfa>).
	  If the timetrap time is
	  exceeded, the test case fails with reason
	  <c>timetrap_timeout</c>. A <c>TimeFunc</c> function can be used to
	  set a new timetrap by returning a <c>TimeVal</c>. It can also be
	  used to trigger a timetrap time-out by, at some point, returning a
	  value other than a <c>TimeVal</c>. For details, see section
	  <seeguide marker="write_test_chapter#timetraps">Timetrap
	  Time-Outs</seeguide> in the User's Guide.</p>

	<p>Tag <c>require</c> specifies configuration variables
	  required by test cases (or configuration functions)
	  in the suite. If the required configuration variables are not found
	  in any of the configuration files, all test cases in this group are
	  skipped. For details about the <c>require</c> functionality, see
	  function
	  <seemfa marker="ct#require/1"><c>ct:require/1,2</c></seemfa>.</p>

	<p>With <c>userdata</c>, the user can
	  specify any test case group related information that can be
	  read by calling
	  <seemfa marker="ct#userdata/2"><c>ct:userdata/2</c></seemfa>.</p>

	<p>Tag <c>ct_hooks</c> specifies the
	  <seeguide marker="ct_hooks_chapter">Common Test Hooks</seeguide>
	  to be run with this suite.</p>

	<p>Other tuples than the ones defined are ignored.</p>

	<p>For details about the test case group information function,
	  see section <seeguide marker="write_test_chapter#group_info">Group
	  Information Function</seeguide> in the User's Guide.</p>
    </desc>
    </func>

      <func>
	<name since="">Module:init_per_group(GroupName, Config) -> NewConfig |
	  {skip, Reason}</name>
	<fsummary>Test case group initializations.</fsummary>
	<type>
	  <v>GroupName = <seetype marker="#ct_groupname">ct_groupname()</seetype></v>
	  <v>Config = NewConfig = <seetype marker="#ct_config">ct_config()</seetype></v>
	  <v>Reason = term()</v>
	</type>
	<desc>

	  <p>OPTIONAL; if this function is defined, then <seemfa
	    marker="#Module:end_per_group/2"><c>Module:end_per_group/2</c></seemfa>
	    must also be defined.</p>

	  <p>This configuration function is called before execution of a
	    test case group. It typically contains initializations that are
	    common for all test cases and subgroups in the group, and that
	    must only be performed once. <c>GroupName</c> is the name of the
	    group, as specified in the group definition (see
	    <seemfa marker="#Module:groups/0"><c>Module:groups/0</c></seemfa>).
	    Parameter <c>Config</c> is the configuration data that can be
	    modified.
	    The return value of this function is given as <c>Config</c>
	    to all test cases and subgroups in the group.</p>

	  <p>If <c>{skip, Reason}</c>
	    is returned, all test cases in the group are skipped and
	    <c>Reason</c> is printed in the overview log for the group.</p>

	  <p>For information about test case groups, see section
	    <seeguide marker="write_test_chapter#test_case_groups">Test Case
	    Groups</seeguide> in the User's Guide.</p>
    </desc>
    </func>

      <func>
	<name since="">Module:end_per_group(GroupName, Config) -> term() |
	  {return_group_result, Status}</name>
	<fsummary>Test case group finalization.</fsummary>
	<type>
	  <v>GroupName = <seetype marker="#ct_groupname">ct_groupname()</seetype></v>
	  <v>Config = <seetype marker="#ct_config">ct_config()</seetype></v>
	  <v>Status = <seetype marker="#ct_status">ct_status()</seetype></v>
	</type>

	<desc>
	  <p>OPTIONAL; if this function is defined, then <seemfa
	    marker="#Module:init_per_group/2"><c>Module:init_per_group/2</c></seemfa>
	    must also be defined.</p>

	  <p>This function is called after the execution of a test case group
	    is finished. It is meant to be used for cleaning up after
	    <seemfa marker="#Module:init_per_group/2"><c>Module:init_per_group/2</c></seemfa>.
	    A status value for a nested subgroup can be returned with
	    <c>{return_group_result, Status}</c>. The status can be retrieved in
	    <seemfa marker="#Module:end_per_group/2"><c>Module:end_per_group/2</c></seemfa>
	    for the group on the level above. The status is also used by
	    <c>Common Test</c> for deciding if execution of a group is to
	    proceed if property <c>sequence</c> or <c>repeat_until_*</c>
	    is set.</p>

	  <p>For details about test case groups, see section
	    <seeguide marker="write_test_chapter#test_case_groups">Test Case
	    Groups</seeguide> in the User's Guide.</p>
       </desc>
    </func>

      <func>
	<name since="">Module:init_per_testcase(TestCase, Config) -> NewConfig | {fail, Reason} | {skip, Reason}</name>
	<fsummary>Test case initializations.</fsummary>
	<type>
	  <v>TestCase = <seetype marker="#ct_testname">ct_testname()</seetype></v>
	  <v>Config = NewConfig = <seetype marker="#ct_config">ct_config()</seetype></v>
	  <v>Reason = term()</v>
	</type>
	<desc>

	  <p>OPTIONAL; if this function is defined,
	    then <seemfa marker="#Module:end_per_testcase/2">
	      <c>Module:end_per_testcase/2</c></seemfa> must also be
	    defined.</p>

	  <p>This function is called before each test case. Argument
	  <c>TestCase</c> is the test case name, and
	  <c>Config</c> (list of key-value tuples) is the configuration
	  data that can be modified. The <c>NewConfig</c> list returned
	  from this function is given as <c>Config</c> to the test case.
	  If <c>{fail, Reason}</c> is returned, the test case is
	  marked as failed without being executed.</p>

	  <p>If <c>{skip, Reason}</c> is returned, the test case is skipped
	    and <c>Reason</c> is printed in the overview log for the suite.</p>
    </desc>
    </func>

      <func>
	<name since="">Module:end_per_testcase(TestCase, Config) -> term() | {fail, Reason} | {save_config, SaveConfig}</name>
	<fsummary>Test case finalization.</fsummary>
	<type>
	  <v>TestCase = <seetype marker="#ct_testname">ct_testname()</seetype></v>
	  <v>Config = SaveConfig = <seetype marker="#ct_config">ct_config()</seetype></v>
	  <v>Reason = term()</v>
	</type>
	<desc>

	  <p>OPTIONAL; if this function is defined,
	    then <seemfa marker="#Module:init_per_testcase/2">
	      <c>Module:init_per_testcase/2</c></seemfa> must also be
	    defined.</p>

	  <p>This function is called after each test case, and can be used
	    to clean up after
	    <seemfa marker="#Module:init_per_testcase/2"><c>Module:init_per_testcase/2</c></seemfa>
	    and the test case. Any return value (besides <c>{fail, Reason}</c>
	    and <c>{save_config, SaveConfig}</c>) is ignored. By returning
	    <c>{fail, Reason}</c>, <c>TestCase</c> is marked as faulty (even
	    though it was successful in the sense that it returned
	    a value instead of terminating).</p>

	<p>For information on <c>save_config</c>, see section
	  <seeguide marker="dependencies_chapter#save_config">Saving
	  Configuration Data</seeguide> in the User's Guide.</p>
	</desc>
      </func>

    <func>
      <name since="OTP R14B">Module:Testcase() -> [ct_info()] </name>
      <fsummary>Test case information function.</fsummary>
      <type>
      <v><seetype marker="#ct_info">ct_info()</seetype> = {timetrap, Time} | {require, Required} | {require, Name, Required} | {userdata, UserData} | {silent_connections, Conns} | {stylesheet, CSSFile} | {ct_hooks, CTHs}</v>
      <v>Time = TimeVal | TimeFunc</v>
      <v>TimeVal = MilliSec | {seconds, integer()} | {minutes, integer()} | {hours, integer()}</v>
      <v>TimeFunc = {Mod, Func, Args} | Fun</v>
      <v>MilliSec = integer()</v>
      <v>Mod = atom()</v>
      <v>Func = atom()</v>
      <v>Args = list()</v>
      <v>Fun = fun()</v>
      <v>Required = Key | {Key, SubKeys} | {Key, SubKey} | {Key, SubKey, SubKeys}</v>
      <v>Key = atom()</v>
      <v>SubKeys = SubKey | [SubKey]</v>
      <v>SubKey = atom()</v>
      <v>Name = atom()</v>
      <v>UserData = term()</v>
      <v>Conns = [atom()]</v>
      <v>CSSFile = string()</v>
      <v>CTHs = [CTHModule |</v>
      <v>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{CTHModule, CTHInitArgs} |</v>
      <v>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{CTHModule, CTHInitArgs, CTHPriority}]</v>
      <v>CTHModule = atom()</v>
      <v>CTHInitArgs = term()</v>
      <v>CTHPriority = integer()</v>
      </type>

      <desc>

	<p>OPTIONAL</p>

	<p>The test case information function. It is supposed to
	  return a list of tagged tuples that specify various properties
	  related to the execution of this particular test case.
	  Properties set by
	  <seemfa marker="#Module:Testcase/0"><c>Module:Testcase/0</c></seemfa>
	  override properties set previously for the test case by
	  <seemfa marker="#Module:group/1"><c>Module:group/1</c></seemfa> or
	  <seemfa marker="#Module:suite/0"><c>Module:suite/0</c></seemfa>.</p>

	<p>Tag <c>timetrap</c> sets the maximum time that the
	  test case is allowed to execute. If the timetrap time is
	  exceeded, the test case fails with reason <c>timetrap_timeout</c>.
	  <seemfa marker="#Module:init_per_testcase/2"><c>Module:init_per_testcase/2</c></seemfa>
	  and
	  <seemfa marker="#Module:end_per_testcase/2"><c>Module:end_per_testcase/2</c></seemfa>
	  are included in the timetrap time.
	  A <c>TimeFunc</c> function can be used to
	  set a new timetrap by returning a <c>TimeVal</c>. It can also be
	  used to trigger a timetrap time-out by, at some point, returning a
	  value other than a <c>TimeVal</c>. For details, see section
	  <seeguide marker="write_test_chapter#timetraps">Timetrap
	  Time-Outs</seeguide> in the User's Guide.</p>

	<p>Tag <c>require</c> specifies configuration variables
	  that are required by the test case (or <c>init_per_testcase/2</c>
	  or <c>end_per_testcase/2</c>).
	  If the required configuration variables are not found in any of the
	  configuration files, the test case is skipped. For details about
	  the <c>require</c> functionality, see function
	  <seemfa marker="ct#require/1"><c>ct:require/1,2</c></seemfa>.</p>

	<p>If <c>timetrap</c> or <c>require</c> is not set, the
	  default values specified by
	  <seemfa marker="#Module:suite/0"><c>Module:suite/0</c></seemfa> (or
	  <seemfa marker="#Module:group/1"><c>Module:group/1</c></seemfa>) are used.</p>

	<p>With <c>userdata</c>, the user can specify any test case-related
	  information that can be read by calling
	  <seemfa marker="ct#userdata/3"><c>ct:userdata/3</c></seemfa>.</p>

	<p>Other tuples than the ones defined are ignored.</p>

	<p>For details about the test case information function, see section
	  <seeguide marker="write_test_chapter#info_function">Test
	  Case Information Function</seeguide> in the User's Guide.</p>
      </desc>
    </func>

    <func>
	<name since="OTP R14B">Module:Testcase(Config) -> term() | {skip, Reason} | {comment, Comment} | {save_config, SaveConfig} | {skip_and_save, Reason, SaveConfig} | exit()</name>
      <fsummary>A test case.</fsummary>
      <type>
	<v>Config = SaveConfig = <seetype marker="#ct_config">ct_config()</seetype></v>
	<v>Reason = term()</v>
	<v>Comment = string()</v>
      </type>

      <desc>
	<p>MANDATORY</p>

	<p>The implementation of a test case. Call the functions to test and
	  check the result. If something fails, ensure the
	  function causes a runtime error or call
	  <seemfa marker="ct#fail/1"><c>ct:fail/1,2</c></seemfa>
	  (which also causes the test case process to terminate).</p>

	<p>Elements from the <c>Config</c> list can, for example, be read
	  with <c>proplists:get_value/2</c> in STDLIB
	  (or the macro <c>?config</c> defined in <c>ct.hrl</c>).</p>

	<p>If you decide not to run the test case after all, return
	  <c>{skip, Reason}</c>. <c>Reason</c> is then
	  printed in field <c>Comment</c> on the HTML result page.</p>

	<p>To print some information in field <c>Comment</c> on the HTML
	  result page, return <c>{comment, Comment}</c>.</p>

	<p>If the function returns anything else, the test case is
	  considered successful. The return value always gets printed
	  in the test case log file.</p>

	<p>For details about test case implementation, see section
	  <seeguide marker="write_test_chapter#test_cases">Test Cases</seeguide>
	  in the User's Guide.</p>

	<p>For information on <c>save_config</c> and <c>skip_and_save</c>,
	  see section
	  <seeguide marker="dependencies_chapter#save_config">Saving
	  Configuration Data</seeguide> in the User's Guide.</p>
      </desc>
    </func>

  </funcs>

</erlref>