
# 质量报告需求测试情况统计 - ShowRequirementsOverview
#### 功能介绍
此接口用于查看质量报告需求测试情况统计,同页面 测试 -\> 测试质量看板 -\> 右侧需求测试情况 -\> 下方统计列表
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-testman/cloudtest_03_2000.html)。
#### URI
POST /testreport/v5/{project_id}/versions/{version_id}/requirements/overview
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|:---|
| project_id | 是    | String | **参数解释**: 项目UUID，项目唯一标识，固定长度32位字符（字母和数字）。获取方式请参见[获取项目ID](https://support.huaweicloud.com/api-testman/cloudtest_03_4003.html) **约束限制**: 字符串类型，长度32位字符 **取值范围**: 项目uuid应符合如下规则：长度等于32位，包含大小写字母、数字 **默认取值**: 不涉及                                                                                          |
| version_id | 是    | String | **参数解释** 版本id **约束限制** 不涉及 **取值范围** 11-34位字母/数字 **默认取值** 不涉及 **获取方法**： 从GET /v4/projects/{project_id}/iterator-infos的返回字段获取 从GET /v1/{project_id}/branches 的返回字段获取 |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | **参数解释：** 用户Token。 通过调用IAM服务[获取用户Token](https://support.huaweicloud.com/api-iam/iam_30_0001.html)接口获取（响应消息头中X-Subject-Token的值）。 **约束限制：** 必传。 **取值范围：** 字符串长度不少于1，不超过10万。 **默认取值：** 不涉及。 |
   
表3请求Body参数 
| 参数               | 是否必选 | 参数类型                                                                   | 描述                                                                                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|:---|
| fixed_version_id | 否    | String                                                                 | **参数解释** 筛选迭代ID **约束限制** 不涉及 **取值范围** 不涉及 **默认取值** 不涉及 |
| module_id        | 否    | String                                                                 | **参数解释** 模块ID **约束限制** 不涉及 **取值范围** 不涉及 **默认取值** 不涉及   |
| key_word         | 否    | String                                                                 | **参数解释** 关键字 **约束限制** 不涉及 **取值范围** 不涉及 **默认取值** 不涉及    |
| page_size        | 否    | Integer                                                                | **参数解释** 每页数量 **约束限制** 不涉及 **取值范围** 不涉及 **默认取值** 不涉及   |
| page_no          | 否    | Integer                                                                | **参数解释** 页码 **约束限制** 不涉及 **取值范围** 不涉及 **默认取值** 不涉及     |
| pi_filter        | 否    | [PiFilterInfo] object | **参数解释** pi过滤条件 **约束限制** 不涉及 **取值范围** 不涉及 **默认取值** 不涉及 |
   
 表4PiFilterInfo 
| 参数         | 是否必选 | 参数类型                                                                 | 描述                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| pi_sprints | 否    | Array of [PiInfo] objects | **参数解释** pi迭代筛选条件 **约束限制** 不涉及 **取值范围** 不涉及 **默认取值** 不涉及       |
| all_pi     | 否    | Boolean                                                              | **参数解释** pi下拉框全选标识 **约束限制** 不涉及 **取值范围** 全选时为true **默认取值** 不涉及 |
   
 表5PiInfo 
| 参数      | 是否必选 | 参数类型             | 描述                                                                                                                                                                                                                                                                                                                                                                                          |
|:---|:---|:---|:---|
| sprints | 否    | Array of strings | **参数解释** 迭代列表 **约束限制** 不涉及 **取值范围** 不涉及 **默认取值** 不涉及                    |
| pi_id   | 否    | String           | **参数解释** pi的id **约束限制** 不涉及 **取值范围** 层级关系：pi -\> 迭代 -\> 需求 **默认取值** 不涉及 |
   
#### 响应参数
**状态码：200**
表6响应Body参数 
| 参数               | 参数类型                                                                                        | 描述                                                                         |
|:---|:---|:---|
| is_async_operate | Boolean                                                                                     | 是否异步.固定为true:需要在调异步进度接口(/v4/testhub/progress/{operation_uri})获取此次请求的最终处理结果 |
| async_uri        | String                                                                                      | 异步进度uri,需要在调异步进度接口(/v4/testhub/progress/{operation_uri}获取此次请求的最终处理结果       |
| return_value     | [RequirementsOverviewVo] object | 请求最终返回的数据,需要调用查询异步进度接口(/v4/testhub/progress/{operation_uri})查询             |
   
 表7RequirementsOverviewVo 
| 参数                        | 参数类型                                                                                                | 描述                                                                                                                                                                     |
|:---|:---|:---|
| total_number              | Integer                                                                                             | **参数解释** 质量报告需求测试情况总数 **取值范围** 不涉及 |
| requirement_overview_list | Array of [RequirementOverviewVo] objects | **参数解释** 质量报告需求测试情况列表 **取值范围** 不涉及 |
   
 表8RequirementOverviewVo 
| 参数                   | 参数类型                                                                      | 描述                                                                                                                                                                 |
|:---|:---|:---|
| 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                                                                   | **参数解释** 需求关联缺陷总数 **取值范围** 不涉及 |
   
 表9CasePassVo 
| 参数                 | 参数类型                                                                                  | 描述                                                                                                                                                                           |
|:---|:---|:---|
| pass_rate          | String                                                                                | **参数解释** 需求关联用例通过率 **取值范围** 不涉及          |
| result_number_list | Array of [NameAndValueVo] objects | **参数解释** 需求关联用例结果与对应的用例数目列表 **取值范围** 不涉及 |
   
 表10NameAndValueVo 
| 参数       | 参数类型                                                                      | 描述                                                                                                                                                           |
|:---|:---|:---|
| name     | String                                                                    | **参数解释** 名称 **取值范围** 不涉及 |
| value    | Integer                                                                   | **参数解释** 值 **取值范围** 无    |
| children | Array of [children] objects | 子节点                                                                                                                                                          |
   
 表11children 
| 参数        | 参数类型    | 描述                |
|:---|:---|:---|
| name      | String  | 名称                |
| value     | Integer | 值                 |
| tag_value | Integer | 标记值，补充字段，区分与value |
   
 表12CaseExecuteVo 
| 参数                  | 参数类型    | 描述                                                                                                                                                                    |
|:---|:---|:---|
| execute_rate        | String  | **参数解释** 需求关联用例执行率 **取值范围** 不涉及   |
| executed_number     | Integer | **参数解释** 需求关联已执行用例总数 **取值范围** 不涉及 |
| not_executed_number | Integer | **参数解释** 需求关联未执行用例总数 **取值范围** 不涉及 |
   
**状态码：400**
表13响应Body参数 
| 参数     | 参数类型   | 描述                                                                                                                                                                    |
|:---|:---|:---|
| code   | String | **参数解释**: 业务失败的错误码 **取值范围**: 不涉及  |
| reason | String | **参数解释**: 业务失败的提示内容 **取值范围**: 不涉及 |
   
**状态码：401**
表14响应Body参数 
| 参数     | 参数类型   | 描述                                                                                                                                                                    |
|:---|:---|:---|
| code   | String | **参数解释**: 业务失败的错误码 **取值范围**: 不涉及  |
| reason | String | **参数解释**: 业务失败的提示内容 **取值范围**: 不涉及 |
   
**状态码：404**
表15响应Body参数 
| 参数     | 参数类型   | 描述                                                                                                                                                                    |
|:---|:---|:---|
| code   | String | **参数解释**: 业务失败的错误码 **取值范围**: 不涉及  |
| reason | String | **参数解释**: 业务失败的提示内容 **取值范围**: 不涉及 |
   
**状态码：500**
表16响应Body参数 
| 参数     | 参数类型   | 描述                                                                                                                                                                    |
|:---|:---|:---|
| code   | String | **参数解释**: 业务失败的错误码 **取值范围**: 不涉及  |
| reason | String | **参数解释**: 业务失败的提示内容 **取值范围**: 不涉及 |
   
#### 请求示例
```
POST https://{endpoint}/testreport/v5/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
```
{
  "is_async_operate" : true,
  "async_uri" : "0c897311d2884e0fa68c2ab7ac88674dv93600010u9q98br"
}
```
#### SDK代码示例
SDK代码示例如下。
#### Java
```
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
```
# 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
```
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, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        SafeBuild()
    if err != nil {
        fmt.Println(err)
        return
    }
    hcClient, err := cloudtest.CloudtestClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()
    if err != nil {
        fmt.Println(err)
        return
    }
    client := cloudtest.NewCloudtestClient(hcClient)
    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](https://console.huaweicloud.com/apiexplorer/#/openapi/CloudTest/sdk?api=ShowRequirementsOverview)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述                    |
|:---|:---|
| 200 | OK                    |
| 400 | Bad Request           |
| 401 | Unauthorized          |
| 404 | Not Found             |
| 500 | Internal Server Error |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-testman/ErrorCode.html)。
