question

AmeyaB avatar image
AmeyaB asked

HOW TO: Start an iTest session interactively when the session profile uses parameters

The Spirent Best Practices recommend that you use Reference Session Profiles to store common properties associated with devices. They also recommend the use of parameters rather than hard-coded values. These parameter values are resolved within an “execution context”, which is created only when you execute a test case.

What if you want to start an interactive session directly from the Reference Session Profile that uses parameters? If you try to do this, iTest throws up the following error:

Error: Unable to substitute "[param host]" : Parameter 'host' does not exist

This is because iTest is unable to resolve the parameter value because there is no execution context as we are not executing a test case.

To get around this issue, add a default value to the param syntax:

[param param_name default_value] e.g. [param host 10.34.54.76]

This tells iTest to use the default value of "10.34.54.76" whenever it is unable to resolve the parameter. So when you start the session interactively, iTest will use "10.34.54.76" as the value, and when you run the test case, it will use whatever is the resolved value of the “host” parameter.

Default values are also available on commands other than param. To determine whether a command can only be resolved with an execution context (i.e. only when you run a test case), type the “[“ character into the value of the field in the session profile — iTest displays the list of commands and their syntax. Any command that uses an optional ?default? argument requires an execution context.

iTestsession profileparametersdefault valuesbest practices
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.