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

Commit 3999896

Browse files
authored
Merge pull request #2564 from splunk/adasplunk-O11YDOCS-6660
[O11YDOCS-6660] Custom variables [Feb 4 release]
2 parents 3b1661b + 2286404 commit 3999896

File tree

4 files changed

+47
-5
lines changed

4 files changed

+47
-5
lines changed

synthetics/browser-test/set-up-browser-test.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Follow these steps to set up a Browser test:
3030

3131
#. From the landing page of Splunk Observability Cloud, navigate to Splunk Synthetic Monitoring.
3232

33-
#. Under Tests, select :guilabel:`Add New Test` and select :guilabel:`Browser Test` from the drop-down list. The test creation view opens.
33+
#. Under :guilabel:`Tests`, select :guilabel:`Create new test` and then select :guilabel:`Browser test` from the drop-down list. The test creation view opens.
3434

3535
#. In the :guilabel:`Name` field, enter a name for your test.
3636

synthetics/browser-test/set-up-transactional-browser-test.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,23 @@ The following table describes the types of steps you can include for actions:
6969
- Dismiss an alert that appears on the page.
7070

7171
* - Fill in field
72-
- Fill a field you identify under :guilabel:`Selector` with a value you provide under :guilabel:`Value`. Optionally, wait for navigation. For security and reusability, use a built-in, custom, or global variable to provide the value. See :ref:`global-variables` to learn more.
72+
- Fill in the field you identify under :guilabel:`Selector` with a value you provide in the :guilabel:`Value` field. For security and reusability, you may want to use a :ref:`built-in <built-in-variables>`, :ref:`custom <custom-variables>`, or :ref:`global <global-variables>` variable in the :guilabel:`Value` field. Reference a custom variable as ``{{custom.your-variable-name}}``. Optionally, wait for navigation.
7373

7474
* - Go to URL
75-
- Navigate to a URL you provide under :guilabel:`Value`.
75+
- Navigate to a URL you provide in the :guilabel:`URL` field.
7676

7777
* - Execute JavaScript
7878
- Execute a piece of JavaScript you provide under :guilabel:`Value`. Optionally, wait for navigation.
7979

80-
* - Select
81-
- Select an element you identify under :guilabel:`Selector`. Choose the value you identify under :guilabel:`Value`. Optionally, wait for navigation.
80+
* - Save return value from Javascript
81+
- Execute a piece of JavaScript you specify in the :guilabel:`JavaScript` field. If the script returns a value you want to save, specify a name for the saved value in the :guilabel:`Variable` field. This creates a custom variable which you can reference in subsequent steps as ``{{custom.your-variable-name}}``. Optionally, wait for navigation.
8282

8383
* - Save text from element
8484
- Save the text an element you identify under :guilabel:`Selector`, as the variable you provide under :guilabel:`Variable`.
8585

86+
* - Select
87+
- Select an element you identify under :guilabel:`Selector`. Choose the value you identify under :guilabel:`Value`. Optionally, wait for navigation.
88+
8689
* - Switch to iframe
8790
- Switch focus to an embedded document in an inline frame, identified under :guilabel:`Selector`.
8891

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Advanced test configurations
1111

1212
auth
1313
built-in-variables
14+
custom-variables
1415
synth-alerts
1516
devices
1617
syn-downtimes
@@ -19,6 +20,7 @@ Advanced test configurations
1920
public-locations
2021
rum-synth
2122
try-now
23+
2224

2325

2426
To simulate diverse types of traffic to your site or application, use a range of configuration options to customize each of your tests.

0 commit comments

Comments
 (0)