文档首页/ 测试计划 CodeArts TestPlan/ API参考/ API/ 测试报表管理/ 质量报告需求测试情况统计
更新时间:2025-07-24 GMT+08:00
分享

质量报告需求测试情况统计

功能介绍

质量报告需求测试情况统计

调用方法

请参见如何调用API

URI

POST /testreport/v4/{project_id}/versions/{version_id}/requirements/overview

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释:

项目UUID,项目唯一标识,固定长度32位字符(字母和数字)。获取方式请参见获取项目ID

约束限制:

不涉及

取值范围:

项目uuid应符合如下规则:长度等于32位,包含大小写字母、数字

默认取值:

不涉及

version_id

String

参数解释

版本id

约束限制

不涉及

取值范围

11-34位字母/数字

默认取值

不涉及

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中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过滤条件

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

表4 PiFilterInfo

参数

是否必选

参数类型

描述

pi_sprints

Array of PiInfo objects

参数解释

pi迭代筛选条件

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

all_pi

Boolean

参数解释

pi下拉框全选标识

约束限制

不涉及

取值范围

全选时为true

默认取值

不涉及

表5 PiInfo

参数

是否必选

参数类型

描述

sprints

Array of strings

参数解释

迭代列表

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

pi_id

String

参数解释

pi的id

约束限制

不涉及

取值范围

层级关系:pi -> 迭代 -> 需求

默认取值

不涉及

响应参数

状态码:200

表6 响应Body参数

参数

参数类型

描述

value

RequirementsOverviewVo object

参数解释

请求返回的数据模型

取值范围

不涉及

表7 RequirementsOverviewVo

参数

参数类型

描述

total_number

Integer

参数解释

质量报告需求测试情况总数

取值范围

不涉及

requirement_overview_list

Array of RequirementOverviewVo objects

参数解释

质量报告需求测试情况列表

取值范围

不涉及

表8 RequirementOverviewVo

参数

参数类型

描述

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

参数解释

需求关联缺陷总数

取值范围

不涉及

表9 CasePassVo

参数

参数类型

描述

pass_rate

String

参数解释

需求关联用例通过率

取值范围

不涉及

result_number_list

Array of NameAndValueVo objects

参数解释

需求关联用例结果与对应的用例数目列表

取值范围

不涉及

表10 NameAndValueVo

参数

参数类型

描述

name

String

参数解释

名称

取值范围

不涉及

value

Integer

参数解释

取值范围

不涉及

表11 CaseExecuteVo

参数

参数类型

描述

execute_rate

String

参数解释

需求关联用例执行率

取值范围

不涉及

executed_number

Integer

参数解释

需求关联已执行用例总数

取值范围

不涉及

not_executed_number

Integer

参数解释

需求关联未执行用例总数

取值范围

不涉及

状态码:400

表12 响应Body参数

参数

参数类型

描述

code

String

参数解释:

业务失败的错误码

取值范围:

不涉及

reason

String

参数解释:

业务失败的提示内容

取值范围:

不涉及

状态码:401

表13 响应Body参数

参数

参数类型

描述

code

String

参数解释:

业务失败的错误码

取值范围:

不涉及

reason

String

参数解释:

业务失败的提示内容

取值范围:

不涉及

状态码:404

表14 响应Body参数

参数

参数类型

描述

code

String

参数解释:

业务失败的错误码

取值范围:

不涉及

reason

String

参数解释:

业务失败的提示内容

取值范围:

不涉及

状态码:500

表15 响应Body参数

参数

参数类型

描述

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

参数解释

质量报告看板统计返回体

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

{
  "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

参数解释

质量报告看板统计返回体

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

400

Bad Request

401

Unauthorized

404

Not Found

500

Internal Server Error

错误码

请参见错误码

相关文档