Adds test set items (tests) to a test set.
Use the operation to insert test set items (tests) to the test set specified by its ID and the ID of the project, to which the test set belongs.
If the test set already has tests, the operation will insert new tests to the end of the test set’s test list.
To replace the test set’s list of tests with a new one, use the …/testsets/{Id}/items (PUT)
operation.
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 Sets.
Request Format
To add tests to a test set, send a POST request to the following URL:
URL parameters
Id : integer, required
The ID of the test set to which items will be added.
ProjectId : integer, required
The ID of the project to which the test set belongs.
Body parameters
In the request body, pass the RequestTestSetItemPost
object that describes the test set items to add.
"Items": [
{
"TestId": "int",
"IsActive": "boolean",
"IsStoppedOnFail": "boolean",
"AssigneeUserId": "int",
"DefaultHostId": "int"
}
]
}
Items : array of objects, required
An array of TestSetItemEntity
objects that describe test items you want to add:
"TestId": "int",
"IsActive": "boolean",
"IsStoppedOnFail": "boolean",
"AssigneeUserId": "int",
"DefaultHostId": "int"
}
TestId : string, required
The ID of the test in the Test Library to which the test set item corresponds.
IsActive : boolean
Specifies whether the test set item is enabled (active).
IsStoppedOnFail : boolean
Specifies whether the test set run will stop when the item fails.
AssigneeUserId : integer
The ID of the user to whom the item is assigned. 0 if the item is not assigned to anyone.
DefaultHostId : integer
The ID of the host to which the item is assigned. 0 if the item is not assigned to any host.
A sample request:
POST http://yourserver.com/rest-api/service/api/v1/projects/11873/testsets/182/items HTTP/1.1
Host: yourserver.com
Connection: keep-alive
Content-Type: application/json
Accept: application/json
Authorization: Basic am9obkBleGFtcGxlLmNvbTpwQHNzd29yZA==
Content-Length: 258
{
"Items": [
{
"TestId": 2678,
"IsActive": true,
"IsStoppedOnFail": true,
"AssigneeUserId": 24714
},
{
"TestId": 2715,
"IsActive": true,
"IsStoppedOnFail": false,
"DefaultHostId": 177
},
]
}
A sample request made by using cURL:
curl -u [email protected]:p@ssword -d @testset.txt -H "Content-Type: application/json" -H "Accept: application/json" http://yourserver.com/rest-api/service/api/v1/projects/11873/testsets/182/items
Response Format
If successful, the operation responds with HTTP status code 200. The response is a JSON object with information on all tests the test set has.
A sample response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 861
{
"metadata": {
"result_set": {
"count": 1,
"offset": 0,
"limit": 25,
"total": 2
},
"permissions": {
"acl": 7
}
},
"results": [
{
"id": 1493,
"project_id": 11873,
"id": 182,
"test_id": 2678,
"seq": 1,
"active": true,
"is_stopped_on_fail": true,
"assignee_user_id": 24714,
"default_host_id": 0,
"date_created": "2015-09-09T09:28:27.0000000",
"date_updated": "2015-09-09T09:28:27.0000000",
"create_user_id": 25264,
"update_user_id": 25264,
"title": "Test input data",
"nbr_steps": 0,
"nbr_files": 0,
"nbr_notes": 0
},
{
"id": 1498,
"project_id": 11873,
"id": 182,
"test_id": 2715,
"seq": 2,
"active": true,
"is_stopped_on_fail": false,
"assignee_user_id": 0,
"default_host_id": 177,
"date_created": "2015-09-09T09:28:27.0000000",
"date_updated": "2015-09-09T09:28:27.0000000",
"create_user_id": 25264,
"update_user_id": 25264,
"title": "Test report output",
"nbr_steps": 0,
"nbr_files": 0,
"nbr_notes": 0
}
]
}
Metadata about the test set item list.
Pagination information about the test set item list. (See Paging Through Results Using Offset and Limit).
The number of returned test set items.
The offset of the first test set item requested.
The maximum number of test set items requested.
The total number of test set items.
The authenticating user’s rights to access test sets.
Access rights:
- 0 - None
- 1 - Read
- 2 - Update
- 3 - Read and update
- 4 - Delete
- 5 - Read and delete
- 7 - Full access
An array of test set items.
The ID of the project to which the test set item belongs.
The unique identifier of the item.
The ID of the test to which the item corresponds.
The ordinal number of the item in the test set.
The ID of the host to which the item is assigned.
The date when the test set item was created.
The date when the test set item was last modified.
The ID of the user who created the test set item.
The ID of the last user who modified the test set item.
The number of files attached to the test set item.
The ID of the test set to which the item belongs.
Specifies whether the test set item is enabled (active).
The ID of the user to whom the item is assigned. 0 if the item is not assigned to anyone.
The title (name) of the test set item.
The number of notes attached to the test set item.
The number of steps the test set item has.
Specifies whether the test set run will stop when the item fails.
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.