Printer FriendlyEmail Article Link

iTest: Field Replacements and Variable Substitution in iTest

Environment/Versions
  • Spirent iTest v4.4
Answer

Field replacements:

  • Field replacements is a property in iTest which can be used to substitute the parameters with any value.

Substituting values into properties and commands:

  • Just before executing a step, Spirent iTest evaluates field replacement text and replaces the text with the values of a variable or a parameter or a value returned in a response.
  • This process, often called runtime substitution, is available in commands, property settings, or messages — most text fields.

Example: Using an Spirent iTest interpreter ‘param’ command in a field replacement .

  •     The text strings [param a]:

         The [param a] syntax means “Before running this step, replace all of the text in this field wth the value of the parameter a”.
     
  • The test case has the following parameter settings:

         a = show ip route
     
  • At runtime, step preprocessing replaces the fields. As a result, Spirent iTest issues the following command:
        show ip route.

How field replacements operate:

  • At runtime, before the property or step is interpreted, Spirent iTest substitutes the returned value in place of the field replacement text.
  • In the example, the param command returned the value of the predefined parameter “a”, so that is the value that replaces the [param a] text in the show interfaces command.
  • If the operation inside the [ ] braces results in an error, then Spirent iTest will generate an execution issue and display a message in the Execution view, the Step Issues view, and in the test report.
  • The text of the field replacement is not substituted for execution. So, to make sure that the field substitution should work. We need to make sure that the little F and the checkbox marked in red (in the screenshot above) are enabled.

Guidelines for using field replacements:
 

  • If the first separator [ is present, but the second separator ] is not, then Spirent iTest generates an error.
  • To include the character [ as text within a command (that is, not as the initial characters of a field replacement), type \[
  • Whenever a single one of the characters \ or [ appears in text, it results in an error and an Execution Message is displayed in the Execution view and in the test report.
  • Field replacements can appear anywhere in the text.
  • Field replacements support nesting. The innermost replacement is processed first, followed in succession by each more outward replacement. Use the syntax shown here:

     [command_2 [command_1:value_1] argument_2]

     For example:[param [param portIndex] State]

Product : Velocity Portfolio,Velocity iTest