Querying the Test Plan List in a Project
Function
This API is used to query the test plan list in a project.
Calling Method
For details, see Calling APIs.
URI
GET /v1/projects/{project_id}/plans
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition Project UUID. For details, see Obtaining a Project ID. Constraints 32 characters (letters and digits). Range N/A. Default Value N/A. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Definition Used for fuzzy query (for test plan names). Constraints N/A. Range N/A. Default Value N/A |
current_stage |
No |
String |
Definition Test plan stage (create, design, execute, or report). Constraints N/A. Range N/A. Default Value N/A |
offset |
Yes |
Integer |
Definition Offset Constraints N/A. Range 0–2000000. Default Value N/A |
limit |
Yes |
Integer |
Definition Number of items displayed on each page. Constraints N/A. Range 1–100 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. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
[Array elements] |
Array of TestPlanDetail objects |
Response structure for querying the test plan list in a project. |
Parameter |
Type |
Description |
---|---|---|
creator |
creator object |
Definition Test plan creator information. Range N/A. |
current_stage |
String |
Definition Stage of the current test plan. Range N/A. |
design_stage |
design_stage object |
Definition Information about the test plan design stage. Range N/A. |
end_date |
String |
Definition Test plan deadline. Range N/A. |
execute_stage |
execute_stage object |
Definition Information about the test plan execution stage. Range N/A. |
expire_day |
Integer |
Definition Overdue days. A positive value indicates that the plan has expired. Range N/A. |
finish_date |
String |
Definition Actual completion time of the test plan (when all test cases under the test plan are completed.) Range N/A. |
iteration |
NameAndId object |
Definition Sprint No. and name of the test plan. Range N/A. |
name |
String |
Definition Test plan name. Range N/A. |
owner |
owner object |
Definition Test plan processor information. Range N/A. |
plan_id |
String |
Definition Test plan ID. Range N/A. |
project_id |
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. |
report_stage |
report_stage object |
Definition Statistics at the reporting stage. Range N/A. |
start_date |
String |
Definition Test plan start time. Range N/A. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition ID of the test plan creator. Range N/A. |
nick_name |
String |
Definition Nickname of the test plan creator. Range This field is not returned if the user does not set the nickname. |
user_name |
String |
Definition Name of the test plan creator. Range N/A. |
Parameter |
Type |
Description |
---|---|---|
case_count |
Integer |
Definition Number of test cases. Range N/A. |
issue_count |
Integer |
Definition Number of requirements. Range N/A. |
issue_covered_count |
String |
Definition Number of requirements associated with test cases. Range N/A. |
Parameter |
Type |
Description |
---|---|---|
case_pass_rate |
String |
Definition Test case pass rate, calculated by test case results. Range N/A. |
completed_defect_count |
Integer |
Definition Number of completed bugs. Range N/A. |
defect_count |
Integer |
Definition Number of bugs. Range N/A. |
executed_case_count |
Integer |
Definition Number of executed test cases, calculated by test case status. Range N/A. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition Object ID. Range N/A. |
name |
String |
Definition Object name. Range N/A. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition Test plan processor ID. Range N/A. |
name |
String |
Definition Name of the test plan processor. nickName is returned if it exists, otherwise userName is returned. Range N/A. |
nick_name |
String |
Definition Alias of the test plan processor. This parameter is not returned if the user does not set an alias. Range N/A. |
user_name |
String |
Definition Username of the test plan processor. Range N/A. |
Parameter |
Type |
Description |
---|---|---|
case_complete_rate |
String |
Definition Case completion rate, calculated by status. Range 0%–100% |
Status code: 400
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: 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. |
Example Requests
get https://{endpoint}/v1/projects/efdb403066474ab08836b9eeaaa23bca/plans?offset=1&limit=10¤t_stage
Example Responses
Status code: 200
OK
[ { "creator" : { "id" : "efdb403066474ab08836b9eeaaa23bca", "nick_name" : "Tester", "user_name" : "Tester" }, "current_stage" : "design", "design_stage" : { "case_count" : 2, "issue_count" : 0, "issue_covered_count" : "0" }, "end_date" : "2021-07-10", "execute_stage" : { "case_pass_rate" : "0.00%", "completed_defect_count" : 0, "defect_count" : 0, "executed_case_count" : 0 }, "expire_day" : -4, "finish_date" : "2021-07-10", "iteration" : { "id" : "ID", "name" : "Name" }, "name" : "Test", "owner" : { "id" : "efdb403066474ab08836b9eeaaa23bca", "name" : "Tester", "nick_name" : "Tester", "user_name" : "Tester" }, "plan_id" : "c7c2ddf2ea914164ac6ee76bf11a30ea", "project_id" : "9b26f58ec29943f681804a6628779a23", "report_stage" : { "case_complete_rate" : "100.00%" }, "start_date" : "2021-07-10" } ]
SDK Sample Code
The sample code is as follows.
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.cloudtest.v1.region.CloudtestRegion; import com.huaweicloud.sdk.cloudtest.v1.*; import com.huaweicloud.sdk.cloudtest.v1.model.*; public class ShowPlansSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); CloudtestClient client = CloudtestClient.newBuilder() .withCredential(auth) .withRegion(CloudtestRegion.valueOf("<YOUR REGION>")) .build(); ShowPlansRequest request = new ShowPlansRequest(); request.withProjectId("{project_id}"); try { ShowPlansResponse response = client.showPlans(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkcloudtest.v1.region.cloudtest_region import CloudtestRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcloudtest.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = BasicCredentials(ak, sk) client = CloudtestClient.new_builder() \ .with_credentials(credentials) \ .with_region(CloudtestRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowPlansRequest() request.project_id = "{project_id}" response = client.show_plans(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" cloudtest "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cloudtest/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cloudtest/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cloudtest/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := cloudtest.NewCloudtestClient( cloudtest.CloudtestClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ShowPlansRequest{} request.ProjectId = "{project_id}" response, err := client.ShowPlans(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More SDK Sample Code
For SDK code examples in more programming languages, visit API Explorer and click the Sample Code tab.
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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot