Test Environment Resources

Retrieve details for shared and test-specific environments.


Test Environment List

Get the details of the environments for a test.

Request

GET/buckets/<bucket_key>/tests/<test_id>/environments

Response

Returns the details of the test's environments (only those belonging to the specified test).

Data Attributes
id The unique ID for this environment.
name The name for this environment.
parent_environment_id The parent environment to inherit from, applies only to test-specific environments.
test_id The test this environment is associated with, applies only to test-specific environments.
retry_on_failure If this is set to true, an additional test run will be triggered immediately after a failed scheduled test run.
stop_on_failure If this is set to true, test runs will stop executing after the first step that fails. All subsequent steps will be skipped.
verify_ssl If this is set to false, tests using this environment won't verify SSL certificates.
client_certificate Client certificate text available to be used in request authentication. PEM-encoded.
preserve_cookies If this is set to true, tests using this enviornment will manage cookies between steps.
script The initial script to run before starting tests using this environment.
initial_variables An object with the keys and values being used for variables when the test begins.
regions A list of Runscope regions to execute test runs in when using this environment.
remote_agents A list of remote agents to execute test runs in when using this environment.
webhooks A list of URL's to send results to when test runs using this environment finish.
integrations A list of integrations to enable for test runs using this environment.
emails This object defines settings for sending email notifications upon completion of a test run using this environment.
emails.notify_on Upon completion of a test run Runscope will send email notifications according to the following rules:
  • all — send an email for every test run completed
  • failures — send an email for every test run that fails
  • threshold — send an email only after notify_threshold failures
  • switch — send an email only after notify_threshold failures, and then once more when it begins passing again.
emails.notify_threshold An integer between 1 and 10 for use with the notify_on settings: threshold and switch
emails.notify_all Send an email to all team members according to the notify_on rules.
emails.recipients A list of team users to recieve emails accordig to the other settings.
Example Environment
{
    "emails": {
        "notify_all": false,
        "notify_on": "all",
        "notify_threshold": null,
        "recipients": [
            {
                "email": "grace@example.com",
                "name": "Grace Hopper",
                "id": "4ee15ecc-7fe1-43cb-aa12-ef50420f2cf9"
            }
        ]
    },
    "initial_variables": {
        "my_variable": "some value",
        "one more": "values"
    },
    "integrations": [],
    "name": "Remote Settings",
    "parent_environment_id": null,
    "preserve_cookies": false,
    "regions": [
        "us1",
        "jp1"
    ],
    "retry_on_failure": false,
    "stop_on_failure": false,
    "remote_agents": [
        {
            "name": "my-local-machine.runscope.com",
            "uuid": "141d4dbc-1e41-401e-8067-6df18501e9ed"
        }
    ],
    "script": "var a = \"asdf\";\nlog(\"OK\");",
    "test_id": null,
    "id": "f8007150-0052-482c-9d52-c3ea4042e0f5",
    "verify_ssl": true,
    "client_certificate": "",
    "webhooks": [
        "http://api.example.com/webhook_reciever",
        "https://yourapihere.com/post"
    ]
}

Create Test Environment

Create a new test environment by POSTing a JSON body with the environment details.

Request

POST/buckets/<bucket_key>/tests/<test_id>/environments

Example POST Request
{
    "emails": {
        "notify_all": false,
        "notify_on": "all",
        "notify_threshold": null,
        "recipients": [
            {
                "email": "grace@example.com",
                "name": "Grace Hopper",
                "id": "4ee15ecc-7fe1-43cb-aa12-ef50420f2cf9"
            }
        ]
    },
    "initial_variables": {
        "my_variable": "some value",
        "one more": "values"
    },
    "integrations": [],
    "name": "Remote Settings",
    "parent_environment_id": null,
    "preserve_cookies": false,
    "regions": [
        "us1",
        "jp1"
    ],
    "retry_on_failure": false,
    "stop_on_failure": false,
    "remote_agents": [
        {
            "name": "my-local-machine.runscope.com",
            "uuid": "141d4dbc-1e41-401e-8067-6df18501e9ed"
        }
    ],
    "script": "var a = \"asdf\";\nlog(\"OK\");",
    "verify_ssl": true,
    "client_certificate": "",
    "webhooks": [
        "http://api.example.com/webhook_reciever",
        "https://yourapihere.com/post"
    ]
}

Response

Returns the details of the new test environment.


Shared Environment List

Get the details of the shared environments for a bucket.

Request

GET/buckets/<bucket_key>/environments

Response

Returns a list of the bucket's shared environments.


Create Shared Environment

Create a new test environment.

Request

POST/buckets/<bucket_key>/environments

POST Body

See the example POST body for creating a Test Environment.

Response

Returns the details of the new shared environment.


Environment Detail

Get the details of a single test environment or shared envionment.

Request

GET/buckets/<bucket_key>/tests/<test_id>/environments/<environment_id>

GET/buckets/<bucket_key>/environments/<environment_id>

Response

Returns the details of the environment.


Modify Environment

Update the details of an test environment by making a PUT request with a JSON body of the environment details. The full environment details will need to be provided, not just the updated configuration.

Request

PUT/buckets/<bucket_key>/tests/<test_id>/environments/<environment_id>

PUT/buckets/<bucket_key>/environments/<environment_id>

Example PUT Request
{
    "emails": {
        "notify_all": false,
        "notify_on": "all",
        "notify_threshold": null,
        "recipients": [
            {
                "email": "grace@example.com",
                "name": "Grace Hopper",
                "id": "4ee15ecc-7fe1-43cb-aa12-ef50420f2cf9"
            }
        ]
    },
    "initial_variables": {
        "my_variable": "some value",
        "one more": "values"
    },
    "integrations": [],
    "name": "Remote Settings",
    "parent_environment_id": null,
    "preserve_cookies": false,
    "regions": [
        "us1",
        "jp1"
    ],
    "retry_on_failure": false,
    "stop_on_failure": false,
    "remote_agents": [
        {
            "name": "my-local-machine.runscope.com",
            "uuid": "141d4dbc-1e41-401e-8067-6df18501e9ed"
        }
    ],
    "script": "var a = \"asdf\";\nlog(\"OK\");",
    "script_library": [
        "1a3eb343-4666-4056-bf3d-5e9693be86cd"
    ],
    "verify_ssl": true,
    "client_certificate": "",
    "webhooks": [
        "http://api.example.com/webhook_reciever",
        "https://yourapihere.com/post"
    ]
}

Response

Returns the updated details of the environment.


Delete an Environment

Delete an environment.

Request

DELETE/buckets/<bucket_key>/environments/<environment_id>

Response

Returns a 204 if the environment is successfully deleted.