# testcase

A testcase is a special function, which is always executed (runs) on the main test component (MTC).

- The result of test case execution is always of verdicttype
- Test cases can be parameterized. When no parameters are used, empty brackets must be written.

Related keywords:

- in
- inout
- out
- system
- runs on
- testcasename
- verdicttype

### testcase testcase_identifier ( [ testcase_parameters ... ] ) runs on component_type_ref [ system system_component_type_ref ] {statement_block};

- The testcase keyword introduces the test case definition.

- testcase_identifier 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 Naming convention, the prefix tc_ is recommended.

- The optional testcase_parameters include the test case parameters. The expression begins with an optional keyword indicating the parameter passing method (in, out or inout), continues with a reference to a built-in type (cf. their list) or a referenced type or a template and ends by a parameter identifier.

- ... indicates that parameters may be repeated. They are separated by comma.

- The keywords runs on specifies the main test component (MTC) which the test case is running on. This makes the test ports visible to the MTC.

- component_type_ref 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 linked by a dot.

- The optional keyword system is only used if a distinct Test System Interface (TSI) is used. Otherwise, MTC type defines the TSI ports implicitly.

- system_component_type_ref refers to the test system interface type.

- statement_block may contain both local definitions (of constants, variables and timers) visible only in the defined test case and the program part (test case body) defining the behavior of the main Test component (MTC)

Example 1a: MTC & System present in the configuration

testcase tc_MyTestCase()
runs on MyMTCType_CT
system MyTestSystemType_SCT
{ ... };

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 defined in the curly brackets.

Example 1b: Configuration consists only of an MTC

testcase tc_MyTestCase2()
runs on MyMTCType_CT
{ ... };

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.

BNF definition of testcase