How do I pass a value from one Test Composition to another?

Document created by DPM Admin Employee on Jul 21, 2017Last modified by DPM Admin Employee on Jul 21, 2017
Version 2Show Document
  • View in full screen mode

Permanent values can be saved in Global Properties, which reside in Global Property Lists. The values in Global Properties are saved to the Repository, and thus persist after a Test Composition completes.

 

Step 1: Create Global Properties

Select the Central list > Global Property Lists.

Create a new list by clicking on the "new" icon in the toolbar, or use an existing list by double-clicking on it, will display the Global Properties dialog. The "default" list has the name "Default". (The default list is used when the list name is omitted in locations where a list name is needed.)

Add Global Properties to the list, one Global Property for each value you wish to save.

If you wish to save a count that gets incremented automatically each time it is used, define a Global Property of type "Counter". There are also the following special types of counters:

  • Message level counter
  • Browser Action level counter
  • Test Clip level counter
  • Track level counter
  • Band level counter
  • Test Composition level counter

The special types of counters only increment the first time they are used within items of a particular type. For example, a "Message level counter" is incremented only the first time it is used in each individual Message.

If the value you wish to save is not a counter, then define the Global Property to be of type "Text".

This dialog also allows you to view and change the current values of the Global Properties.

Next, you may need to do any or all of steps 2 through 5, depending upon how you wish to set and access the Global Properties you have defined.

Step 2 (optional): Set the Global Properties from a Script.

Insert a Script into the appropriate place in a Test Clip in your Test Composition, at the point at which you wish to set the value of Global Properties.

To set the value of a Global Property from the Script, use the $globalprop built-in variable, which contains the "GlobalProperties" object:

$globalprop.set("name of list", "name of property", newValue);

or

$globalprop.setUsingPath("name of list/name of property", newValue);

where "newValue" is a variable containing the value that your Script computed is to be set into the Global Property.

 

Step 3 (optional): Set the Global Properties directly from a Message response.

As with Custom Properties and System Properties, Global Properties can be set directly from a portion of the response to a Message.

 

Edit the Message whose response contains the value that is to be saved, and find the desired portion of the response in the "Output" section.

Click the "Property Chooser" icon to the right of the response field to bring up the "Property Chooser" dialog.

Find the Global Property in the list, and check the box next to. Click OK.

Now, whenever a response is received to that message, the value will be extracted from the Message and placed into the Global Property.

Step 4 (optional): Use the current value of the Global Properties from a Script

Insert a Script into the appropriate place in a Test Clip in your Test Composition, at the point at which you wish to use the values of Global Properties.

To retrieve the value of a Global Property from a Script, use the $globalprop built-in variable, which contains the "GlobalProperties" object:

var currentValue = $globalprop.value("name of list', "name of property");

or

var currentValue = $globalprop.setUsingPath("name of list/name of property");

The above statements will place the current value of the specified Global Property into the variable "currentValue" for your Script to then make use of.

 

Step 5 (optional): Use Global Property values directly in a Message

As with Custom Properties and System Properties, Global Properties can be substituted directly into a portion of a Message before it is sent.

 

Edit the Message into which the Global Property value is to be inserted, and find the desired portion of the Message into which the value is to be inserted, in the "Inputs" section.

Click the "Property Chooser" icon to the right of the input field to bring up the "Property Chooser" dialog.

Find the Global Property in the list, and check the box next to. Click OK.

Now, before the Message is sent, the current value of the Global Property will be inserted.

Alternatively, you may type an "ISSE" (in situ substitution expression) as part of the value to be inserted, if you wish to mix the value within text, as in the following example:

ABC{%% global-custom-prop: List A/Property 1 %%}XYZ

The above example inserts the value of the Global Property named "Property 1" in the Global Property List "List A" inbetween the characters "ABC" and "XYZ" in this portion of the Message.

Attachments

    Outcomes