质量报告需求测试情况统计
功能介绍
质量报告需求测试情况统计
调用方法
请参见如何调用API。
URI
POST /testreport/v4/{project_id}/versions/{version_id}/requirements/overview
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
参数解释: 项目UUID,项目唯一标识,固定长度32位字符(字母和数字)。获取方式请参见获取项目ID 约束限制: 不涉及 取值范围: 项目uuid应符合如下规则:长度等于32位,包含大小写字母、数字 默认取值: 不涉及 |
version_id |
是 |
String |
版本id |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
参数解释: 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 必传。 取值范围: 字符串长度不少于1,不超过10万。 默认取值: 不涉及。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
fixed_version_id |
否 |
String |
筛选迭代ID |
module_id |
否 |
String |
模块ID |
key_word |
否 |
String |
关键字 |
page_size |
否 |
Integer |
每页数量 |
page_no |
否 |
Integer |
页码 |
pi_filter |
否 |
PiFilterInfo object |
pi筛选条件 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
pi_sprints |
否 |
Array of PiInfo objects |
pi迭代筛选条件 |
all_pi |
否 |
Boolean |
pi下拉框全选标识,全选时为true |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
value |
RequirementsOverviewVo object |
请求返回的数据模型 |
参数 |
参数类型 |
描述 |
---|---|---|
total_number |
Integer |
质量报告需求测试情况总数 |
requirement_overview_list |
Array of RequirementOverviewVo objects |
质量报告需求测试情况列表 |
参数 |
参数类型 |
描述 |
---|---|---|
name |
String |
需求名称 |
workitem_id |
String |
需求id |
sequence_id |
String |
需求序列编号 |
board_id |
String |
看板需求id |
tracker_id |
String |
需求类型id |
tracker_name |
String |
需求类型 |
relate_case_number |
Integer |
需求关联用例总数 |
case_pass_vo |
CasePassVo object |
需求关联用例通过情况 |
case_execute_vo |
CaseExecuteVo object |
需求关联用例执行率情况 |
relate_defect_number |
Integer |
需求关联缺陷总数 |
参数 |
参数类型 |
描述 |
---|---|---|
pass_rate |
String |
需求关联用例通过率 |
result_number_list |
Array of NameAndValueVo objects |
需求关联用例结果与对应的用例数目列表 |
参数 |
参数类型 |
描述 |
---|---|---|
execute_rate |
String |
需求关联用例执行率 |
executed_number |
Integer |
需求关联已执行用例总数 |
not_executed_number |
Integer |
需求关联未执行用例总数 |
状态码:400
参数 |
参数类型 |
描述 |
---|---|---|
code |
String |
参数解释: 业务失败的错误码 取值范围: 不涉及 |
reason |
String |
参数解释: 业务失败的提示内容 取值范围: 不涉及 |
状态码:401
参数 |
参数类型 |
描述 |
---|---|---|
code |
String |
参数解释: 业务失败的错误码 取值范围: 不涉及 |
reason |
String |
参数解释: 业务失败的提示内容 取值范围: 不涉及 |
状态码:404
参数 |
参数类型 |
描述 |
---|---|---|
code |
String |
参数解释: 业务失败的错误码 取值范围: 不涉及 |
reason |
String |
参数解释: 业务失败的提示内容 取值范围: 不涉及 |
状态码:500
参数 |
参数类型 |
描述 |
---|---|---|
code |
String |
参数解释: 业务失败的错误码 取值范围: 不涉及 |
reason |
String |
参数解释: 业务失败的提示内容 取值范围: 不涉及 |
请求示例
POST https://{endpoint}/testreport/v4/73ad9ecbf32f44928b51a5d2c96720b8/versions/932opbu6aaf/requirements/overview
{
"key_word" : "",
"page_size" : 5,
"page_no" : 1,
"pi_filter" : {
"all_pi" : true,
"pi_sprints" : [ {
"pi_id" : "1116809383431417857",
"sprints" : [ "1116809383519498241", "" ]
} ]
}
}
响应示例
状态码:200
OK
{
"value" : {
"total_number" : 51,
"requirement_overview_list" : [ {
"name" : "智能手表可语音遥控手机拍照",
"workitem_id" : "1116809374191366145",
"sequence_id" : "SF20250409317534",
"tracker_id" : "6",
"tracker_name" : "SF",
"relate_case_number" : 0
}, {
"name" : "智能手表能控制iOS 手机播放音乐",
"workitem_id" : "1116809374187171842",
"sequence_id" : "SF20250409317533",
"tracker_id" : "6",
"tracker_name" : "SF",
"relate_case_number" : 0
}, {
"name" : "智能手表能控制iOS 手机拍照",
"workitem_id" : "1116809374187171841",
"sequence_id" : "SF20250409317532",
"tracker_id" : "6",
"tracker_name" : "SF",
"relate_case_number" : 0
}, {
"name" : "智能手表能同步查看手机的消息通知",
"workitem_id" : "1116809374187171840",
"sequence_id" : "SF20250409317531",
"tracker_id" : "6",
"tracker_name" : "SF",
"relate_case_number" : 0
}, {
"name" : "智能手表具有兼容性,能控制老华为手机,非鸿蒙手机拍照",
"workitem_id" : "1116809374182977538",
"sequence_id" : "SF20250409317530",
"tracker_id" : "6",
"tracker_name" : "SF",
"relate_case_number" : 0
} ]
}
}
SDK代码示例
SDK代码示例如下。
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
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.*;
import java.util.List;
import java.util.ArrayList;
public class ShowRequirementsOverviewSolution {
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();
ShowRequirementsOverviewRequest request = new ShowRequirementsOverviewRequest();
request.withVersionId("{version_id}");
request.withProjectId("{project_id}");
QueryRequirementsOverviewInfo body = new QueryRequirementsOverviewInfo();
List<String> listPiSprintsSprints = new ArrayList<>();
listPiSprintsSprints.add("1116809383519498241");
listPiSprintsSprints.add("");
List<PiInfo> listPiFilterPiSprints = new ArrayList<>();
listPiFilterPiSprints.add(
new PiInfo()
.withSprints(listPiSprintsSprints)
.withPiId("1116809383431417857")
);
PiFilterInfo piFilterbody = new PiFilterInfo();
piFilterbody.withPiSprints(listPiFilterPiSprints)
.withAllPi(true);
body.withPiFilter(piFilterbody);
body.withPageNo(1);
body.withPageSize(5);
body.withKeyWord("");
request.withBody(body);
try {
ShowRequirementsOverviewResponse response = client.showRequirementsOverview(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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# 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 = ShowRequirementsOverviewRequest()
request.version_id = "{version_id}"
request.project_id = "{project_id}"
listSprintsPiSprints = [
"1116809383519498241",
""
]
listPiSprintsPiFilter = [
PiInfo(
sprints=listSprintsPiSprints,
pi_id="1116809383431417857"
)
]
piFilterbody = PiFilterInfo(
pi_sprints=listPiSprintsPiFilter,
all_pi=True
)
request.body = QueryRequirementsOverviewInfo(
pi_filter=piFilterbody,
page_no=1,
page_size=5,
key_word=""
)
response = client.show_requirements_overview(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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
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.ShowRequirementsOverviewRequest{}
request.VersionId = "{version_id}"
request.ProjectId = "{project_id}"
var listSprintsPiSprints = []string{
"1116809383519498241",
"",
}
piIdPiSprints:= "1116809383431417857"
var listPiSprintsPiFilter = []model.PiInfo{
{
Sprints: &listSprintsPiSprints,
PiId: &piIdPiSprints,
},
}
allPiPiFilter:= true
piFilterbody := &model.PiFilterInfo{
PiSprints: &listPiSprintsPiFilter,
AllPi: &allPiPiFilter,
}
pageNoQueryRequirementsOverviewInfo:= int32(1)
pageSizeQueryRequirementsOverviewInfo:= int32(5)
keyWordQueryRequirementsOverviewInfo:= ""
request.Body = &model.QueryRequirementsOverviewInfo{
PiFilter: piFilterbody,
PageNo: &pageNoQueryRequirementsOverviewInfo,
PageSize: &pageSizeQueryRequirementsOverviewInfo,
KeyWord: &keyWordQueryRequirementsOverviewInfo,
}
response, err := client.ShowRequirementsOverview(request)
if err == nil {
fmt.Printf("%+v\n", response)
} else {
fmt.Println(err)
}
}
|
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
OK |
400 |
Bad Request |
401 |
Unauthorized |
404 |
Not Found |
500 |
Internal Server Error |
错误码
请参见错误码。