GET Test Runs from Related Job Templates
You might want to view all of the test runs that have been run from jobs created with the same job template, or subsequent edits made to that job template. This data gathering is useful to see how the performance of the results in that job changes over time.
For example, if you have a job template set up to test your website against your competitor's every day, you might want to extract the results from the API to display on a dashboard. This is similar to what the Speed Analysis chart shows you in the portal.
Request
Note that you are searching for test runs based on the given sref for the job template. Refer to Get One Job Template for more details on discovering the sref for job templates.
Method | GET |
Path | /testRuns?jobTemplate=job_template_sref |
Header |
Realm: account_realm Authorization: Bearer access_token |
The sref for the job template must be URL encoded, so your request will look something like this:
Path | /testRuns?jobTemplate=jobTemplates%2F6789 |
Response
The response for this request is an array of test run objects:
Body |
"results": [ { "sref": "testRuns/1001", "pageTitle": "My Homepage", "url": "http://my.url.com", "browser": "browsers/ff", "dataStartDuration": 1.234, "renderStart": 2.345, "domLoad": 3.456, "onLoad": 4.567, "visuallyComplete": null, "downloadDuration": 6.789, "pageSize": 42345, "speedIndex": null, "resultCode": 1, "objectCount": 26, "severity": "ok", "ranAt": "2016-04-07T08:06:47+00:00", "objectsUri": "objects?testRun=testRuns%2F1001", "jobUri": "jobs/123" }, { "sref": "testRuns/1002", "pageTitle": "Your Homepage", "url": "http://your.url.com", "browser": "browsers/ff", "dataStartDuration": 3.254, "renderStart": 1.463, "domLoad": 2.693, "onLoad": 3.683, "visuallyComplete": 4.293, "downloadDuration": 6.046, "pageSize": 83968, "speedIndex": 3678, "resultCode": 1, "objectCount": 32, "severity": "ok", "ranAt": "2016-04-07T08:08:12+00:00", "objectsUri": "objects?testRun=testRuns%2F1002", "jobUri": "jobs/123" }, ... ] |
Test Run Parameters
Each test run you request from the API includes the following parameters:
Parameter | Details |
---|---|
sref | A self-reference path that describes how you can request the test run object |
pageTitle | The title of the page tested, or the URL if no page title was set |
url | The URL tested |
browser | The browser used for the test run |
dataStartDuration | How long (in seconds) until the very first request starts return data |
renderStart | How long (in seconds) until the browser starts rendering the page |
domLoad | How long (in seconds) until the DOM load event fires in the browser |
onLoad | How long (in seconds) until the page load event fires in the browser |
visuallyComplete | How long (in seconds) until the visible page finishes rendering |
downloadDuration | How long (in seconds) all network activities take to load the page |
pageSize | The size of the page in bytes (using the compressed size of objects if compressed) |
speedIndex | The Speed Index for the test run |
resultCode | The result code of the test run |
objectCount | How many objects (network requests) were made for this page |
severity | A categorization of how the page ran (i.e., ok, warning) |
ranAt | The date/time the page was tested |
objectsUri | The URI of how to query details about all objects for this test run |
jobUri | The URI of the job that this test run is a member of |
Limit Test Runs by Date and Time
You can restrict the search for jobs by the date and time they happened. You can specify the fromDate, the toDate, or both together. All dates and times are inclusive and are specified using the standard date/time format the API returns data in, but must be URL encoded and sent as a query string.
Request
Method | GET |
Path | /testRuns?fromDate=from_date&toDate=to_date |
Header |
Realm: account_realm Authorization: Bearer access_token |
All date/times must be URL encoded, so, for example, if you wanted to search for all jobs that ran before January 1, 2017, (represented as 2017-01-01T00:00:00+00:00 in ISO date format), you would make the following request:
Path | /testRuns?fromDate=2017-01-01T00%3A00%3A00%2B00%3A00 |
Response
The returned pagination will honor the date and time range you have specified, meaning you can retrieve all of the data from that date or time range, even if it spans multiple paginated pages. The response will include the date ranges specified, as well as the total number of results in the meta section:
Body |
"meta": { "fromDate": "2017-03-01T00:00:00+00:00", "toDate": "2017-03-01T23:59:59+00:00", "paginationTotalResults": 66, "response_in_sec": 0.28 }, |