![]() |
![]() |
![]() |
![]() |
![]() |
Exercise 2: Advanced Concepts
What You Will Learn
- To create a structured MSC test case
- To define a simple Autolink configuration
- To generate a structured TTCN test case by a direct translation
- To merge new test cases with an existing test suite
Preparations
If you have closed the SDL Suite or the Explorer UI temporarily, perform the following steps:
If you have not quit the inres explorer, bring the application to its initial state now:
Creating a Structured MSC Test Case
For a better understanding, a test case can be structured into different test steps. Typically, a test case consists of three parts:
- The preamble comprises a sequence of test events that drives the system from the stable start state to the initial state from which the test body starts.
- The test body comprises a sequence of test events that achieve the test purpose.
- The postamble comprises a sequence of test events that drives the system from the state reached by the test body to a stable end state.
In this section, you will create a test case with a preamble, a test body and a postamble. This test case will be identical to the one developed in Exercise 1: Basic Concepts except for its structural information.
Creating the Preamble
You can define structured MSC test cases in a similar way as you did in Exercise 1: Basic Concepts.
- Click the Navigator button in the EXPLORE module to start the Navigator.
- Navigate through the system by double-clicking in turn on the following nodes:
- Select MSC: Save Test Step in the Autolink1 menu to save the current path as an MSC test step.
- Type Preamble in the Test step name field.
- Click the OK button.
The preamble which you have just created is shown in Figure 73.
Creating the Test Body
You should also create the body of the MSC test case:
- Type define-root current in the input line to set the current root.
- Double-click the following transitions in the Navigator window:
- Select MSC: Save Test Case in the Autolink1 menu to save the path as an MSC test case.
- Type Example2 in the Test case name field.
- Click the OK button.
Now you have defined the body of the test case. See Figure 72.
Creating the Postamble
Finally, you create the postamble of the MSC.
- Again, type define-root current in the input line to set the root.
- Navigate through the system by double-clicking in turn on the following nodes:
- Select MSC: Save Test Step in the Autolink1 menu.
- Type Postamble in the Test step name field.
- Click the OK button.
You have now created the postamble of the test case, see Figure 73.
Inserting MSC References
Before you can use MSC Example2 to generate a TTCN test case, you have to insert two global MSC references for the preamble and the postamble. To do this:
- Select Toggle MSC Trace in the Commands menu.
- Open MSC Example2.mpr stored in directory TC.
- Make the MSC look like Figure 74, that is:
In the previous steps, you have changed the root of the behavior tree to the beginning of the postamble. Even though it is not necessary for a direct translation, you should better reset it before continuing.
You can list all MSC test cases and test steps currently stored on disk:
It is also possible to remove test cases and test steps from disk. Since you do not need the temporary MSC Example2.mpr any more, you can delete it:
- Select MSC: Clear Test Case in the Autolink1 menu.
- Select Example2.mpr.
- Click the OK button.
- Choose Yes.
- Click the OK button.
Defining an Autolink Configuration
Autolink allows to define a configuration which guides the naming and parameterization of constraints, the introduction of test suite parameters and constants and the grouping of test cases and test steps into a hierarchy of test groups. An Autolink configuration consists of a set of rules which have to be written by the user.
In this tutorial you will not learn how to write configuration rules. Instead you will use a pre-defined configuration that covers some aspects of an Autolink configuration. For a detailed descriptions of configuration rules and corresponding examples see Translation Rules and Test Suite Structure Rules.
In a first step you have to create a new command file which contains the Autolink configuration:
- Open a text editor.
- Type in the following text:
# -------------------------------# Autolink configuration file# for the inres protocol# -------------------------------Define-Autolink-ConfigurationTRANSLATE "ICONreq"CONSTRAINT NAME "Connection_Request"ENDTRANSLATE "ICONconf"CONSTRAINT NAME "Connection_Confirmation"ENDTRANSLATE "IDATreq"CONSTRAINT NAME "Data_Request"PARS $1="Data"TESTSUITE PARS $1="DataValue"ENDTRANSLATE "IDISreq"CONSTRAINT NAME "Disconnection_Request"ENDTRANSLATE "IDISind"CONSTRAINT NAME "Disconnection_Indication"ENDTRANSLATE "MDATind" | "MDATreq"IF $1 == "{ id CC, *, * }" THENCONSTRAINT NAME "Medium_Connection_Confirmation"ENDIF $1 == "{ id AK, *, * }" THENCONSTRAINT NAME "Medium_Acknowledge"ENDCONSTRAINT NAME "c_" + $0ENDEnd- Save the file in your current working directory.
Next, you have to load this configuration into the Explorer:
- Select Configuration: Load in the Autolink2 menu.
- Select config.com in the Files section.
- Click the OK button.
If an error message is displayed, you have probably made a spelling mistake in the command file. In this case, correct your file and try to reload the configuration.
Translating the MSC into TTCN
In Generating the Test Case, you have learned how to generate an internal test case representation based on an MSC. For that purpose, a state space exploration has been started.
However, in some cases it is not possible to simulate an MSC, e.g. if the internal processes of the SDL system are not fully specified. In these cases, you have to translate an MSC test case directly into an internal test case representation (without performing a state space exploration).
Even though it should be possible to simulate the MSC Example2.msc, you will apply a direct translation in this exercise:
- Select Test Case: Translate in the Autolink1 menu.
- Select Example2.msc.
- Click the OK button.
- Autolink analyses the preamble, the test body and the postamble and generates a complete, structured test case. The following output should appear in the text area:
Current state is reset to root.MSC 'Example2' loaded.Constraints are checked for naming conflicts...Constraint 'c_MDATind' is renamed to 'c_MDATind_001'.Constraint 'c_MDATind' is renamed to 'c_MDATind_002'.Constraint 'c_MDATind' is renamed to 'c_MDATind_003'.Constraints with identical signal definitions are merged automatically...... done.Take a look at the internal test case representation to see the difference with respect to test case Example1:
- Select Test Case: Print in the Autolink1 menu.
- Choose Example2.
- Click the OK button.
- The output is:
Example20 IN Preamble1 ISAP1 ! ICONreq - Connection_Request2 MSAP2 ? MDATind - c_MDATind_0033 MSAP2 ! MDATreq -Medium_Connection_Confirmation4 ISAP1 ? ICONconf -Connection_Confirmation5 OUT Preamble6 ISAP1 ! IDATreq - Data_Request(DataValue)7 (P) MSAP2 ? MDATind - c_MDATind_0028 MSAP2 ! MDATreq - Medium_Acknowledge9 IN Postamble10 ISAP1 ! IDISreq -Disconnection_Request11 ISAP1 ? IDISind -Disconnection_Indication12 P MSAP2 ? MDATind - c_MDATind_00113 OUT Postamble11 MSAP2 ? MDATind - c_MDATind_00112 P ISAP1 ? IDISind -Disconnection_Indication13 OUT Postamble- Select Constraint: List in the Autolink2 menu.
- The following output will appear in the text area:
Connection_Confirmation :ICONconf { }Connection_Request :ICONreq { }Data_Request(Data) :IDATreq { iSDUType1 Data }Disconnection_Indication :IDISind { }Disconnection_Request :IDISreq { }Medium_Acknowledge :MDATreq { mSDUType1 { id AK, num one, data 55 } }Medium_Connection_Confirmation :MDATreq { mSDUType1 { id CC, num zero, data 55 } }c_MDATind_001 :MDATind { mSDUType1 { id DR, num one, data 55 } }c_MDATind_002 :MDATind { mSDUType1 { id DT, num one, data 55 } }c_MDATind_003 :MDATind { mSDUType1 { id CR, num zero, data 0 } }Saving the TTCN Test Suite
When a TTCN test suite is created, test steps can be stored in different formats. By default, test steps are put into the test step library. However, you might want to save them locally, i.e. attached to their test cases:
Now, you are ready to save the test suite:
- Select Test Suite: Save in the Autolink1 menu.
- Type inres2_local in the Test suite name field.
- Click the OK button.
- Type inres2_local.mp in the File field.
- Click the OK button.
You may want to save the test suite in different formats. To do this:
- Select Autolink: Test Steps Format in the Options2 menu.
- Select Global or Inline.
- Click the OK button.
- Save the test suite as above. You can save the current test suite as often as you like.
Merging With the Old Test Suite
It is possible to merge the new TTCN test case (with its constraints) with an existing test suite.
- Make sure that the inres test suite you created in the first part of this tutorial is opened in the TTCN Suite. This test suite contains test case Example1.
- On UNIX, select Autolink Merge from the SDT Link menu in the Browser.
- In the dialog that is opened, select inres2_local.mp.
- Click Merge (UNIX) or OK (Windows).
There are more possibilities to merge test cases: Autolink also provides commands to combine separately generated test cases within the Explorer. For a detailed description see Computing Test Cases.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |