How do I generate unique values in Messages or Browser Actions?

Document created by DPM Admin Employee on Jul 21, 2017Last modified by Dave Murphy on Sep 25, 2017
Version 6Show Document
  • View in full screen mode

General methodologies

You can generate unique values in Messages or Browser Actions each time they are played in several ways:

  1. Substitute a Global Property of type "counter" into the Message or Browser Action.
  2. Manually enter "in situ substitution expressions" (ISSE).
  3. Use Scripts to modify Messages or Browser Actions.

Refer to the separate question "How do I dynamically or programmatically substitute a value into a Message or Browser Action before ..." for general instructions on how to insert a value into a Message or Browser Action. In this question, we will discuss how to generate a unique value to be inserted.

 

Method 1 - Substitute a Global Property of type "counter" into the Message or Browser Action

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.

If you wish to have a count that is 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.

By substituting the value of a Global Property of type "counter" into your Message or Browser Action, you can cause a unique number to be inserted each time it plays.

Refer to the separate question "How do I dynamically or programmatically substitute a value into a Message or Browser Action before ..." for general instructions on how to insert a Global Property into a Message or Browser Action.

Refer to the separate question "How do I save a value so that it can be used from one play of a Test Composition to the next?" for instructions on how to define Global Properties.

If you need to insert a more complex value, such as one or more numbers concatenated with text, refer to Methods 2 and 3, which follow.

 

Method 2 - Manually enter "in situ substitution expressions" (ISSE)

Any place where a value is manually entered for a portion of a Message or Browser Action, the text can contain one more embedded ISSE (in situ substitution expression) specifications.  Any such specifications will be evaluated and replaced with the resulting value. An ISSE can reference properties, contain a simple expression, or full Scripting.

See the prior section regarding Global Properties of type counter. An ISSE can reference Global Properties and contain Script code.  Using an ISSE you can construct unique values that are concatenations of one or more incrementing counters, text strings, and values from Script expressions (including the current date or time).

Refer to the separate question "How do I dynamically or programmatically substitute a value into a Message or Browser Action before ..." for general instructions on how to insert an ISSE into a Message or Browser Action.

 

Method 3 - Use Scripts to modify Messages or Browser Actions

Any Script can traverse the object hierarchy of the Test Composition, find Messages and Browser Actions, and change portions of their message or request. This method allows the highest degree of customization, since you can add complex custom logic to the Script to insert computed values into the Message or Browser Action.

Refer to the separate question "How do I dynamically or programmatically substitute a value into a Message or Browser Action before ..." for general instructions on how to write a Script that inserts values into a Message or Browser Action.

 

Attachments

    Outcomes