Returns an automation script assigned to the test.
After an agent finds tests to be run on its host, the agent can download automation scripts to run locally.
Automation scripts are specified on the Automation tab of a test in Test Management > Test Library. Users can store automation scripts in several ways:
A zipped script attached to a test in the Test Library.
A zipped script on a web site.
An unpacked or zipped script in a shared network folder (UNC path).
An unpacked or zipped script in a local folder on the host.
The operation lets you get the automation script regardless of where it resides.
Basic authentication using the host ID and security token. See Authentication for details.
To download the automation script for a test, send a GET request to the following URL:
HostId : integer, required
The host ID.
RunId : integer, required
The test run ID. This is the
results[index].id value from the …/currentruns operation response. In QAComplete, test run IDs appear in Test Management > Run History and in the history of Test Schedules.
SequenceNumber : integer, required
For test sets, this is the 1-based index (the sequence number) of the test in the set. For individual tests, use 1.
You can get this value from the response of the …/currentruns operation as
Agent : string, required
The URL-encoded name of the agent (test runner).
REST API v2 supports the following agents:
|ReadyAPI / SoapUI OS||
A sample request:
GET http://yourserver.com/rest-api/service/automation/v2/hosts/143/runs/529/items/1/script?agent=TestComplete%2FTestExecute HTTP/1.1
Authorization: Basic am9obkBleGFtcGxlLmNvbTpwQHNzd29yZA==
A sample request made by using cURL:
curl -u &id-token; -L -o testproject.zip http://yourserver.com/rest-api/service/automation/v2/hosts/143/runs/529/items/1/script?Agent=TestComplete%2FTestExecute
The response depends on whether the automation script is attached to the test in QAComplete, or whether it is specified by using a URL or UNC path:
If the automation script is attached to the test, the API responds with HTTP status code 200 and returns the ZIP file contents in the response body.HTTP/1.1 200 OK
If the automation script is specified by the UNC path, the API responds with HTTP status code 404 and returns the UNC path in the
Locationheader:HTTP/1.1 404 NotFound
Locationvalue can be either a ZIP file name, or a folder that contains the project suite files. You need to check the path type and process the path appropriately.
If the automation script is specified by URL, the API returns a 302 redirect with the URL in the
Locationheader.HTTP/1.1 302 Found
Some tools and development libraries can automatically follow 302 redirects and will return the target file without having to make an extra request.
If the operation fails, it returns the appropriate status code and (optionally) the error description in the response body.