Newer
Older
This software is subject to copyrights owned by ETSI. Non-exclusive permission
is hereby granted, free of charge, to copy, reproduce and amend this file
under the following conditions: It is provided "as is", without warranty of any
kind, expressed or implied.
ETSI shall never be liable for any claim, damages, or other liability arising
from its use or inability of use.This permission does not apply to any documentation
associated with this file for which ETSI keeps all rights reserved. The present
copyright notice shall be included in all copies of whole or part of this
file and shall not imply any sub-license right.
*/
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
//A manually constructed example illustrating the data mapping concepts
Package DataExample {
//User-defined verdicts
//Alternatively the predefined verdicts may be used as well
Type Verdict ;
Verdict PASS ;
Verdict FAIL ;
//Test objectives
Test Objective CHECK_SESSION_ID_IS_MAINTAINED {
//Only a description
description : "Check whether the session id is maintained
after the first response." ;
}
//Data definitions
Type SESSION_ID;
SESSION_ID SESSION_ID_1 ;
SESSION_ID SESSION_ID_2 ;
Type MSG (optional session of type SESSION_ID);
MSG REQUEST_SESSION_ID(session = omit);
MSG RESPONSE(session = ?);
MSG MESSAGE(session = ?);
//Data mappings
//Load resource.ttcn3
Use "resource.ttcn3" as TTCN_MAPPING ;
//Map types and instances to TTCN-3 records and templates, respectively
//(located in the used TTCN-3 file)
Map MSG to "record_message" in TTCN_MAPPING as MSG_mapping with {
session mapped to "session_id";
};
Map REQUEST_SESSION_ID to "template_message_request" in TTCN_MAPPING as REQUEST_mapping ;
Map RESPONSE to "template_response" in TTCN_MAPPING as RESPONSE_mapping ;
Map MESSAGE to "template_message" in TTCN_MAPPING as MESSAGE_mapping ;
//Use a runtime URI for dynamic data available at runtime, such as
//session IDs
Use "runtime://sessions/" as RUNTIME_MAPPING ;
//Map session ID data instances to locations within the runtime URI
Map SESSION_ID_1 to "id_1" in RUNTIME_MAPPING as SESSION_ID_1_mapping ;
Map SESSION_ID_2 to "id_2" in RUNTIME_MAPPING as SESSION_ID_2_mapping ;
//Gate type definitions
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
//Component type definitions
Component Type defaultCT having {
gate g of type defaultGT ;
}
//Test configuration definition
Test Configuration defaultTC {
create SUT UE of type defaultCT;
create Tester SS of type defaultCT;
connect SS.g to UE.g ;
}
//Test description definition
Test Description exampleTD uses configuration defaultTC {
//Tester requests a session id
SS.g sends REQUEST_SESSION_ID to UE.g ;
//SUT responds with a session id that is assigned to the URI
//provided by the execution environment
UE.g sends RESPONSE (session=SESSION_ID_1) to SS.g ;
//Tester sends a message with the session id
//from the runtime URI
SS.g sends MESSAGE (session=SESSION_ID_1) to UE.g ;
alternatively {
//SUT responds with the same session id
UE.g sends RESPONSE (session=SESSION_ID_1) to SS.g ;
set verdict to PASS;
} or {
//SUT responds with a new session id
UE.g sends RESPONSE (session=SESSION_ID_2) to SS.g ;
set verdict to FAIL;
} with {
test objectives : CHECK_SESSION_ID_IS_MAINTAINED ;
}
}
//Alternative approach with variables
//Component type definitions
Component Type defaultCTwithVariable having {
variable v of type MSG;
gate g of type defaultGT ;
}
//Test configuration definition
Test Configuration defaultTCwithVariables {
create SUT UE of type defaultCT;
create Tester SS of type defaultCTwithVariable;
connect SS.g to UE.g ;
}
Test Description exampleTD uses configuration defaultTCwithVariables {
//Tester requests a session id
SS.g sends REQUEST_SESSION_ID to UE.g ;
//SUT responds with a response message containing a session ID
//The response could contain any of the known session IDs
//The received response is stored in the variable v of the SS
UE.g sends RESPONSE to SS.g where it is assigned to v;
//Tester sends a message with the session ID
//from the response stored in the variable v of the SS
SS.g sends MESSAGE(session=SS->v.session) to UE.g ;
alternatively {
//SUT responds with the same session ID that is stored in
//the variable v of the SS from the previous response
UE.g sends RESPONSE(session=SS->v.session) to SS.g ;
set verdict to PASS;
} or {
//SUT responds with a any session ID, including the one from the
//previous response stored in v. The ordering of evaluation will
//always select the first alternative in that case. Alternatively
//a function can be defined and called that checks explicitly that
//a the specific session ID from the previous response stored in v
//is not received e.g.
// UE.g sends RESPONSE(session=not(SS->v.session)) to SS.g;
UE.g sends RESPONSE to SS.g ;
set verdict to FAIL;
} with {
test objectives : CHECK_SESSION_ID_IS_MAINTAINED ;
}
}
}