Help Center/ CodeArts TestPlan/ API Reference/ API/ Test Plan Management/ Adding Test Cases in Batches to a Plan
Updated on 2023-06-26 GMT+08:00

Adding Test Cases in Batches to a Plan

Function

Adds test cases in batches to a plan.

URI

POST /v1/projects/{project_id}/plans/{plan_id}/testcases/batch-add

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Unique ID of a project. The value is a string of 32 characters.

plan_id

Yes

String

Unique ID of a plan. The value contains 11 to 34 characters.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. Call IAM to obtain the user token (value of X-Subject-Token in the response header).

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

service_id

Yes

Integer

Service ID returned by the API for registering a test service

testcase_id_list

Yes

Array of strings

Number of cases contained in the plan. The array length is less than 50. Only one test type can be contained.

Response Parameters

Status code: 500

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code displayed after an API fails to be called

error_msg

String

Error message displayed after an API fails to be called

error_detail

ErrorDetailInfo object

Details about failed batch operations. This structure is unavailable when all operations fail.

Table 5 ErrorDetailInfo

Parameter

Type

Description

failed

Array of ErrorCaseInfoBean objects

Details about the resources that fail to be operated in batches

Table 6 ErrorCaseInfoBean

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

testcase_id

String

Failed resource information

Example Requests

post https://{endpoint}/v1/projects/efdb403066474ab08836b9eeaaa23bca/plans/9b26f58ec29943f681804a6628779a23/testcases/batch-add

{
  "service_id" : 13,
  "testcase_id_list" : [ "97b82412f1ca4628803b918c27ed09de", "97b82412f1ca4628803b918c27ed09de", "97b82412f1ca4628803b918c27ed09de" ]
}

Example Responses

Status code: 500

Internal Server Error

{
  "error_code" : "CLOUDTEST.00000001",
  "error_msg" : "Error message displayed after an API fails to be called",
  "error_detail" : {
    "failed" : [ {
      "error_code" : "CLOUDTEST.00000001",
      "error_msg" : "Error message returned",
      "testcase_id" : "efdb403066474ab08836b9eeaaa23bca"
    } ]
  }
}

Status Codes

Status Code

Description

204

No Content

400

Bad Request

401

Unauthorized

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.