Test Macros

Prev Next

Macros are dynamic system keywords that allow you to include variable information in a test's Test URL, HTTP Header Request, Script, and Post Data fields. The macro is replaced by the system at the time the test is run. Using macros, you can add information that helps identify the test or server on which the test was run so you can correlate data between your application or website and Catchpoint, which can be used for troubleshooting purposes. Catchpoint supports both basic macros and enhanced macros. Basic macros allow you to insert a single piece of data, and enhanced macros provide more options so that you can define the value inserted using a dynamic statement.

*See the attached file for a reference showing what macros are supported per test type.

Test URL, HTTP Header Request and Post Data all reflect information that Catchpoint expects to match with your website when a test is run; therefore, you should be aware that using macros requires setup on your end in order for tests to execute correctly.

For example, if you enter the following value in the Test URL field:
http://www.site.com/?${time}

Catchpoint submits the request as:
http://www.site.com/?20100303203121772

Basic Macros

Catchpoint supports the following basic macros:

Macro Description
${locationid} The identification number for the node used to run the test. If you want to include this macro, contact Catchpoint.
${locationname} The name of the node used to run the test.
${testid} The identification number for the test.
${cityid} The Geo-City ID for the given node.
${cityname} The Geo-City name for the given node
${ispid} The ISP ID for the given node.
${ispname} The ISP name for the given node.
${random} Random number between 100,000,001 and 999,999,999
${random(min, max)} Random number between the number range defined by the min and max values. For example, the macro ${random(5, 50)}would be substituted with a number between 5 and 50.
${randomguid} Random GUID string (36 characters long). For example, 0f8fad5b-d9cb-469f-a165-70867728950e.
${time} The UTC time stamp for the time at the node where the test ran in YYYYMMDDHHMISSMSCformat (17 characters long).
${timeday} The UTC date for the time at the node where the test ran in YYYYMMDD format (8 characters long).
${timeepoch} The epoch time stamp for the time at the node where the test ran. Epoch time stamp is the number of seconds since 01/01/1970 12AM UTC. The format for epoch time stamp is 1234567890.
${timetrim} Same as “time”, however customized format values will be trimmed (i.e., no “zero” padding) in its date-time components.
${continentname} The name of the continent in which the node is located.
${regionname} The name of the region in which the node is located.
${asnname} The Autonomous System Number name (ISP) of the node.
${asnvalue} The Autonomous System Number of the node.
${countryname} Name of the country in which the node is located.
${ipVersion} IP version of the node.
${networkType} Specifies the network type the node belongs to.
${token} Inserts the first token value configured in the Requests section.
${token(token_name)} Inserts the value of the specified token. (Tokens must first be added to the Library and then selected in the Requests section of the Test or its parent container.)
${userName} Inserts the first username value configured in the Requests section.
${userName(user_name)} Inserts the value of the specified username. (Username must first be added to the Library and then selected in the Requests section of the Test or its parent container.)
${password} Inserts the first password value configured in the Requests section.
${password(password)} Inserts the value of the specified password (Passwords must first be added to the Library and then selected in the Requests section of the Test or its parent container.)

Enhanced Macros

Enhanced macros allow you to use a variable statement to define the value you want to insert in the Test URL, Test HTML, HTTP Header Request or Post Data. Catchpoint supports the following enhanced macros:

Random List

The random list macro can be used to define a list of values to be inserted in place of the macro. You can define a list of numbers, strings or a list of key values. When the test is run, Catchpoint will select one of the values from the list and substitute that value in place of the macro. For example, the macro ${randomlist(2, 7, 9, 11)} would be substituted with one of the following numbers: 2, 7, 9 or 11.

The following options are available for random list macros. There is no limit to the number of values you can enter within the parentheses; however, keep in mind that macros contribute to the field lengths both as defined and once the substitution is made.

${randomlist(n, nn, nnn, nnnn, nnn, ..., nnnnn)} A random number chosen from the list defined within the parentheses where n,nnn, nnnn and nnnnn represent the numbers from which the random number will be chosen.
${randomlist(a, bb, cc, bbnn, ..., dddnnn)} A random string chosen from the list defined within the parentheses where a,bb, cc, bbnn and dddnnn represent the set of alphanumeric values from which the macro value will be chosen.
${randomlist(“a,b,c", “n,nn”, ..., “a,z,n,nnn”} A random string chosen from the list defined within the parentheses wherea,b,c; n,nn; and a,z,n,nnn represent the exact string, complete with punctuation, from which the macro value will be chosen. Note that you must use quotation marks (for example, “a,aa”) when a string contains a comma (,).
${randomlist(key1=value1, key2=value2, ..., keyN=valueN)} A random key value pair chosen from the list defined within the parentheses where key1=value1, key2=value2 andkeyN=valueN represent the key and value that will be substituted for the macro when the test is run.

Custom Time Stamp

The custom time stamp macro allows you to insert a time stamp into your test's Test URL, Test HTML, HTTP Header Request or Post Data. This macro allows you to insert a time stamp for the time the test ran, or a random time stamp. Additionally, you can define the format for the time stamp, so that the macro reflects the format of the time stamp issued by the test's server(s) instead of having to modify the test's server to reflect the Catchpoint node's time stamp.

The custom time stamp macro is composed of three parameters. The first defines the format used for the time stamp, and the second and third define the date range from which the random time stamp is generated. You can select either a relative time period, i.e., a time period in relation to the time the test ran, a specific date range, or a combination of the two. For example, the macro ${timeformat(“MM/DD/YYYY HH:MI”, 1.5, 2011)} would insert a random time between 1.5 days after the test ran and Jan 1, 2011 12:00 AM. The custom time stamp macro using the following syntaxes:

Macro Description
${timeformat("format")} Inserts the UTC time stamp for the time at the node where the test ran using the format specified. See Time Format below.
${timeformat("format", -X, X)} Inserts a random time stamp from the date range specified, where -X represents a number of days (up to 2000) before the test ran and X represents a number of days after the test ran.
${timeformat("format", MMDDYYYY, YYYY)} Inserts a random time stamp between the two dates specified, regardless of the time at which the test ran.
${time("format", -X, X)} Inserts a random time stamp from the date range specified, where -X represents a number of days (up to 2000) before the test ran and X represents a number of days after the test ran.

You do not have to enter two date range parameters. If you include only one parameter, Catchpoint will select a random time stamp between the parameter entered and the time the test ran. For example, the macro ${timeformat(“YYYYMMDD”, -5)} would insert a random time the time the rest ran and 5 days previous. You can also use a combination of dynamic and static parameters.

Time Format - Use a combination of the following expressions to create the format for the time stamp:

  • YYYY = 4-digit year
  • MM = 2-digit month
  • DD = 2-digit day
  • HH = 2-digit hour
  • MI = 2-digit minute
  • SS = 2-digit second
  • MSC = 3-digit millisecond

For example, if the time stamp is 04/20/2010 7:25:30.123 PM UTC, the following macros would insert three different formats for the time stamp:

  • ${timeformat("MM/DD/YYYY")} = 04/20/2010
  • ${timeformat("DD-MM-YYYY HH:MI:SS")} = 20-04-2010 07:25:30
  • ${timeformat("YYYYMM")} = 201004

Host Request

Used for request overrides only. Basic usage is as follows:

  • Example (using URL http://www.catchpoint.com:8080/main.aspx?key=value):
    • ${hostrequestauthority} – www.catchpoint.com:8080
  • Example (using URL http://www.catchpoint.com:8080/main.aspx?key=value):
    • ${hostrequestpath} – main.aspx
Macro Description
${hostrequestauthority} Obtains the given request URL’s authority (which is the host or IP plus port number, if the port is non-standard).
${hostrequesthost} Obtains the given request URL’s host.
${hostrequestpath} Obtains the given request URL’s path.
${hostrequestpathandquery} Obtains the given request URL’s path and query string.
${hostrequestquery} Obtains the given request URL’s query string.
${hostrequesturl} Obtains the given request full URL.
${sequentiallist} Returns the contained parameter values sequentially during the running of a test, and rotates to the beginning when the end is reached.

Synthetic_Verbs_Macros.xlsx