IBM
Contents Index Previous Next



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

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:

  1. Copy the table ICONreq from ASN.1 ASP Type Definitions.
  2. Paste the table in the constraints part, below ASN.1 ASP Constraint Declarations.
  3. Open this table and change the name to, for example, ICONreq_1.
  4. Analyze the table.
  5. 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.

  1. Create a new test case, for example called test_case_1.
  2. Open the test case in the Table Editor.
  3. Select Link from the SDT Link menu.
    The Link dialog is opened. The first thing you will add is a send statement for the ICONreq service primitive.

Figure 68 : The Link dialog

  1. In the dialog, select the following:
    • The PCO ISAP1
    • The type ICONreq
    • The constraint ICONreq_1
      The contents of the Behavior line and Constraint fields will be updated in accordance with your selection.
  2. Click Apply.
    The following behaviour line, a send statement, is added to the test case:

Behaviour Description

Constraints Ref

ISAP1 ! ICONreq

ICONreq_1

  1. Click Generate Receives.
    This will add a second behavior line, a receive statement, to the test case:

Behaviour Description

Constraints Ref

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.
  1. Analyze the test suite by selecting Analyze Suite from the Build menu.

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:

  1. In the Browser, create a copy of the constraint that was just created, MDATind500.
  2. Open the copy of MDATind500 and make the following changes:
    • The name should be MDATreq_1
    • The ASP type should be MDATreq
    • The "id" part of the parameter should be CC instead of CR, which means that the constraint value should be:
      
      
      { mSDUType1 {id CC,
      
        num zero,
      
       data 0}}
      
      
      
  3. Analyze the table.
  4. Close the table.

Adding Statements to Complete the Connection

  1. In the Link dialog, select Clear.
    This will refresh the dialog.
  2. Select the following:
    • The PCO MSAP2
    • The type MDATreq
    • The constraint MDATreq_1
  3. Click Apply.
    This will add a third behaviour line to the test case.
  4. Click Generate Receives.
    The test case should now contain 4 behavior lines.

Figure 69 : The complete test case

  1. Close the Link dialog.

Creating a Test Case and Constraints (on UNIX)

  1. Create a new test case, for example called test_case_1.
  2. Open the test case in the Table Editor.
    As you can see, the Table Editor contains the extra menu SDT Link.
  3. 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:

  1. Select Send in the SDT Link menu. The Send dialog is displayed:

Figure 70 : The Send dialog

  1. Select ISAP1 in the PCOs list.
    The unselected PCO is moved to the lower part of the list.
  2. Select ICONreq in the Types list.
    The unselected types are moved to the lower part of the list.
  3. Click the New button to create a constraint for this ASP.
    A Table Editor, displaying the new constraint is opened.
  4. Change the name of the constraint to, for example, ICONReq_1.
  5. Analyze the table.
  6. Close the table.
  7. Click the Refresh button in the Send dialog to make the new constraint, ICONReq_1, visible in the Constraints list.
    Since this is the only constraint of the selected type, it will automatically be selected.
  8. Click OK.
    The following behaviour line, a send statement, is added to the test case:

Behaviour Description

Constraints Ref

ISAP1 ! ICONreq

ICONreq_1

  1. Select Receive from the SDT Link menu.
    This adds second behavior line, a receive statement, to the test case:

Behaviour Description

Constraints Ref

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:

  1. Select row 2 in the Behaviour Description column - the field containing MSAP2 ? MDATind.
  2. Select Send from the SDT Link menu.
    The Send dialog will once again be opened. Now you will create a new constraint by copying an old constraint and modify it.
  3. Select MDATind500 in the Constraints list.
  4. Click Copy.
    The Table Editor will appear, displaying a copy of the MDATind500 constraint.
  5. Change the name to MDATreq_1.
  6. Change the ASP type to MDATreq.
  7. 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}}
    
  8. Analyze the table and then close it to get back to the Send dialog.
  9. Click Refresh in the Send dialog.
  10. Select the new constraint, MDATreq_1.
  11. Select the PCO MSAP2.
  12. Click the OK button.
    The new send statement is inserted in the test case table.
  13. Select Receive from the SDT Link menu once more to complete the connection establishment test case.

http://www.ibm.com/rational
Contents Index Previous Next