//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 Gate Type defaultGT accepts MSG , SESSION_ID; //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 ; } } }