| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
<html> |
| 16 |
<head> |
| 17 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 18 |
<meta http-equiv="Content-Language" content="en-us"> |
| 19 |
<title>module</title> |
| 20 |
</head> |
| 21 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 22 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 23 |
<tr> |
| 24 |
<td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td> |
| 25 |
</tr> |
| 26 |
</table> |
| 27 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 28 |
<tr> |
| 29 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 30 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 31 |
<td><a href="modifies.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 32 |
<td><a href="modulepar.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 33 |
</tr> |
| 34 |
</table> |
| 35 |
<p><br clear="all"> |
| 36 |
</p> |
| 37 |
<hr> |
| 38 |
<h1>module</h1> |
| 39 |
<hr align="left" width="75%"> |
| 40 |
<p>The principal building blocks of TTCN-3 are modules written as free text files: line breaks or paragraph marks may be used without restrictions. |
| 41 |
<ul> |
| 42 |
<li>A test suite consists of one or more modules; there is no hierarchy between modules;</li> |
| 43 |
<li>a module contains a module definitions and an (optional) module control part;</li> |
| 44 |
<li>In the module definitions part, definitions can be collected in named <a href="group.html"><b><font face="Courier New" color="#003258" size="4">group</font></b></a>s.</li> |
| 45 |
<li>modules can have parameters supplied to the module at run-time and are considered constant during test execution;</li> |
| 46 |
<li>modules can have attributes giving additional information, like coding rules or the size of a table.</li> |
| 47 |
</ul> |
| 48 |
<p>Related keywords:</p> |
| 49 |
<ul> |
| 50 |
<li><a href="control.html"><b><font face="Courier New" color="#003258" size="4">control</font></b></a></li> |
| 51 |
<li><a href="group.html"><b><font face="Courier New" color="#003258" size="4">group</font></b></a></li> |
| 52 |
<li><a href="modulepar.html"><b><font face="Courier New" color="#003258" size="4">modulepar</font></b></a></li> |
| 53 |
<li><a href="with.html"><b><font face="Courier New" color="#003258" size="4">with</font></b></a></li> |
| 54 |
</ul> |
| 55 |
<hr align="left" width="50%"> |
| 56 |
<div align="center"> |
| 57 |
<center> |
| 58 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 59 |
<tr> |
| 60 |
<td width="100%"> |
| 61 |
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>module</b></font> <i>module_identifier</i> <font face="Courier New" color="#003258" size="5"><b>{</b></font> [ <i>module_definitions</i> |
| 62 |
] [ <font face="Courier New" color="#003258" size="5"><b>control {</b></font><i>module_control</i> <b><font face="Courier New" color="#003258" size="5">}</font></b> ] <b><font |
| 63 |
face="Courier New" color="#003258" size="5">}</font></b> [ <font face="Courier New" color="#003258" size="5"><b>with </b></font><i>attributes</i> ]</h3> |
| 64 |
</td> |
| 65 |
</tr> |
| 66 |
</table> |
| 67 |
</center> |
| 68 |
</div> |
| 69 |
<ul> |
| 70 |
<li> |
| 71 |
<p>The <font face="Courier New" color="#003258" size="4"><b>module</b></font> keyword introduces the module definition.</p> |
| 72 |
</li> |
| 73 |
<li> |
| 74 |
<p><i>module_identifier</i> is the name used to refer to the module. Must begin with a letter, may contain letters, numbers and underscore characters.</p> |
| 75 |
</li> |
| 76 |
<li> |
| 77 |
<p>the optional <i>module_definitions</i> part may contain type, constant, template, function, signature, testcase, altstep and group definitions.</p> |
| 78 |
</li> |
| 79 |
<li> |
| 80 |
<p>the optional <i>module_control</i> part states the execution order of the test cases (cf. the keyword <a href="execute.html"><b><font face="Courier New">execute</font></b></a>) and may |
| 81 |
contain local definitions.</p> |
| 82 |
</li> |
| 83 |
<li> |
| 84 |
<p><i>attributes:</i> see the keyword <b><font face="Courier New"><a href="with.html">with</a></font></b> for details.</p> |
| 85 |
</li> |
| 86 |
</ul> |
| 87 |
<hr align="left" width="50%"> |
| 88 |
<p><a name="parametrized">Example</a> |
| 89 |
<p><font face="Courier New">module Principal {<br> |
| 90 |
modulepar float tsp_hlavni;<br> |
| 91 |
modulepar integer tsp_vypinac, tsp_nouzove;<br> |
| 92 |
<br> |
| 93 |
type component CT {};<br> |
| 94 |
type enumerated Examplg {jeudi, vendredi, samedi};<br> |
| 95 |
<br> |
| 96 |
testcase tcprov() runs on CT { <br> |
| 97 |
/* Imagine Test Case body here */<br> |
| 98 |
};<br> |
| 99 |
control {execute (tc_prov())}</font><br> |
| 100 |
} |
| 101 |
<p>The module Principal declared here has one float (tsp_hlavni) and two integer module parameters (tsp_vypinac, tsp_nouzove), an empty component type (CT) as well as an enumerated type (Examplg) |
| 102 |
defined in the module definitions part. The control part contains the execution of the test case tc_prov.</p> |
| 103 |
<hr align="left" width="25%"> |
| 104 |
<hr align="left" width="25%"> |
| 105 |
<p><a HREF="BNF.html#ttcn3module">BNF definition</a> of <font face="Courier New"> module</font></p> |
| 106 |
</body> |
| 107 |
</html> |