Assigns new automation to a test.
Use the operation to add new automation to the test in your QAComplete project.
To replace the automation (to redefine all the field values), use the …/tests/{TestId}/automations/{Agent} (PUT)
operation. To update individual fields of automation, use the …/tests/{TestId}/automations/{Agent} (PATCH)
operation.
Note: | You can assign only one automation of each agent type to a test. |
Authentication
Basic authentication using a user’s login and password. See Authentication for details.
Security Rights
The authenticating user must belong to a security group that has the Update privilege for Test Library.
Request Format
To create a test, send a POST request to the following URL:
URL parameters
ProjectId : integer, required
The ID of the project.
TestId : integer, required
The ID of the test you want to add the automation to.
Agent : string, required
The URL-encoded or the short name of the automation agent (test runner).
Currently, REST API supports the following agents:
Agent | URL-encoded Name | Short Name |
---|---|---|
TestComplete/TestExecute | TestComplete%2FTestExecute |
testcomplete |
JUnit (Selenium) | JUnit%20%28Selenium%29 |
junit |
NUnit (Selenium) | NUnit%20%28Selenium%29 |
nunit |
TestNG (Selenium) | TestNG%20%28Selenium%29 |
testng |
ReadyAPI / SoapUI OS | ReadyAPI+%2F+SoapUI+OS |
readyapi |
The agent names are case-insensitive.
Body parameters
In the request body, pass the RequestAutomationPost
object that describes the automation to create.
"Title": "string",
"Timeout": "int",
"RunMode": "int",
"Params": {
"Item": {},
"Keys": {
"Count": "int",
"IsReadOnly": "boolean",
}
"Values": "ICollection`1"
}
}
Some string property values (for example, Status
) are based on the choice lists defined in your QAComplete project. You can find these values in the Test Management > Test Library > Tools > Manage Choice Lists panel in QAComplete.
Title : string
The title of the automation.
Timeout : integer
The test timeout in seconds.
RunMode : integer
Indicates whether to run test in a temporary folder or in-place (if possible).
Params : array of objects
An array of RequestAutomationPost
objects that describe the automation parameters. The available parameters and arguments may vary depending on the agent that will run the automation. For more information on the agents QAComplete supports, see the Automations section.
A sample request:
POST http://yourserver.com/rest-api/service/api/v2/projects/11873/tests/2693/readyapi HTTP/1.1
Host: yourserver.com
Connection: keep-alive
Content-Type: application/json
Accept: application/json
Authorization: Basic am9obkBleGFtcGxlLmNvbTpwQHNzd29yZA==
Content-Length: 232
{
"agent": "ReadyAPI / SoapUI OS",
"Title": "NewAutomation",
"Timeout": 60,
"RunMode": 0,
"Params": {
"test_suite": "TestSuite1",
"test_case": "TestCase1",
"report_type": "PDF",
"custom_args": "-EMyEnvironment"
}
}
A sample request made by using cURL:
curl -u [email protected]:p@ssword -d @automation.txt -H "Content-Type: application/json" -H "Accept: application/json" http://yourserver.com/rest-api/service/api/v2/projects/11953/tests/2693/readyapi
Response Format
If successful, the operation responds with HTTP status code 200. The response is a JSON object with information on the added automation.
A sample response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 203
{
"agent": "ReadyAPI / SoapUI OS",
"title": "NewAutomation",
"timeout": 60,
"run_mode": 0,
"params": {
"test_suite": "TestSuite1",
"test_case": "TestCase1",
"report_type": "PDF",
"custom_args": "-EMyEnvironment"
}
}
The agent (test runner) to run the test with.
The title of automation.
The test timeout in seconds.
Indicates whether to run a test in a temporary folder or in-place (if possible).
The test parameters.
The test suite to run (from the ReadyAPI / ReadyAPI Test project).
The test case to run (from the ReadyAPI / ReadyAPI Test project).
The report type for the ReadyAPI / ReadyAPI Test automated test.
Custom arguments for the ReadyAPI / ReadyAPI Test test runner.
Error responses
If the operation fails, it returns the appropriate status code and (optionally) the error description in the response body.
If the project with the specified ProjectId does not exist or the authenticating user does not have rights to access the project, the operation returns the Access is denied
error.