Adding Test Cases In Batches to a Plan
Function
This API is used to add test cases in batches to a test plan.
Calling Method
For details, see Calling APIs.
URI
POST /v1/projects/{project_id}/plans/{plan_id}/testcases/batch-add
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project UUID, which uniquely identifies a project. For details about how to obtain the project UUID, see Obtaining a Project ID. Constraints 32 characters (letters and digits). Range N/A. Default Value N/A. |
| plan_id | Yes | String | Definition Unique identifier of a plan. Constraints N/A. Range 11 to 34 characters. Default Value N/A. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token. Constraints N/A. Range 1 to 100,000 characters. Default Value N/A. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| service_id | Yes | Integer | Definition Service ID returned by the API for registering a test service. Constraints N/A. Range N/A. Default Value N/A. |
| testcase_id_list | Yes | Array of strings | Definition Number of cases in a plan. Constraints It must involve only one test type. Range Fewer than 50 elements. Default Value N/A. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| status | String | success or error |
| error | ApiError object | Error message. |
| request_id | String | Input by the API caller. Use a UUID to ensure that the request is unique. |
| server_address | String | Service address that receives the request. |
| result | String | If status is failed, this field stores one ApiError object which only contains the reason field. |
| Parameter | Type | Description |
|---|---|---|
| code | String | Definition Error code. Range N/A. |
| reason | String | Definition Service failure message. Range N/A. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition Processing status of the request. Range success or error |
| result | ResultValueString object | Definition Request result. Range Optional |
| error | ApiError object | Definition Error message. Range Optional |
| request_id | String | Definition Unique ID of a request. Range Optional |
| address | String | Definition Service address that receives the request. Range Optional |
| Parameter | Type | Description |
|---|---|---|
| value | String | Definition resultObject Range N/A. |
| Parameter | Type | Description |
|---|---|---|
| code | String | Definition Error code. Range N/A. |
| reason | String | Definition Service failure message. Range N/A. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code displayed after the API fails to be called. Range N/A. |
| error_msg | String | Definition Error message displayed after the API fails to be called. Range N/A. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code displayed after the API fails to be called. Range N/A. |
| error_msg | String | Definition Error message displayed after the API fails to be called. Range N/A. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code displayed after the API fails to be called. Range N/A. |
| error_msg | String | Definition Error message displayed after the API fails to be called. Range N/A. |
| error_detail | ErrorDetailInfo object | Details about batch operation failure. This field does not display when all operations fail. |
| Parameter | Type | Description |
|---|---|---|
| failed | Array of ErrorCaseInfoBean objects | Details about the resources that fail to be operated in batches. |
Example Requests
Add test cases in batches to a plan.
post https://{endpoint}/v1/projects/efdb403066474ab08836b9eeaaa23bca/plans/9b26f58ec29943f681804a6628779a23/testcases/batch-add
{
"service_id" : 13,
"testcase_id_list" : [ "97b82412f1ca4628803b918c27ed09de", "97b82412f1ca4628803b918c27ed09de", "97b82412f1ca4628803b918c27ed09de" ]
} Example Responses
Status code: 200
OK
{
"status" : "success",
"result" : {
"value" : "success"
}
} Status code: 500
Internal server error
{
"error_code" : "CLOUDTEST.00000001",
"error_msg" : "error message displayed after an API fails to be called"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad request |
| 401 | Unauthorized |
| 404 | Not found |
| 500 | Internal server error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.