Skip to content
UserScenarios.md 85.8 KiB
Newer Older
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649
that are essential for the specification of a test description. Some of the details can be inferred easily, while others allow for different interpretations. 
In order to narrow down the spectrum of possible interpretations, it is recommended that guidelines and conventions are defined in advance and enforced during 
the specification of the structured test objectives. This can streamline the refinement process and pave the way for standardized refinement of structured test 
objectives into test descriptions. 

The examples are provided in the textual representation for brevity and convenience. The graphical representation can be used instead as well.

### Data

6.4.2 

TDL-TO provides different means for the use of data within a 'StructuredTestObjective'. In addition to the use of defined 'DataIntances' and 'SpecialValueUse's, 
TDL-TO provides means for the specification of literal 'Value's inline, within a 'StructuredTestObjective'.

The use of defined 'DataInstance's and 'SpecialValueUse's does not require particular handling as the same 'DataInstance's can be used in the resulting 
'TestDescription's. While the concrete syntax may be different, the underlying model elements are the same. The corresponding 'DataType's may need to be 
taken into account if a 'TestConfiguration' needs to be inferred from the 'StructuredTestObjective'. Additionally, any qualifying 'Comment's used to describe 
further details related to the context of its usage may need to be interpreted according to the existing conventions (if defined). The example in Figure 6.4.2-1 
illustrates the definition of 'DataType's and 'DataInstance's in TDL-TO. The corresponding data definitions in the textual representation of TDL are shown 
in Figure 6.4.2-2. Apart from minor syntactical differences, the underlying model structures are the same. In fact, the TOP tools enable cross referencing between 
both notations so that data definitions in TDL can be reused in TDL-TO and vice-versa.

    Package data {
      Data {
        type float;
        type position with x of type float, y of type float;
        float -22; 
        float -21; 
        position startingPosition containing x indicating value -21;
      } 	
    }
    
Figure 6.4.2-1: Predefined data example in TDL-TO

    Package data {
      Type float ;
      Type position ( x of type float , y of type float ) ;
      float -22 ;
      float -21 ;
      position startingPosition ( x = -21 ) ;
    }

Figure 6.4.2-2: Corresponding data in TDL

TDL-TO permits the use of 'LiteralValue's as a flexible way for specifying the arguments of 'EventOccurrenceSpecification's. This can be useful, especially 
at an early stage, where the data structures and contents are not fixed yet. 'LiteralValue's may contain descriptions of the structure and contents of the 
'LiteralValue'. Additionally, 'LiteralValue's may be referenced within the same 'StructuredTestObjective'. Any qualifying 'Comment's used to describe further 
details related to the context of its usage may need to be interpreted according to the existing conventions (if defined).

In order to transform 'LiteralValue's, first corresponding 'DataType's and 'DataInstance's need to be inferred. Consider the following example illustrated 
in Figure 6.4.2-3, showing a 'LiteralValue' specification within an 'EventOccurrenceSpecification'. The basic structure is the same, but there are no predefined 
'DataType's and 'DataInstance's. The inferred 'DataType's and 'DataInstance's are illustrated in Figure 6.4.2-4. The inferred 'DataElement's are prefixed 
with 'inferred_' for illustrative purposes. The contextual information may provide hints for more appropriate naming. Apart from the inference, type compatibility 
and merging needs to be considered. In this example, it is assumed that 'x' and 'y' are of the same type, otherwise distinct 'DataType's need to be inferred 
as well. If a 'StructuredDataInstance' is used only once, it is also possible to specify it as inline 'DataInstanceUse' in TDL.


<figure>
<code>
    when { 
        the Controller entity sends the start position containing 
          x indicating value 22,
          y indicating value 21
      ; 
    } then {
        the Object entity moves_to the received start position
    } 
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.2-3: Literal data in TDL-TO</b></figcaption>
</figure>


<figure>
<code>
    Package inferred_data {
      Type inferred_simple ;
      Type inferred_position ( x of type inferred_simple, y of type inferred_simple) ;
      inferred_simple 22 ;
      inferred_simple 21 ;
      inferred_position inferred_start_position ( x = 22, y = 21 ) ;
    }
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.2-4: Inferred literal data in TDL</b></figcaption>
</figure>


In case existing 'DataInstance's are used and corresponding 'DataMapping's exist, these can be reused as well. Otherwise, the 'DataMapping's can be 
defined as part of the refinement process for both existing data specifications and data specifications inferred from inline literal data specifications.

### Configurations

6.4.3 

Similar to the use of data, TDL-TO provides different means for the specification of the entities related to an 'EventOccurrenceSpecification'. Abstract 
entities can be useful, especially at an early stage, where the 'TestConfiguration's are not fixed yet. If 'TestConfiguration's are already specified, 
the corresponding 'ComponentInstances' can be used in 'EventOccurrenceSpecification's. An example for a simple 'TestConfiguration' and corresponding 
'ComponentType's and 'GateType's specified in TDL-TO is shown in Figure 6.4.3-1. The corresponding definitions in the textual representation of TDL are 
showing in Figure 6.4.3-2. The use of defined 'ComponentInstance's does not require particular handling as the same 'TestConfiguration's can be used in 
the resulting 'TestDescription's. Apart from minor syntactical differences, the underlying model structures are the same. The TOP tools enable 
cross referencing between both notations so that definitions related to 'TestConfiguration's in TDL can be reused in TDL-TO.


<figure>
<code>
    Package base_configuration {
      import all from data;
      Configuration {
        Interface Type wireless accepts position;
        Component Type unit with gate wifi of type wireless;
        Test Configuration basic containing 
          Tester component controller of type unit 
          SUT component object of type unit
          connection between controller.wifi and object.wifi
        ; 
      }
    }
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.3-1: Predefined configuration example in TDL-TO</b></figcaption>
</figure>


<figure>
<code>
    Package base_configuration {
      Import all from data ;
      Gate Type wireless accepts position ;
      Component Type unit having {
        gate wifi of type wireless ;
      }
      Test Configuration basic {
        create Tester controller of type unit ;
        create SUT object of type unit ;
        connect controller.wifi to object.wifi ;
      }
    }
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.3-2: Corresponding configuration in TDL</b></figcaption>
</figure>


The use of abstract entities provides more flexibility early on, however, it requires clear guidelines and conventions for the interpretation of the abstract 
entities. An 'Entity' may be transformed into a 'ComponentInstance' or a 'GateInstance' depending on the intended interpretation. Hints and conventions regarding 
the desired interpretation of an 'Entity' can be provided in the 'Entity' definition, in the context of its use, or outside the TDL-TO specification. 
Considering the example illustrated in Figure 6.4.2-3, it can be inferred that the 'Controller' entity and the 'Object' entity have some means to interact without 
this being explicitly specified. Figure 6.4.3-3 illustrates one possible 'TestConfiguration' which can be inferred from the behaviour specification in Figure 6.4.2-3. 
First, one or more 'GateType's need to be inferred, then the corresponding 'ComponentType's and their 'GateInstance's. For simplicity, it is assumed that 'Controller' 
and 'Object' are of the same 'ComponentType', conventions may be put in place to indicate that. Alternatively, subsequent refinement may further differentiate the 
'ComponentType's where appropriate. Finally, the 'TestConfiguration' is inferred, including assigning 'ComponentInstance's with corresponding roles, as well as 
'Connection's between the inferred 'GateInstance's. In this example, the roles and 'Connections' are inferred based on the 'EventOccurrenceSpecification's and their 
context (e.g. when/then clauses, etc.). Similar to 'DataType's, compatible inferred 'TestConfiguration's, 'ComponentType's, and 'GateType's need to be identified and 
merged where applicable to avoid unnecessary duplication.


<figure>
<code>
    Package inferred_configuration {
      Import all from data 
      Gate Type inferred_gate_type accepts inferred_position ;
      Component Type inferred_component_type having {
        gate inferred_gate of type inferred_gate_type ;
      }
      Test Configuration inferred_move_object {
        create Tester Controller of type inferred_component_type ;
        create SUT Object of type inferred_component_type ;
        connect Controller.inferred_gate to Object.inferred_gate ;
      }
    }
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.3-3: Inferred configuration in TDL</b></figcaption>
</figure>



### Behaviour

6.4.4 

Initial conditions, expected behaviour, and final conditions in TDL-TO are expressed by means of 'EventSequences'. 'EventSequences' are comprised of 
'EventOccurrenceSpecification's. This provides simple generic high-level construct with loose semantics indicated by the referenced 'Event'. The 
interpretation of the 'Event' can be indicated in the domain description and/or refined in the 'EventOccurrenceSpecification'. It is recommended to establish 
well-defined specification conventions in order to ensure consistent interpretation. TDL 'TestDescriptions' require more differentiated specification of 
behaviour, distinguishing between 'Interaction's, 'Action's, and other kinds of 'Behaviour's. While some assumptions regarding the mapping of 'Event's to 
'AtomicBehaviour's can be made intuitively, it is recommended to define explicit conventions in order to ensure consistent interpretation and transformation. 
The example in Figure 6.4.4 1 illustrates a minimal 'StructuredTestObjective' containing only the specification of the expected behaviour. Assuming the data 
and configuration related information has been inferred as illustrated in the previous examples, the corresponding 'TestDescription' inferred from the 
'StructuredTestObjective' is shown in Figure 6.4.4-2. In this scenario, the first 'EventOcurrenceSpecification' in the 'whenClause' is interpreted as an 
'Interaction' between the 'Controller' and the 'Object', the latter is assumed to be the implicit opposite entity in the 'EventOcurrenceSpecification'. 
It is recommended to make opposite entities explicit whenever possible. The second 'EventOcurrenceSpecification' in the 'thenClause' is interpreted as an 
'ActionReference'. In this case, it is also necessary to infer a definition for the action.


<figure>
<code>
    Test Purpose {   
        TP Id TP_MOVE_OBJECT_LITERAL
        Test objective "Move object to destination with literal values."
        Expected behaviour 
        ensure that {
            when { 
                the Controller entity sends the start position containing 
                  x indicating value 22,
                  y indicating value 21
              ; 
            } then {
                the Object entity moves_to the received start position
            } 
        }
    }
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.4-1: Expected behaviour specification in TDL-TO</b></figcaption>
</figure>


<figure>
<code>
    Action move_to (position of type inferred_position);
    Test Description TD_MOVE_OBJECT_LITERAL uses configuration inferred_move_object {
      Controller.inferred_gate sends inferred_start_position to Object.inferred_gate;
      perform action move_to (position = inferred_start_position) on Object;
    }
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.4-2: Corresponding behaviour specification in TDL</b></figcaption>
</figure>

If desired, especially when 'StructuredDataInstance's are used only once, it is also possible to specify them as inline 'DataInstanceUse's in TDL. The resulting 
'TestDescription' for the example in Figure 6.4.4-1 is shown in Figure 6.4.4 3, where instead of the 'inferred_start_position' 'DataInstance', the corresponding 
data is specified inline. Since the 'DataInstance' is used twice in this case, it results in some duplication.


<figure>
<code>
    Action move_to (position of type inferred_position);
    Test Description TD_MOVE_OBJECT_LITERAL_INLINE uses configuration inferred_move_object {
      Controller.inferred_gate sends new inferred_position (x = 22, y = 21) to Object.inferred_gate;
      perform action move_to (position = new inferred_position (x = 22, y = 21)) on Object;
    } 
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.4-3: Corresponding behaviour specification in TDL using inline data</b></figcaption>
</figure>


The steps for the derivation of 'TestDescription's from 'StructuredTestObjective's can be translated to other notations as well. Fundamentally, the process 
remains the same, starting with the data definitions, through the test configurations, and finally the behaviour specifications. The above guidelines can be 
used as a template for deriving 'TestDescription's from other kinds of documents and artifacts as a starting point.

### 6.4.5 Transformation Conventions and Assumptions

The transformation of 'LiteralValue's involves the following conventions:

 - If the 'Content' of the 'LiteralValue' is empty, the 'LiteralValue' is mapped to a 'SimpleDataType' with a 'name' corresponding to the 'name' of the 'LiteralValue'. 
   If qualifier 'Comment's are present, a 'SimpleDataInstance' is created with a 'name' corresponding to the concatenated 'bodies of the qualifier 'Comment's. 
   Alternatively, the 'name' of the 'DataType' can also be prefixed with the concatenated 'bodies of the qualifier 'Comment's. If the corresponding 'DataType' or 
   'DataInstance' exists, no action is taken.
   
 - If the 'Content' of the 'LiteralValue' is not empty, the 'LiteralValue' is mapped to a 'StructuredDataType' with a 'name' corresponding to the 'name' of the 
   'LiteralValue'. If qualifier 'Comments are present, a 'StructuredDataInstance' is created with a 'name' corresponding to the concatenated 'bodies of the qualifier 
   'Comment's. Alternatively, the 'name' of the 'DataType' can also be prefixed with the concatenated 'bodies of the qualifier 'Comment's. If the corresponding 
   'DataType' or 'DataInstance' exists, no action is taken.
   
 - Each 'Content' element of the 'LiteralValue' is mapped to a 'Member' within the corresponding 'StructuredDataType' with a 'name' corresponding to the 'name' of 
   the 'Content'. If a 'Member' with the same 'name' exists, no action is taken. The 'DataType' of the 'Member' corresponds to:
   
    -	A new 'DataType' corresponding to the 'Content' with a 'name' prefixed with the 'name' of the containing 'StructuredDataType' in case a 'Content' 
      is directly contained within the 'Content'.
      
    -	A (default) 'SimpleDataType' corresponding to the 'LiteralValue' in case a 'LiteralValue' is directly contained within the 'Content'.
    
    -	The 'DataType' corresponding to the 'dataType' of the 'DataInstanceUse' in case a 'DataReference' is directly contained within the 'Content'.
    
 - Each nested 'Content' or 'LiteralValue' element is transformed according to the conventions above.
 
For example, as shown in Figure 6.4.5-1 and Figure 6.4.5-3, for the 'EventOccurrenceSpecification' taken from [i.37], a corresponding 'StructuredDataType' is 
created for both the 'LiteralValue' 'message' and for the 'payload' 'Content' of the 'message'. The 'dataType' for the 'payload' 'Member' is then set accordingly. 
Instead, since the 'value's for the 'filterLength' and 'topic_filter' Content's correspond to 'DataReference's to defined 'DataInstance's, as shown in Figure 6.4.5-2, 
the 'dataType's for the corresponding 'Member's in the derived 'SUBSCRIBE_message_payload' 'DataType' are: set to the 'dataType's of the referenced 'DataInstance's.


<figure>
<code>
      the IUT entity receives a SUBSCRIBE message containing
        payload containing
           filterLength corresponding to TOPIC_FILTER_LEN_SEC_CVE_01,
           topic_filter corresponding to TOPIC_FILTER_LEN_SEC_CVE_01;;
      from the ATTACKER_CLIENT entity
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.5-1: 'LiteralValue's and 'DataReference's example (from [i.37])</b></figcaption>
</figure>


<figure>
<code>
      Data {
        UTF8String TOPIC_FILTER_SEC_CVE_01;  // topic filter used in TP_MQTT_BROKER_SEC_CVE_001
        Int16 TOPIC_FILTER_LEN_SEC_CVE_01;   // corresponds to lengthof(TOPIC_FILTER_SEC_CVE_01) + 1
      }
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.5-2: Corresponding 'DataInstance' definitions (from [i.37])</b></figcaption>
</figure>

<figure>
<code>
      Type SUBSCRIBE_message (
        payload of type SUBSCRIBE_message_payload
      ) ;
      Type SUBSCRIBE_message_payload (
        filterLength of type Int16 ,
        topic_filter of type UTF8String
      ) ;
</code>
<figcaption style="text-align:center"> <b>Figure 6.4.5-3: Resulting 'DataType' specifications in TDL</b></figcaption>
</figure>

For the transformation of 'EventOccurrence's into 'Behaviour's, it is necessary to first derive the corresponding 'TestConfiguration' if no 'TestConfiguration' 
is specified for the 'StructuredTestObjective'. The derivation of the 'TestConfiguration' involves the following conventions:

 - Each 'EntityReference' is transformed a 'ComponentType' and a 'GateType', where the 'GateType' accepts the 'DataType's resulting from the transformation of 
   the 'LiteralValue's specified as arguments of the 'EventOccurrence'. The 'ComponentType' contains a 'GateInstance' of the transformed 'GateType'. If the 
   'ComponentType', 'GateType', or 'GateInstance' already exists, no action is taken.
   
 - A 'TestConfiguration' is constructed with 'ComponentInstance's of the 'ComponentType's resulting from the transformation above. It is recommended to use naming 
   conventions, annotations, or other conventions to indicate the roles of the 'ComponentInstance's, otherwise the roles are set to a default value of 'Tester' 
   or 'SUT' and need to be adjusted afterwards. While opposite 'EntityReference's are optional, it is recommended that they are explicitly specified, otherwise an 
   implicit 'Tester' 'ComponentInstance' needs to be assumed and constructed. If the assumption of an implicit 'Tester' does not hold, the transformed 'TestConfiguration' 
   may need to be adjusted.
   
 - Within the 'TestConfiguration', 'Connection's need to be created between interacting 'ComponentInstance's for every 'EventOccurrence'. If a 'Connection' already 
   exists, no action is taken.
   
 - Conventions or comparison between 'TestConfiguration's are recommended to avoid duplicate identical configurations.
   Once a suitable 'TestConfiguration' is derived, 'EventOccurrence's can be transformed into 'Behaviour's. There can be different strategies, ranging from 
   transforming 'EventOccurrence's into detailed 'Interaction's, to transforming 'EventOccurrence's into abstract 'TestDescription' skeletons as containers for 
   manually specified 'Behaviour's. This may depend on the general test specification process and/or the level of detail of the structured test objective specifications. 
   Assuming detailed 'Message's as the target, the following conventions can be applied:
   
 - A 'TestDescription' using the 'TestConfiguration' resulting from the transformation above is constructed as a container for the 'Behaviour's. For traceability and 
   in general, it is recommended that the 'TestDescription' references the 'StructuredTestObjective' as its 'testObjective'.
   
 - In the simplest case, the 'TestDescription' contains one 'CompoundBehaviour' which contains the individual 'Behaviour's corresponding to the 'EventOccurrence's.
 
 - If desired, the 'CompoundBehaviour' may contain further 'CompoundBehaviour's corresponding to the structural blocks of the 'StructuredTestObjective', e.g. 
   "Initial conditions", "Expected behaviour", "when/then"-clauses, etc., so that the resulting 'TestDescription' more closely reflects the structure of the corresponding 
   'StructuredTestObjective'. The additional 'CompoundBehaviour's may be annotated to clearly specify their purpose and potentially also influence how tools represent or 
   treat the individual 'Behaviour's within the additional 'CompoundBehaviour's.
   
 - The individual 'EventOccurrence's are transformed into corresponding 'Behaviour's. In the absence of further information, it needs to be specified what the default 
   'Behaviour' should be. In general, suitable conventions and 'Annotation's are recommended to ensure easier transformation. Assuming that the target 'Behaviour' is a 
   'Message', a 'Message' is constructed with the source and target 'GateReference's corresponding to the 'EntityReference's of the 'EventOccurrence'. The assumptions 
   for the transformation of 'TestConfiguration's apply in this case as well, particularly when no opposite 'EntityReference' is specified. A 'DataUse' is then constructed 
   as the argument of the 'Message' based on the 'LiteralValue' specified as the argument of the 'EventOccurrence' and the 'DataType's resulting from the transformation above.


   
## Defining Test Descriptions

6.5 

### Overview

6.5.1

In the absence of structured test objectives or other documents which can serve as a starting point, test descriptions can be defined from scratch. The fundamental steps 
in the process involve the definition of data first, then configurations, finally the behaviour. The following examples illustrate the different steps by means of the 
graphical syntax for TDL with the help of the graphical editor.

### 6.5.2 Data and Configuration

Since the 'Generic TDL' diagram accommodates both the specification of data- and configuration-related elements, both are contemplated together. If necessary, separate 
diagrams can be created instead to capture only data-related or configuration-related elements separately. In the example shown in Figure 6.5.2-1 the one diagram approach 
is shown for conciseness and also to show a complete overview of all relevant elements in one place. On the top-left side the predefined simple data types are shown. 
In the bottom part the verdict-related types and instances are shown. On the right side behaviour-related definitions for an 'Action' and a 'TestDescription' are shown. 
Finally, in the middle part, the data types, data instances, as well as component and gate types and the test configuration are shown. The graphical editor does provide 
some more flexibility with regard to the order of creation of the different elements. However, the fundamental order remains the same - data, configuration, behaviour.
 
 

![Data and configuration specification](images/DataAndConfSpecInTdlGr.png)

Figure 6.5.2-1: Data and configuration specification in TDL using the graphical editor

### Test Behaviour and Time

6.5.3 

The 'TDL Behaviour' diagram allows the visualization and specification of the behaviour of an individual 'TestDescription'. While the 'TestDescription' itself is 
defined within a 'Generic TDL' diagram, including its name, parameters, test configuration, and test objectives, the specifics of the behaviour are shown in a separate 
'TDL Behaviour' diagram. The example shown in Figure 6.5.3-1 illustrates the behaviour of the 'TD_MOVE_OBJECT' 'TestDescription'. In addition to the basic behaviour, 
temporal properties of the behaviour are illustrated with the help of a 'TimeLabel' and a 'TimeConstraint'.
 
 ![Test behaviour in TDL using the graphical editor](images/TestBehaviourInTdlInGrFormat.png)
 
Figure 6.5.3-1: Test behaviour in TDL using the graphical editor

'TestDescriptionReference's enable the reuse of behaviour definitions. While in some other high-level test specification languages the use of so-called "data tables" 
has been gaining some popularity, TDL provides more sophisticated facilities both for the definition of data and for the reuse of behaviour. A parameterized 
'TestDescription' can be invoked multiple times with different data instances as shown in the example in Figure 6.5.3-2. In the 'TC_MOVE_AROUND' 'TestDescription', 
the 'TC_MOVE_TO' 'TestDescription is invoked four times to describe a test sequence where the 'Object' needs to move to four positions.

    Test Description TC_MOVE_TO (target_position of type inferred_position) 
    uses configuration inferred_move_object {
      Controller.inferred_gate sends parameter target_position to Object.inferred_gate;
      perform action move_to (position = parameter target_position) on Object;
    }	

    Test Description TC_MOVE_AROUND 
        uses configuration inferred_move_object {
      execute TC_MOVE_TO (target_position = start_position);
      execute TC_MOVE_TO (target_position = open_position);
      execute TC_MOVE_TO (target_position = closed_position);
      execute TC_MOVE_TO (target_position = end_position);
    }	

Figure 6.5.3-2: Test behaviour reuse in TDL using test description references


## Transforming Test Descriptions into TTCN-3 Test Cases

6.6 

### Overview

6.6.1 

One way to obtain executable test cases from TDL is to transform the test descriptions into TTCN-3 code. The standardized mapping to TTCN-3 in ETSI ES 203 119-6 [i.18] 
specifies in great detail all the peculiarities that need to be considered for the derivation of executable test cases in TTCN-3 from TDL. The basic steps remain fundamentally 
the same, involve transforming the data definitions, the configuration-related definitions, as well as the behaviour specifications. All the transformations have to take 
into account the semantic gaps between both languages, as well as the intrinsic differences in the levels of abstraction. The standardized mapping is defined for locally 
ordered test descriptions only. Thus, if totally ordered test descriptions are the starting point, these first need to be transformed into locally ordered test descriptions, 
keeping in mind the differences in semantics and the additional constraints that are imposed by locally ordered test descriptions. The prototypical implementation of the 
mapping within the TOP provides automated translation for the essential parts necessary for the transformation of TDL 'TestDescription's to TTCN-3 test cases.

### Data

6.6.2 

To illustrate the mapping of the data-related elements, consider the example in Figure 6.6.2-1. It illustrates different data definitions and data uses. The corresponding 
equivalents in TTCN-3 are shown in Figure 6.6.2-2. The mappings for data are pretty straightforward in this example. Although the use of data mappings is recommended, 
in which case the respective mapping targets are used instead, it is also possible to generate basic data definitions in case no data mappings are present. 
Annotations can be used to override assumptions.

        //data types
        Type SESSIONS (id1 of type Integer, id2 of type Integer);
        Type MSG (ses of type SESSIONS, content of type String);
    
        //data instances
        SESSIONS s1(id1 = 1, id2 = 2);
        SESSIONS s2(id1 = 11, id2 = 22); 
        MSG msg1(ses = s1, content = m1);
    
        //value data instances
        SESSIONS c_s1(id1 = 1, id2 = 2) with {VALUE;}; 
        MSG c1(ses = s1, content = c1) with {VALUE;};
    
        Component Type ct having {
            //variables
            variable v1 of type MSG with {VALUE;};
            variable v2 of type MSG;
            gate g of type gt;
        }

Figure 6.6.2-1: Test data example in TDL

        //data types
        type record SESSIONS { 
            integer id1,
            integer id2
        }
        type record MSG { 
            SESSIONS ses, 
            charstring content
        }
        
        //templates
        template SESSIONS s1 := {id1:=1, id2:=2} 
        template SESSIONS s2 := {id1:=11, id2:=22} 
        template MSG msg1 := {ses := s1, content := "m1"}
        
        //value -> constant
        const SESSIONS c_s1 := {id1:=1, id2:=2}
        const MSG c1 := {ses := c_s1, content := "c1"} 
    
        type component ct {
            //variables
            var MSG v1;
            var template MSG v2;
            port gt g;
        }
        
Figure 6.6.2-2: Test data equivalents for Figure 6.6.2-1 in TTCN-3


### Configuration

6.6.3 

With regard to test configurations, there are several concerns to address. TTCN-3 provides means for the dynamic instantiation and management of test configurations. 
The essential parts of a configuration include the main test component which plays a special role, zero or more parallel test components, as well as a unified system 
interface. There is a distinction between connecting and mapping ports and there are some restrictions with regard to these. In TDL the test configuration is defined 
upfront and remains static. TDL also provides a holistic view where the SUT can be decomposed into multiple interconnected components. The example in Figure 6.6.3-1 
illustrates a minimal test configuration in TDL. The corresponding mapping in TTCN-3 is illustrated in Figure 6.6.3-2. A unified system interface needs to be inferred 
in case there are multiple SUT components. The steps for instantiating and mapping/connecting the components are encapsulated in a function.

        Gate Type defaultGT accepts 
            ACK, PDU, PDCCH, C_RNTI, CONFIGURATION ;
    
        Component Type defaultCT having {
	        gate g of type defaultGT;
        }
    
        Test Configuration defaultTC {
	        create Tester SS of type defaultCT;
	        create SUT UE of type defaultCT ;
	        connect UE.g to SS.g ;
        }

Figure 6.6.3-1: Test configuration example in TDL

    type port defaultGT_to_map message {  
      //this is a port type for SUT-Tester connections
      inout charstring, PDCCH /* ACK, PDU, C_RNTI, CONFIGURATION ; */  
    }  
    
    type port defaultGT_to_connect message { 
      //this is a port type for Tester-Tester connections 
      inout charstring, PDCCH /* ACK, PDU, C_RNTI, CONFIGURATION ; */  
    }
    
    type component MTC_CT { 
      //component type for MTC
      //variable for the PTC(s) --TESTER component(s) in TDL
      var defaultCT TESTER_SS; 
    }
      
    type component defaultCT { 
      port defaultGT_to_map g_to_map;
      port defaultGT_to_connect g_to_connect;
    }
    
    function defaultTC() runs on MTC_CT { 
      // Test Configuration defaultTC, mappings, connections
      TESTER_SS := defaultCT.create;
      map (TESTER_SS:g_to_map,system:g_to_map);
    }

Figure 6.6.3-2: Test configuration related equivalents for Figure 6.6.3-1 in TTCN-3

###  Behaviour

6.6.4

In terms of behaviour, TTCN-3 and TDL also have different assumptions. In TTCN-3, the focus is on the test system view, where all components execute their behaviour 
concurrently and independently unless there is explicit synchronization among them. TDL aims to provide a global view with the possibility to specify both locally and 
totally ordered behaviour, with explicit or implicit synchronization respectively. For the standardized mapping to TTCN-3 only the local ordering is taken into consideration. 
User-defined mappings may also tackle the totally ordered behaviour. In the example shown in Figure 6.6.4-1 a locally ordered 'TestDescription' is illustrated. The 
corresponding mappings in TTTCN-3 are shown in Figures 6.6.4-2, 6.6.4-3, and 6.6.4-4. First, the default handling needs to be taken care of. This involves the definition 
of altsteps to handle deviations from the specified behaviour as well as quiescence, which is illustrated in Figure 6.6.4-2. Then the actual test behaviour from the 
test system's point of view is translated to a function as illustrated in Figure 6.6.4-3. Finally, in Figure 6.6.4-4 a test case is defined which takes care of activating 
the default behaviour, instantiating the test configuration, as well as starting the actual test behaviour.

    Test Description Implementation TD_7_1_3_1
      uses configuration defaultTC {
        
      SS.g sends pdcch (c_rnti=ue) to UE.g;
      SS.g sends mac_pdu to UE.g;
      UE.g sends harq_ack to SS.g with {
        test objectives : TP1 ;
      };
    
      set verdict to PASS ;
      SS.g sends pdcch (c_rnti=unknown) to UE.g;
      SS.g sends mac_pdu to UE.g;
    
      alternatively {
        UE.g sends harq_ack to SS.g ;
          set verdict to FAIL ;
      } or {
          gate SS.g is quiet for five ;
        set verdict to PASS ;
      } with {
            test objectives : TP2 ;
      }
    }

Figure 6.6.4-1: Test behaviour example in TDL

    altstep to_handle_deviations_from_TDL_description_AS () {
      [] any port.receive {
        setverdict(fail);
        mtc.stop;
      }
      //if nothing happens, a timer is started  
      //before every receive instruction 
      //and the timer is here
      //or we can leave the timeout for 
      //the execute instruction called with the optional 
      //timer parameter - but in this case 
      //the final verdict will be 'error'
    }
    
    altstep quiescence_handler_AS (timer quiescence) { 
      //for all quiescence that is not connected to a gate
      [] any port.receive{ 
         setverdict(fail);
         mtc.stop;
      }
      [] quiescence.timeout {  
         setverdict(pass);
      }
    }
Figure 6.6.4-2: Required altstep definitions in TTCN-3

    function behaviourOfTESTER_SS() runs on defaultCT {
      timer quiescence;
      activate(to_handle_deviations_from_TDL_description_AS());
     
      g_to_map.send(modifies pdcch := {c_rnti := ue}) 
      g_to_map.send(mac_pdu); 
      g_to_map.receive(harq_ack);
      setverdict(pass);
      /*Test Objective Statisfied:  TP2 */                      
      
      g_to_map.send(modifies pdcch := {c_rnti := unknown}); 
      g_to_map.send(mac_pdu);
    
      quiescence.start(five);
      alt{
        [] g_to_map.receive(harq_ack){
           setverdict(fail);
        }
        [] quiescence_handler_AS(quiescence);
        /*Test Objective Statisfied:  TP2 */                      
      }             
    }
    
Figure 6.6.4-3: Behaviour mapping for Figure 6.6.4-1 in TTCN-3

    testcase TD_7_1_3_1() runs on MTC_CT 
      system defaultCT
    {
      activate(to_handle_deviations_from_TDL_description_AS());
      defaultTC();
      TESTER_SS.start(behaviourOfTESTER_SS());   
      all component.done;
    }

Figure 6.6.4-4: Test case integrating all steps for mapping Figure 6.6.4-1 to TTCN-3




Martti Käärik's avatar
Martti Käärik committed