| 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>testcase</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="template.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 32 |
<td><a href="testcasename.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>testcase</h1> |
| 39 |
<p>A testcase is a special function, which is always executed (runs) on the main test component (MTC).</p> |
| 40 |
<ul> |
| 41 |
<li>The result of test case execution is always of <b><font face="Courier New">verdicttype</font></b></li> |
| 42 |
<li>Test cases can be parameterized. When no parameters are used, empty brackets must be written.</li> |
| 43 |
</ul> |
| 44 |
<p>Related keywords:</p> |
| 45 |
<ul> |
| 46 |
<li><a href="in.html"><b><font face="Courier New" color="#003258" size="4">in</font></b></a></li> |
| 47 |
<li><a href="inout.html"><b><font face="Courier New" color="#003258" size="4">inout</font></b></a></li> |
| 48 |
<li><a href="out.html"><b><font face="Courier New" color="#003258" size="4">out</font></b></a></li> |
| 49 |
<li><a href="system.html"><b><font face="Courier New" color="#003258" size="4">system</font></b></a></li> |
| 50 |
<li><a href="runs.html"><b><font face="Courier New" color="#003258" size="4">runs</font></b></a> <a href="on.html"><b><font face="Courier New" color="#003258" size="4">on</font></b></a></li> |
| 51 |
<li><a href="testcasename.html"><b><font face="Courier New" color="#003258" size="4">testcasename</font></b></a></li> |
| 52 |
<li><a href="verdicttype.html"><b><font face="Courier New" color="#003258" size="4">verdicttype</font></b></a></li> |
| 53 |
</ul> |
| 54 |
<hr align="left" width="75%"> |
| 55 |
<div align="center"> |
| 56 |
<center> |
| 57 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 58 |
<tr> |
| 59 |
<td width="100%"> |
| 60 |
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>testcase</b></font><i> testcase_identifier </i> <font face="Courier New" color="#003258" size="5"><b>(</b></font> [ <i>testcase_parameters</i> |
| 61 |
<b>...</b> ] <font face="Courier New" color="#003258" size="5"><b>)</b></font> <font face="Courier New" color="#003258" size="5"><b>runs on</b></font><i> component_type_ref </i> [ <font |
| 62 |
face="Courier New" color="#003258" size="5"><b>system</b></font><i> system_component_type_ref </i>] <font face="Courier New" color="#003258" size="5"><b>{</b></font><i>statement_block</i><font |
| 63 |
face="Courier New" color="#003258" size="5"><b>};</b></font></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>testcase</b></font> keyword introduces the test case definition.</p> |
| 72 |
</li> |
| 73 |
<li> |
| 74 |
<p><i>testcase_identifier</i> is the name used to refer to the test case. Must begin with a letter, may contain letters, numbers and underscore characters. According to the <a |
| 75 |
href="../docs/naming.pdf" target="_blank">Naming convention</a>, the prefix <b>tc_</b> is recommended.</p> |
| 76 |
</li> |
| 77 |
<li> |
| 78 |
<p>The optional <i>testcase_parameters</i> include the test case parameters. The expression begins with an optional keyword indicating the parameter passing method (<a href="in.html"><font |
| 79 |
face="Courier New" size="4"><b>in</b></font></a>, <a href="out.html"><font face="Courier New" size="4"><b>out</b></font></a> or <a href="inout.html"><font face="Courier New" size="4"><b>inout</b></font></a>), |
| 80 |
continues with a reference to a built-in type (cf. <a href="const.html#par1">their list</a>) or a <a href="type.html"> referenced type</a> or a <a |
| 81 |
href="template.html">template</a> and ends by a parameter identifier.</p> |
| 82 |
</li> |
| 83 |
<li> |
| 84 |
<p><b>...</b> indicates that parameters may be repeated. They are separated by comma.</p> |
| 85 |
</li> |
| 86 |
<li> |
| 87 |
<p><a name="The optional">The</a> keywords <font face="Courier New" color="#003258" size="4"><b>runs on</b></font> specifies the main test component (MTC) which the test case is running on. This |
| 88 |
makes the test ports visible to the MTC.</p> |
| 89 |
</li> |
| 90 |
<li> |
| 91 |
<p><i>component_type_ref</i> refers to the main test component type. It is composed of two parts: the module identifier (may be omitted) and the component tpye identifier. The two parts are |
| 92 |
linked by a dot.</p> |
| 93 |
</li> |
| 94 |
<li> |
| 95 |
<p><a name="return">The</a> optional keyword <font face="Courier New" color="#003258" size="4"><b>system</b></font> is only used if a distinct Test System Interface (TSI) is used. Otherwise, MTC |
| 96 |
type defines the TSI ports implicitly.</p> |
| 97 |
</li> |
| 98 |
<li> |
| 99 |
<p align="left"><i> system_component_type_ref </i>refers to the test system interface type.</p> |
| 100 |
</li> |
| 101 |
<li> |
| 102 |
<p align="left"><i><a name="statement_block">statement_block</a></i> may contain both local definitions (of constants, variables and timers) visible only in the defined test case and the program |
| 103 |
part (test case body) defining the behavior of the main Test component (MTC)</p> |
| 104 |
</li> |
| 105 |
</ul> |
| 106 |
<hr align="left" width="50%"> |
| 107 |
<p><a name="Ex4">Example 1a</a>: MTC & System present in the configuration |
| 108 |
<p><font face="Courier New">testcase tc_MyTestCase() <br> |
| 109 |
runs on MyMTCType_CT <br> |
| 110 |
system MyTestSystemType_SCT <br> |
| 111 |
{ ... };</font></p> |
| 112 |
<p>The test case tc_MyTestCase has no input parameters. MTC is of type MyMTCType_CT and the system interface is of type MyTestSystemType_SCT. The statement block contains the behavior |
| 113 |
defined in the curly brackets.</p> |
| 114 |
<hr align="left" width="50%"> |
| 115 |
<p>Example 1b: Configuration consists only of an MTC |
| 116 |
<p><font face="Courier New">testcase tc_MyTestCase2() <br> |
| 117 |
runs on MyMTCType_CT <br> |
| 118 |
{ ... };</font></p> |
| 119 |
<p>The test case tc_MyTestCase2 has no input parameters. MTC is of type MyMTCType_CT. The statement block contains the behavior defined in the curly brackets.</p> |
| 120 |
<hr align="left" width="25%"> |
| 121 |
<hr align="left" width="25%"> |
| 122 |
<p><a HREF="BNF.html#testcasedef">BNF definition</a> of <font face="Courier New"> testcase</font></p> |
| 123 |
</body> |
| 124 |
</html> |