Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit f2433ce

Browse files
author
ada
committed
Incorporated reviewer feedback
1 parent 1d5eca8 commit f2433ce

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. _custom-variables:
2+
3+
*********************************************************************
4+
Custom variables
5+
*********************************************************************
6+
7+
.. meta::
8+
:description: Define a custom variable that you can use in an individual synthetic test.
9+
10+
11+
Custom variables are variables you can set and use within a single test. Whereas global variables are static and stored in the env namespace, custom variables are dynamic and are stored in the custom namespace. You can use them to store and retrieve dynamic values in your browser and API tests. You can't use custom variables in uptime (HTTP or port) tests.
12+
13+
14+
How to create a custom variable
15+
=====================================================================
16+
17+
You can create a custom variable and assign a value to it in a browser test or API test. For example, in a browser test, you can add a :guilabel:`Save return value from Javascript` step and specify a name for the variable in the :guilabel:`Variable` field. Variable names must be unique within an individual test.
18+
19+
How to use a custom variable
20+
=====================================================================
21+
22+
You can use a custom variable in a browser test or API test. Always reference a custom variable as ``{{custom.your-variable-name}}``. For example, in a browser test:
23+
24+
* Add a :guilabel:`Go to URL` step and specify the variable name in the :guilabel:`URL` field.
25+
26+
* Add a :guilabel:`Fill in field` step and specifiy the variable name in the :guilabel:`Value` field.
27+
28+
29+
You can only reference custom variables after you've defined them in an earlier step.
30+
31+
32+
See also
33+
=====================================================================
34+
35+
* :ref:`built-in-variables`
36+
* :ref:`global-variables`
37+

synthetics/test-config/test-config.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Advanced test configurations
1111

1212
synth-alerts
1313
built-in-variables
14+
custom-variables
1415
global-variables
1516
public-locations
1617
private-locations

0 commit comments

Comments
 (0)