Skip to content

Scenario Parameters

itaiag edited this page Aug 9, 2016 · 1 revision

Scenario Parameters

Global Replace

In order to change the value of a parameter in several tests that belong to the same scenario, select the parent scenario of the tests, in the parameters area, the parameters appear for all the tests under the scenario.

Set the value of the parameter that requires changing, and press on the "Apply for Scenario" button.

The snapshot shows the tests parameters area when a scenario is selected. Note that the "Apply for Scenario" becomes enabled only when value of one or more parameters is changes.

There is a possibility that the operation will affect several tests, because of this a dialog opens and asks for user approval for the operation in order to commence.

Scenario Parameters

The user of the JRunner can define scenario parameters similar to test parameters definitions. This feature provides JRunner users with the ability to build reusable scenarios, and equip the JRunner with advanced features a tool for high end users that are not programmers.

Using Scenario Parameters

The following example demonstrates a scenario that validates the device version. The name of the scenario is "validateVersion". The scenario exposes two parameters:

  1. machineIP – IP address of the machine which version should be validated.
  2. fileToCheck – The file on the remote machine which holds machine version.

The "validateVersion" scenario comprises of two tests, when the user selects the scenario and goes to the "Test Info" tab of the scenario there is a new tab, the "Scenario Parameters" this tab shows the parameters that the scenario exposes.

1.Create another scenario – "validateSetup" that uses the "validateVersion" scenario in order to validate the version of two machines in the SUT.

The displayed scenario uses the "validateVersion" scenario. By selecting the "Test Info" tab of an instance of the "validateVersion" scenario, the user can see scenario parameters and set their values.

  1. In the example, set the "machineIP" of one instance to 10.0.0.1 and the second "machineIP" instance to 10.0.0.2.

  2. After setting the scenario parameter value apply the operation by pressing on the "Apply for Scenario" button.

Note: The user of the "validateVersion" scenario does not have to understand the tests in the scenario nor the parameters that the tests extract, all that must be understood is the parameters of the scenario.

Defining Scenario Parameters

Once the scenario parameters have been set they must be defined by performing the following steps:

  1. Select a scenario that requires a parameter definition.
  2. Assume that the name of the parameter being added is the "machineIP".
  3. Now select the test in order to apply the scenario parameter on it, and add the scenario parameter in the test parameter value in the format ${scenario:ParamName}.

  1. Zoom in.

  1. Incorporating the scenario parameters in the scenario also defines the parameter.

Scenarios Parameters with Nested Scenarios

The behavioral characteristics of nesting several scenarios are as follows:

  1. Take the "validateSetup" scenario and add it to a scenario called "setupMaster"

  1. When selecting one of the instances of the "validateVersion" scenario the user can see that the values that were given to the parameters in the "validateSetup" scenarios are kept.

3.Zoom in:

  1. The user can alter these values, by selecting the "validateSetup" as the root scenario; the original values of the parameters will not be changed.

Master Scenario

When nesting a sub scenario into a master scenario, the framework takes the default values of the scenario parameters from the higher level scenario under it, in which the user gave the parameter a value.

Default Parameter Values

In order to give a parameter a default value, select the scenario in which the parameter is defined, in our example, "validateVersion", now select the scenario "Parameters" tab and provide the parameter a default value.

Now, select one of the parent scenarios, for example, "setupMaster" right click on the scenario and select "restore defaults" menu item. If the user selects one of the instances of the "validateVersion" scenarios the values of the parameters are resorted to their default values.

Global Replace

A checkbox has been added to the parameters panel called "Show Reference Recursively". If it is not checked, only root tests scenario parameters will be shown. When checked, all Recursive sub tests parameters will be displayed. When working with recursive checked, and applying a change to Scenario Parameters, all sub scenarios will be changed. This does not apply to regular parameters.

Clone this wiki locally