更新时间:2025-07-25 GMT+08:00
分享

外部系统查询用例列表

功能介绍

外部系统查询用例列表

调用方法

请参见如何调用API

URI

POST /v4/testhub/projects/{project_id}/testcases/batch-query

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

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

请求参数

表2 请求Body参数

参数

是否必选

参数类型

描述

offset

Integer

当前页数

limit

Integer

每页限制

useOffset

Boolean

是否使用偏移量

plan_id

String

分支/测试计划ID

case_ids

Array of strings

用例URI集合

owner_ids

Array of strings

处理者ID集合

status_ids

Array of strings

状态Code集合

rank_ids

Array of strings

用例等级ID集合

module_ids

Array of strings

模块ID集合

issue_id

String

需求编号

creator_ids

Array of strings

创建者ID集合

result_ids

Array of strings

结果Code集合

iteration_ids

Array of strings

归属迭代ID集合

start_time

String

创建开始时间

end_time

String

创建结束时间

associate_issue

Boolean

是否关联需求(null:不限,false:未关联,true:已关联)

associated_defects

Boolean

是否关联缺陷(null:不限,false:未关联,true:已关联)

show_children

Boolean

是否查询子需求关联的用例,默认true

label_ids

Array of strings

标签ID集合

execute_start_time

String

执行开始时间

execute_end_time

String

执行结束时间

executor_ids

Array of strings

执行者ID集合

is_keyword

Boolean

是否组合关键字

issue_tree_search

Boolean

是否是需求树点击的查询关联用例

service_id

Integer

服务类型

stage_type

Integer

阶段过程(2:测试设计,3:测试执行,4:质量报告)

cata_id

String

目录ID

subject

String

关键字查询,用例名或编号

sort_field

String

排序字段

sort_type

String

排序方式

page_number

Integer

当前页数

page_size

Integer

每页条数

associate_issue_detail

Boolean

是否返回需求具体信息(返回需求名称,需求id)

响应参数

状态码:200

表3 响应Body参数

参数

参数类型

描述

status

String

success|error

error

ApiError object

失败时的error信息

request_id

String

由接口调用方传入,建议使用UUID保证请求的唯一性。

server_address

String

本次请求的受理的服务地址

result

ExternalTestCaseListVo object

用例列表

表4 ApiError

参数

参数类型

描述

code

String

参数解释

错误编码

取值范围

不涉及

reason

String

参数解释

业务失败的提示内容

取值范围

不涉及

表5 ExternalTestCaseListVo

参数

参数类型

描述

value

Array of ExternalTestCaseVo objects

返回的数据

total

Integer

总数

plan_case_count

Integer

计划用例数

page_size

Integer

分页大小

page_no

Integer

分页数

表6 ExternalTestCaseVo

参数

参数类型

描述

name

String

参数解释:

用例名称

取值范围:

不涉及

owner

NameAndIdVo object

参数解释:

处理者信息

取值范围:

不涉及

status

NameAndIdVo object

参数解释:

状态信息

取值范围:

不涉及

result

NameAndIdVo object

参数解释:

结果信息

取值范围:

不涉及

module

NameAndIdVo object

参数解释:

模块信息

取值范围:

不涉及

iteration

NameAndIdVo object

参数解释:

迭代信息

取值范围:

不涉及

id

String

参数解释:

用例ID

取值范围:

不涉及

number

String

参数解释:

用例编号

取值范围:

不涉及

description

String

参数解释:

用例描述

取值范围:

不涉及

rank_id

String

参数解释:

用例等级

取值范围:

不涉及

project_id

String

参数解释:

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

取值范围:

不涉及

execution_type

NameAndIdVo object

参数解释:

用例测试执行类型

取值范围:

不涉及

test_type

IntegerIdAndNameVo object

参数解释:

测试类型信息

取值范围:

不涉及

create_info

CreateInfoVo object

参数解释:

创建信息

取值范围:

不涉及

execute_info

ExecuteInfoVo object

参数解释:

执行信息

取值范围:

不涉及

associate_issue_info

AssociateIssueInfoVo object

参数解释:

关联需求信息

取值范围:

不涉及

associate_defect_info

AssociateDefectInfoVo object

参数解释:

关联缺陷信息

取值范围:

不涉及

表7 NameAndIdVo

参数

参数类型

描述

id

String

参数解释:

ID

取值范围:

不涉及

name

String

参数解释:

名称

取值范围:

不涉及

表8 IntegerIdAndNameVo

参数

参数类型

描述

id

Integer

参数解释:

数据库存储数字

取值范围:

不涉及

name

String

参数解释:

页面显示值

取值范围:

不涉及

表9 CreateInfoVo

参数

参数类型

描述

time

String

参数解释:

创建时间

取值范围:

不涉及

timestamp

Long

参数解释:

创建时间时间戳

取值范围:

不涉及

user_id

String

参数解释:

用户ID

取值范围:

不涉及

user_name

String

参数解释:

用户名称

取值范围:

不涉及

表10 ExecuteInfoVo

参数

参数类型

描述

time

String

执行开始时间

timestamp

Long

参数解释:

执行开始时间时间戳

取值范围:

不涉及

duration

String

参数解释:

执行时长

取值范围:

不涉及

user_id

String

参数解释:

用户ID

取值范围:

不涉及

user_name

String

参数解释:

用户名称

取值范围:

不涉及

execute_times

Integer

参数解释:

执行次数

取值范围:

不涉及

表11 AssociateIssueInfoVo

参数

参数类型

描述

associate

Boolean

参数解释:

是否已关联

取值范围:

不涉及

issue_id

String

参数解释:

需求ID

取值范围:

不涉及

tracker_id

String

参数解释:

需求类型

取值范围:

不涉及

board_id

String

参数解释:

工作项层级ID

取值范围:

不涉及

tracker_name

String

参数解释:

需求类型名称

取值范围:

不涉及

表12 AssociateDefectInfoVo

参数

参数类型

描述

associate

Boolean

参数解释:

需求类型名称

取值范围:

true:已关联 false:未关联

associate_count

Integer

参数解释:

关联缺陷数

取值范围:

不涉及

请求示例

post https://{endpoint}/v4/testhub/projects/a5eb0d410ea341a192f7c12483568985/testcases/batch-query

{
  "page_size" : 15,
  "stage_type" : "3"
}

响应示例

状态码:200

OK

{
  "status" : "success",
  "result" : {
    "total" : 105,
    "value" : [ {
      "uri" : "v80b00010i5dji80",
      "name" : "测试用例3",
      "owner" : { },
      "status" : {
        "id" : "7",
        "name" : "完成"
      },
      "result" : {
        "id" : "0",
        "name" : "成功"
      },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "106",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 0
      },
      "create_info" : {
        "time" : "2025-06-16 15:10:25",
        "timestamp" : 1750057825000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : {
        "time" : "2025-06-19 15:08:16",
        "timestamp" : 1750316896000,
        "duration" : "00:00:00.000",
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02",
        "execute_times" : 1
      },
      "associate_issue_info" : {
        "associate" : true,
        "issue_id" : "1429920",
        "tracker_name" : "Story"
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1750316896000,
      "review_status" : 0
    }, {
      "uri" : "v80b00010i5daue9",
      "name" : "测试用例3",
      "owner" : { },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "105",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 0
      },
      "create_info" : {
        "time" : "2025-06-16 15:05:42",
        "timestamp" : 1750057542000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1750057542000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6s28s",
      "name" : "90",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "41986",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:31",
        "timestamp" : 1749631051000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631051000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6s28t",
      "name" : "91",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "41985",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:31",
        "timestamp" : 1749631051000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631051000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6s28u",
      "name" : "92",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "41984",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:31",
        "timestamp" : 1749631051000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631051000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6s28v",
      "name" : "93",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "41983",
      "rank_id" : "2",
      "release_dev" : "null",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:31",
        "timestamp" : 1749631051000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1750162882000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6s290",
      "name" : "94",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "41982",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:31",
        "timestamp" : 1749631051000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631051000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6s291",
      "name" : "95",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "41981",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:31",
        "timestamp" : 1749631051000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631051000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6s292",
      "name" : "96",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "41980",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:31",
        "timestamp" : 1749631051000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631051000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6s293",
      "name" : "97",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "41979",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:31",
        "timestamp" : 1749631051000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631051000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6s294",
      "name" : "98",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "41978",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:31",
        "timestamp" : 1749631051000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631051000,
      "review_status" : 0
    }, {
      "uri" : "v90300010homjd6o",
      "name" : "1",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "42075",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:30",
        "timestamp" : 1749631050000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631050000,
      "review_status" : 0
    }, {
      "uri" : "v90300010homjd6q",
      "name" : "2",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "42074",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:30",
        "timestamp" : 1749631050000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631050000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6q26a",
      "name" : "3",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "42073",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:30",
        "timestamp" : 1749631050000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631050000,
      "review_status" : 0
    }, {
      "uri" : "v90310homjd6q26b",
      "name" : "4",
      "owner" : {
        "id" : ""
      },
      "status" : {
        "id" : "0",
        "name" : "新建"
      },
      "result" : { },
      "module" : {
        "id" : "",
        "name" : ""
      },
      "iteration" : { },
      "number" : "42072",
      "rank_id" : "2",
      "is_keyword" : false,
      "report_url" : "",
      "project_uuid" : "a5eb0d410ea341a192f7c12483568985",
      "service_type" : {
        "id" : "0",
        "name" : "手工测试"
      },
      "test_type" : {
        "id" : 1,
        "name" : "功能性测试"
      },
      "create_info" : {
        "time" : "2025-06-11 16:37:30",
        "timestamp" : 1749631050000,
        "user_id" : "fe2b1b7779a447ee9b650ecc43a18c81",
        "user_name" : "TMSS02"
      },
      "execute_info" : { },
      "associate_issue_info" : {
        "associate" : false
      },
      "associate_defect_info" : {
        "associate" : false
      },
      "case_type" : 0,
      "labels" : [ ],
      "is_test_design" : false,
      "last_modified" : 1749631050000,
      "review_status" : 0
    } ],
    "page_size" : 15,
    "page_no" : 1
  }
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

相关文档