How do I generate unique values in Messages or Browser Actions?
You can generate unique values in Messages or Browser Actions each time they are played in several ways:
|Method 1 - Substitute a Global Property of type "counter" into the Message or
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:
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.
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).
|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.