Add a set of tests for one or multiple sites, or custom URL(s)
Overview
This endpoint can be used to:
- trigger on-demand testing of a single or multiple websites
- create a deployment for site(s)
- add an adhoc test for a custom URL
Snapshot vs deploy
Snapshot is a set of on-demand tests of your website or custom URLs, submitted at the same time.
Deployment (or deploy) is a way to group and add extra information to your snapshots (e.g. name and description), for example, to mark a new version of your code (deployment marks will be present in your charts in SpeedCurve and are supposed to help you to track any performance changes).
There is one-to-one relationship between a site and a snapshot, and a one-to-many relationship between a deploy and a snapshot. Therefore, a deploy can have multiple snapshots each of which might be linked to a site.
Deployment supports replacing the origin in your URLs. This is to help you with testing non-production environments that could be deployed to a different host, e.g. staging and development builds. See more in the examples below.
Adhoc testing
You can initiate Adhoc (custom URL) testing using this endpoint by omitting sites
parameter and passing the following adhoc settings (that become required if sites
is not present):
urls
(array of objects): list of URLs you would like to testregions
(array of objects): list of regions (locations) to run adhoc tests from. Use Region ID from this list to pass asregion_id
. You can use private region ID if you have one.test_profiles
(array of objects): list of test profiles (browsers), including custom profiles. Use browser name from your settings page to pass asname
parameter, for exampleDesktop Slow
. Default test profiles
Please see examples of JSON body for adhoc testing below.
Example JSON requests
Single site testing
Start on-demand testing of individual site (with the test settings used for scheduled testing of the site)
{
"sites": [
{
"site_id": 123
}
]
}
Single site deployment
Add a deployment for a site
{
"sites": [
{
"site_id": 123
}
],
"deploy": {
"name": "Update React to v18.2.0"
}
}
Multiple sites testing
Start an on-demand testing of multiple sites. This will create a separate snapshot for each site
{
"sites": [
{
"site_id": 123
},
{
"site_id": 456
}
]
}
Test individual URL(s) of existing site
Start on-demand testing of one or more individual URLs within an existing site (with the test settings used for scheduled testing of the site).
The following example will trigger tests for two URLs of site ID123 using settings (browsers and regions) specified for that site:
{
"sites": [
{
"site_id": 123,
"urls": [
{
"url_id": 456
},
{
"url_id": 789
}
]
}
]
}
Adhoc testing
Start an adhoc test for one or more custom URLs, regions and test profiles. Optionally specify synthetic test script and HTTP Basic auth credentials for the URL(s).
{
"urls": [
{
"url": "https://www.speedcurve.com/about",
"script": null,
"auth":
{
"username": null,
"password": null
}
}
],
"regions": [
{
"region_id": "ap-southeast-1"
}
],
"test_profiles": [
{
"name": "Firefox"
},
{
"name": "Chrome Beta"
}
]
}
Adhoc deployment
Pass optional deploy
object to create a deployment for this round of adhoc tests. Might be useful to track your deployments if you use CI/CD process to trigger adhoc performance testing.
{
"urls": [
{
"url": "https://www.speedcurve.com/about",
},
{
"url": "https://www.speedcurve.com/"
}
],
"regions": [
{
"region_id": "ap-southeast-1"
}
],
"test_profiles": [
{
"name": "Desktop Slow"
},
{
"name": "Mobile Medium"
}
],
"deploy": {
"name": "v130",
"description": "Commit f0fda58630310a6dd91a7d8f0a4ceda2"
}
}
Deploy a different environment (replace URL origin)
Replacing the origin in your URLs can help you test staging and development builds when you need to work with an environment different from production, using the settings already present in your project.
The term "origin" refers to the combination of a scheme (protocol, such as HTTP or HTTPS), a hostname, and a port (if specified). For example, given the URL https://www.example.com:443/foo
, the origin is https://www.example.com:443
.
To swap the origin in all URLs of your site, send the deploy[environment_origin]
parameter with your request. For example, replacing the origin in the URL https://www.example.com/foo
with https://staging.example.com
will result in testing https://staging.example.com/foo
instead of the original URL defined in the site settings.
The following is the request payload example:
{
"sites": [
{
"site_id": 123
}
],
"deploy": {
"name": "PR #876 Remove lazy load from category page banner",
"environment_name": "staging",
"environment_origin": "https://staging.example.com"
}
}
Please see GitHub Integration page for automating your deployments created as part of GitHub pull requests.