Creating Response Templates
Command steps, such as the Execute command, can have one or more associated response templates that are used to parse and evaluate the step's output.
Response Templates, defined on a device's expected response following configuration commands, specify well-known tokens/regions (named `targets' when creating the template) in the command's output. Based on these specifications, the command's output is parsed and the parameters corresponding to these areas are retrieved into script variables, such as, for example, for evaluating if a command executed successfully or not.
More than one response template can be associated with a command step, in which case target values from all associated Response Templates are available by referencing the composite step return variable.
Assuming, for example, that a step has two associated templates, say RT01 and RT02 , which expose the Target_1 and Target_2 targets respectively, then both Target_1 and Target_2 are retrieved at step execution time. Assuming also that var1 is the assigned step return variable, you will be able to reference both targets using the var1.Target_1 and var1.Target_2 expressions respectively.Once a Response Templates was created, it can be saved for later use and is stored as a resource in the Reusable Resources database.
Since Response Templates can be saved into the application's resource database, associating a response template with a step is done either by assigning an existing Response Template or by creating a new one using the Response Template editor, as described in this section.
To create a Response Template in TestComposer:
While in the Edit mode, select the command step for which a Response Template needs to be defined.For steps that were created using the GUI scripting support, since the command output is non-existent at step creation time, you have to play the step first by clicking the
button.
For steps that were added using the Capture functionality, the command output was already captured when adding the step.
Select the Command Response pane which displays the command output. Click the Editbutton to access the Response Template Editor on the command output.
Define the Response Template as described in The Response Template Editor, About Regions, Targets, and Markers, Free-Form Response Templates, and Table-Form Response Templates.
For Response Templates that have been saved as resources, you can perform an additional operation that associates a command with the template, as described in Defining a Response Template - Command Association.
See Also
What Is an IxLoad TestComposer Resource?
Creating CSV Template Resources
Related Subtopics
About Regions, Targets, and Markers