Manage Your Browser Tests Programmatically

Overview

Monitoring your application end-to-end is crucial to understanding your users’ experience. The Datadog test recorder allows you to simplify configuration for these complex testing workflows. However, you may want to manage your Synthetics resources programmatically and define browser tests with the API or through Terraform.

Manage your browser tests with the API

Datadog recommends creating your browser tests in the Datadog UI first and retrieving your tests configurations with the API.

  1. Create a browser test and save a recording.
  2. Use the Get the list of all tests endpoint to retrieve the list of all Synthetics tests.
  3. Filter on type: browser and retrieve the public_ids of the browser tests you want to manage with the API.
  4. Use the Get a browser test endpoint to retrieve the configuration files of every browser test.

You can store the browser test configuration files for later usage or use them to duplicate, update, and delete your browser tests programmatically.

Manage your browser tests with Terraform

You can use the Datadog Terraform provider to create and manage browser tests and associated synthetics resources programmatically through a Terraform configuration. You can also import your existing resources into your Terraform configuration, or reference existing resources as external data sources.

Browser tests

The synthetic test resource, with type set to browser, can be used to create and manage your browser tests through Terraform.

Private locations

If you need to run your synthetic tests from custom or secured locations, you can use the private location resource to create and manage private locations to run your tests from. Learn more on the private locations page.

Global and local variables

Use the synthetics global variable resource to create and manage synthetics global variables, which are variables that can be securely shared across tests. You can also create test-specific local variables with builtins by defining the config_variable nested schema with type = "text" in your synthetic test resources.

Concurrency cap

The synthetics concurrency cap resource enables you to limit the number of synthetic tests run in parallel.

Further Reading