Help Center/ CodeArts TestPlan/ API Reference/ API/ API Test Suite Management/ Generating an API Test Suite by Importing Files from the Repository
Updated on 2022-12-05 GMT+08:00

Generating an API Test Suite by Importing Files from the Repository

Function

Generates an API test suite by importing files from the repository.

URI

POST /v1/projects/{project_id}/repository/testsuites

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

DevCloud project ID

Minimum: 32

Maximum: 32

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).

Minimum: 1

Maximum: 100000

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

testsuite_name

Yes

String

Name of the test suite to be generated

Minimum: 3

Maximum: 128

repository_id

Yes

String

Repository ID

Minimum: 32

Maximum: 32

repository_branch

Yes

String

Repository branch

Minimum: 3

Maximum: 100

file_path

Yes

String

Relative path of the YAML or JSON file in the repository. Only YAML and JSON files of Swagger 2.0 are supported.

Minimum: 6

Maximum: 128

Response Parameters

Status code: 201

Table 4 Response body parameters

Parameter

Type

Description

testsuite_id

String

ID of the generated test suite

Minimum: 32

Maximum: 32

testcase_ids

Array of strings

List of generated test case IDs

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code displayed after an API fails to be called

Minimum: 16

Maximum: 16

error_detail

Array of CommonResponseDetail objects

Details about the interface invoking failure. This structure is unavailable for non-parameter verification failures.

error_msg

String

Error message displayed after an API fails to be called

Minimum: 3

Maximum: 100

Table 6 CommonResponseDetail

Parameter

Type

Description

step_name

String

Records the name of the incorrect step.

Minimum: 3

Maximum: 100

testcase_name

String

Case name

Minimum: 3

Maximum: 128

fail_content

String

Records the actual error content.

Minimum: 3

Maximum: 128

fail_keys

String

Records the AW that contains the error.

Minimum: 3

Maximum: 128

fail_source

String

Records the name of the header that triggers an error.

Minimum: 3

Maximum: 100

fail_type

String

Records the error type.

Minimum: 3

Maximum: 100

stage

String

Records the stage that contains the error.

Minimum: 2

Maximum: 50

Status code: 401

Table 7 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

Status code: 403

Table 8 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

Status code: 404

Table 9 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

Status code: 500

Table 10 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

Example Requests

{
  "testsuite_name" : "jalor_test_suite",
  "repository_id" : "aa03aeee96fa48f0acc223f0ab503a1f",
  "repository_branch" : "master",
  "file_path" : "apitest.yaml"
}

Example Responses

Status code: 201

Created

{
  "testsuite_id" : "",
  "testsuite_ids" : [ "" ]
}

Status Codes

Status Code

Description

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.