Generating an API Test Suite by Importing Files from a Repository
Function
This API is used to generate an API test suite by importing files from a repository.
Calling Method
For details, see Calling APIs.
URI
POST /v1/projects/{project_id}/repository/testsuites
|
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. |
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 1 to 100,000 characters. Range N/A. Default Value N/A. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
testsuite_name |
Yes |
String |
Definition Name of the test suite to be generated. Constraints 3 to 128 characters. Range N/A. Default Value N/A. |
|
repository_id |
Yes |
String |
Definition Repository ID. Constraints 32 characters. Range N/A. Default Value N/A. |
|
repository_branch |
Yes |
String |
Definition Repository branch. Constraints 3 to 100 characters. Range N/A. Default Value N/A. |
|
file_path |
Yes |
String |
Definition Relative path of the YAML or JSON file in the repository. Only YAML and JSON files of Swagger 2.0 are supported. Constraints 6 to 45 characters. Range N/A. Default Value N/A. |
Response Parameters
Status code: 201
|
Parameter |
Type |
Description |
|---|---|---|
|
testsuite_id |
String |
Definition ID of the generated test suite. Range A string of 32 characters. |
|
testcase_ids |
Array of strings |
Definition URI list of generated test cases. Range N/A. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition Error code displayed after the API fails to be called. Range A string of 16 characters. |
|
error_detail |
Array of CommonResponseDetail objects |
Definition Details about API calling failure. This field does not display for non-parameter verification failures. |
|
error_msg |
String |
Definition Error message displayed after the API fails to be called. Range A string of 3 to 100 characters. |
|
Parameter |
Type |
Description |
|---|---|---|
|
step_name |
String |
Definition Name of the incorrect step. Range A string of 3 to 100 characters. |
|
testcase_name |
String |
Definition Case name. Range A string of 3 to 128 characters. |
|
fail_content |
String |
Definition The actual error content. Range A string of 3 to 128 characters. |
|
fail_keys |
String |
Definition The keyword that contains the error. Range A string of 3 to 128 characters. |
|
fail_source |
String |
Definition The header name of the error part. Range A string of 3 to 100 characters. |
|
fail_type |
String |
Definition Error type. Range A string of 3 to 100 characters. |
|
stage |
String |
Definition The stage that contains the error. Range A string of 2 to 50 characters. |
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: 403
|
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. |
Example Requests
post https://{endpoint}/v1/projects/75681cbb7c324e15a9eb8ee74a96a474/repository/testsuites
{
"testsuite_name" : "New test suite",
"repository_id" : "2213",
"repository_branch" : "master",
"file_path" : "/opt"
}
Example Responses
Status code: 201
Created
{
"testsuite_id" : "v92u00010adqi1bl",
"testcase_ids" : [ "bb1d3f7a6ffc409dad173d90b0620d9f", "b24c3b86e8a7456bbb9a9b06cd91dc40" ]
}
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.