Add synthetic transactions to your browser test

Customize your browser tests by adding a synthetic transaction that monitors a multi-step user flow, such as. a checkout flow that requires various interactions on a webpage.

Use synthetic transactions in your browser tests to test multi-step user flows and transactions.

What are synthetic transactions?

A synthetic transaction is a group of one or more logically related interactions (steps) that represent a business-critical user flow, such as the login process or a checkout flow.

Splunk Synthetic Monitoring generates the following additional metrics for each synthetic transaction:

  • Duration: Total duration for the synthetic transaction

  • Requests: Total number of requests made during the synthetic transaction

  • Size: Total size of the content loaded during the synthetic transaction

You can create multiple synthetic transactions in a given test to measure size, duration, and requests for multiple workflows across multiple pages.

What are steps?

Steps are interactions with a webpage that require user input. By adding steps to your browser test, you can simulate choices or interactions that a user makes and test how your application behaves in response. Sample steps include:

  • Clicking a link

  • Entering information in a field

  • Selecting a value from a drop-down menu

  • Accepting or dismissing an alert

  • Running and saving values from JavaScript

  • Saving text from an element

You can identify specific page elements involved in these steps by their ID, name, XPATH, CSS Path, link, or JS path. Use developer tools to interact with the DOM (inspector) and JavaScript (console) to identify and interact with the elements of a site.

To learn more about all available types of steps, see Types of steps you can include in your browser tests.

A step doesn’t generate its own dedicated metrics, but it counts toward the metrics for the synthetic transaction it belongs to. Additionally, when a step triggers a new page load, the page load triggers a set of page load metrics.

What are assertions?

Assertions are checks to see what state an object exists in, for example if text is present or an element is visible. An assertion is a type of step. The assertions you can include in your browser tests are described in the table of step types.

Types of steps you can include in your browser tests

The following table describes the types of steps you can include for actions:

Type of step

Description

Accept alert

Accept an alert that appears on the page.

Assert element present

Checks if the element exists in the DOM even if it’s hidden. Use this assertion when you just need to confirm that the element loaded (for example, when it's in a hidden modal or tab).

Assert element visible

Checks that the element exists and is actually visible to the user (in other words, display != none, opacity > 0, and so on). Use this assertion when you want to make sure the element is onscreen and interactable.

Example: If an element is hidden behind a display: none style, the "Assert element present" step will pass but the "Assert element visible" step will fail.

Assert text present

Checks if text exists in the DOM, even if it’s hidden. Use this assertion when you need to confirm that the text loaded (for example, in a hidden modal or tab).

Clear

Clear an element you identify under Selector. Optionally, wait for navigation.

Click

Click on an element you identify under Selector. Optionally, wait for navigation.

Dismiss alert

Dismiss an alert that appears on the page.

Execute JavaScript

Execute a piece of JavaScript you provide under Value. Optionally, wait for navigation.

Fill in field

Fill in the field you identify under Selector with a value you provide in the Value field. For security and reusability, you may want to use a built-in, custom, or global variable in the Value field. Reference a custom variable as {{custom.your-variable-name}}. Optionally, wait for navigation.

Go to URL

Navigate to a URL you provide in the URL field.

Save return value from Javascript

Execute a piece of JavaScript you specify in the JavaScript field. If the script returns a value you want to save, specify a name for the saved value in the Variable field. This creates a custom variable which you can reference in subsequent steps as {{custom.your-variable-name}}. Optionally, wait for navigation.

Save text from element

Save the text an element you identify under Selector, as the variable you provide under Variable.

Select

Select an element you identify under Selector. Choose the value you identify under Value. Optionally, wait for navigation.

Switch to iframe

Switch focus to an embedded document in an inline frame, identified under Selector.

Switch to main

Switch focus back to the main frame of the webpage.

Wait

Wait a certain number of minutes. See Limits and defaults for configurable wait times.

Add synthetic transactions to your browser test

Follow these steps to create a browser test with synthetic transactions:

  1. From the Splunk Synthetic Monitoring landing page, click Add new test > Browser test to create a new browser test.

  2. While creating your browser test, select Edit steps or synthetic transactions. Your current configuration and detector selections are preserved and the Add synthetic transactions view opens.

  3. Enter a name for your synthetic transaction, such as Log in or Begin search.

  4. Enter a name for the first step in your synthetic transaction.

  5. Select a step type from the pull-down menu.

  6. If your step type requires you to identify an element by Selector, enter the following.

    • Selector type: Specify the selector type (ID, name, XPATH, CSS Path, link, or JS path).

    • Selector path: Specify the path used to identify the selector you’re using, conforming to the selector type you chose.

  7. If your step type requires that you enter a Value, you can either type a raw value, or use a built-in, custom, or global variable here. You can select a variable name from the Variables tab to copy it and paste it in the field where you’d like it to be entered.

  8. If your step type has the option to Wait for navigation, select the checkbox if you’d like the test to wait for a 2 second delay to allow the specified action to be executed.

  9. (Optional) Create additional steps and synthetic transactions using the + Step and + Synthetic transaction buttons. Click and drag steps and synthetic transactions to rearrange their order.

  10. (Optional) Use the Test settings tab to adjust your test configuration settings. See Advanced test configurations to learn more.

  11. (Optional) Use the Detectors tab to add detectors to your test. See Detectors and alerts to learn more.

  12. When you’re satisfied with your transactional browser test, select Save.