To create a local variable, click + All steps > Variables. You can select one of the following available builtins to add to your variable string:
{{ numeric(n) }}
Generates a numeric string with n digits.
{{ alphabetic(n) }}
Generates an alphabetic string with n letters.
{{ alphanumeric(n) }}
Generates an alphanumeric string with n characters.
{{ date(n unit, format) }}
Generates a date in one of Datadog’s accepted formats with a value corresponding to the UTC date the test is initiated at + or - n units.
{{ timestamp(n, unit) }}
Generates a timestamp in one of Datadog’s accepted units with a value corresponding to the UTC timestamp the test is initiated at +/- n units.
{{ uuid }}
Generates a version 4 universally unique identifier (UUID).
{{ public-id }}
Injects the Public ID of your test.
{{ result-id }}
Injects the Result ID of your test run.
To obfuscate local variable values in test results, select Hide and obfuscate variable value. After you have defined the variable string, click Add Variable.
Apply filters to variable values
When you reference a variable, you can transform its resolved value by appending a filter with a pipe (|). Use the syntax {{ VARIABLE_NAME | filter }} anywhere a variable is accepted, such as the URL, request body, headers, and assertions. The following filters are available:
{{ VARIABLE_NAME | urlEncode }}
URL-encodes the variable’s value. For example, hello world becomes hello%20world.
{{ VARIABLE_NAME | urlDecode }}
URL-decodes the variable’s value. For example, hello%20world becomes hello world.
{{ VARIABLE_NAME | base64Encode }}
Base64-encodes the variable’s value. For example, hello becomes aGVsbG8=.
{{ VARIABLE_NAME | base64Decode }}
Base64-decodes the variable’s value. For example, aGVsbG8= becomes hello.
Filters apply to both local and global variables. You can apply one filter per reference, and filter names are case-sensitive.