![]() |
![]() |
![]() |
![]() |
![]() |
Creating a Simple Test Case
It is now time to create the first test case. The one you will develop is the test case intended to test the successful connection establishment of the protocol.
How to create constraints and test cases with TTCN Link differs between Windows and UNIX. On UNIX, it is possible to create constraints directly from the Send dialog. In Windows, you have to create the constraints first, before they will be visible in the Link dialog.
What You Will Learn
- To synchronize a test case (UNIX only)
- To create constraints
- To add send statements
- To add receive statements
Creating a Test Case and Constraints (in Windows)
Before you start creating the test case, you have to create a constraint for the ASP ICONreq:
- Copy the table ICONreq from ASN.1 ASP Type Definitions.
- Paste the table in the constraints part, below ASN.1 ASP Constraint Declarations.
- Open this table and change the name to, for example, ICONreq_1.
- Analyze the table.
- Close the table.
Creating a Test Case and Adding Statements
You are now going to create a test case and add send and receive statements by using the Link dialog. When you use the Link dialog, the test case is synchronized with the SDL specification and you cannot edit the behavior lines directly in the table.
- Create a new test case, for example called test_case_1.
- Open the test case in the Table Editor.
- Select Link from the SDT Link menu.
ISAP1 ! ICONreq ICONreq_1 MSAP2 ? MDATind MDATind500
- A corresponding constraint will also be created.
- If needed, just move the Link dialog to see the test case. Do not close the dialog.
- The table MDATind500 (that was just created) is made visible in the Browser.
Creating Another Constraint
Before you can complete the connection establishment, by adding send and receive statements for the MDATreq ASP, you have to create a new constraint:
- In the Browser, create a copy of the constraint that was just created, MDATind500.
- Open the copy of MDATind500 and make the following changes:
- Analyze the table.
- Close the table.
Adding Statements to Complete the Connection
Creating a Test Case and Constraints (on UNIX)
- Create a new test case, for example called test_case_1.
- Open the test case in the Table Editor.
- Select Resynchronize from the SDT Link menu.
- The test case will now be synchronized with the SDL specification. This means that the behaviour lines will be modified from the SDT Link menu. However, if you edit a field in the test case manually - except for comment fields - the editor will not be synchronized anymore.
- What happens behind the scene is that the state space generator is started and an initial part of the state space is explored. However, you do not have to think of that now.
Adding Statements
The first thing you will add, is a send statement for the ICONreq service primitive:
- Select ISAP1 in the PCOs list.
- Select ICONreq in the Types list.
- Click the New button to create a constraint for this ASP.
- Change the name of the constraint to, for example, ICONReq_1.
- Analyze the table.
- Close the table.
- Click the Refresh button in the Send dialog to make the new constraint, ICONReq_1, visible in the Constraints list.
- Click OK.
ISAP1 ! ICONreq ICONreq_1 MSAP2 ? MDATind MDATind500
- The corresponding constraint is created and analyzed.
Adding Statements to Complete the Connection
To complete the connection establishment, you should now add send and receive statements for the MDATreq ASP:
- Select row 2 in the Behaviour Description column - the field containing MSAP2 ? MDATind.
- Select Send from the SDT Link menu.
- Select MDATind500 in the Constraints list.
- Click Copy.
- Change the name to MDATreq_1.
- Change the ASP type to MDATreq.
- Change the "id" part of the parameter to CC instead of CR, which means that the constraint value should be:
{ MSDUType1 {id CC,num zero,data 0}}- Analyze the table and then close it to get back to the Send dialog.
- Click Refresh in the Send dialog.
- Select the new constraint, MDATreq_1.
- Select the PCO MSAP2.
- Click the OK button.
- Select Receive from the SDT Link menu once more to complete the connection establishment test case.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |