![]() |
![]() |
![]() |
![]() |
![]() |
Constants and Variables
TTCN supports both constants and variables. There are two types of constants:
- Test Suite Constant Declarations
- Test Suite Parameter Declarations
- Test Suite Variable Declarations
- Test Case Variable Declarations
Test Suite Constants and Test Suite Parameters
Test suite constants are declared globally and may be used anywhere in the test suite, including the constraints part. The value of the constant is specified at its point of declaration and may not be changed.
Case study 17: Declaration of test suite constants.
Test Suite Parameters
Test suite parameters are also constants, but their actual values are not known to the abstract test suite specifier. These values will depend on which IUT is being tested, and possibly on the test system itself. In this sense the values of test suite parameters will be different from IUT to IUT, but during the testing of any given IUT they will remain constant.
Case study 18: Declaration of test suite parameters.
The test suite parameter values are derived from the Protocol Implementation Conformance Statement (PICS) and the Protocol Implementation eXtra Information for Testing (PIXIT). These documents are like checklists that are filled-in according to the characteristics of the IUT.
Prior to executing the tests the PICS and PIXIT are used to bind values to the test suite parameters. This process is called test suite parameterization.
Test Suite and Test Case Variables
Both test suite variables and test case variables are declared globally i.e. they may be used by test cases, test steps and defaults throughout the test suite. A default value may be specified for each variable, if wished. If no default value is specified, then the variable is said to be unbound.
Variables should be bound before use, unless they appear on the l.h.s. of an assignment.
Case study 19: Declaration of test case variables.
Resetting Default Values
The difference between the two kinds of variable is when they are reset to their default values (if no default value is specified for a variable, then resetting means that the variable becomes unbound):
- test suite variable are reset at the end of execution of the test suite, which means that information may be retained between test case execution;
- Test case variables are reset at the end of execution of each test case, i.e. test case variables begin each test case bound to their default values.
Variables in Concurrent TTCN
When more than one test component exists, as does with concurrent TTCN, then each test component is supplied with its own copy of each test case variable.
- In the case study we declare the test case variable count. This variable is available to both the lower tester and the upper tester as a separate copy of count to each, i.e. if the lower tester changes the value of count it only changes its copy of count, and not the upper tester's copy.
Test suite variables behave the same way in concurrent TTCN as they do in the non-concurrent version.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |