文档首页/ 测试计划 CodeArts TestPlan/ API参考/ API/ 自定义测试服务用例管理/ 外部系统查询用例列表 - ShowExternalTestCasesFour
更新时间:2025-12-27 GMT+08:00
分享

外部系统查询用例列表 - ShowExternalTestCasesFour

功能介绍

此接口用于外部系统查询项目下的用例列表信息,同页面 测试 -> 测试用例 -> 列表页

调用方法

请参见如何调用API

URI

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

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

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

请求参数

表2 请求Body参数

参数

是否必选

参数类型

描述

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

参数解释:

排序方式

约束限制:

不涉及

取值范围:

  • ASC,升序。

  • DESC,降序。

默认取值:

不涉及

page_number

Integer

当前页数

page_size

Integer

每页条数

associate_issue_detail

Boolean

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

响应参数

状态码:200

表3 响应Body参数

参数

参数类型

描述

data

Array of ExternalTestCaseVo objects

返回数据

total

Integer

总数

plan_case_count

Integer

迭代下用例数量

page_size

Integer

分页大小

page_number

Integer

分页编码

表4 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

参数解释:

关联缺陷信息

取值范围:

不涉及

表5 NameAndIdVo

参数

参数类型

描述

id

String

参数解释:

ID

取值范围:

不涉及

name

String

参数解释:

名称

取值范围:

不涉及

表6 IntegerIdAndNameVo

参数

参数类型

描述

id

Integer

参数解释:

数据库存储数字

取值范围:

不涉及

name

String

参数解释:

页面显示值

取值范围:

不涉及

表7 CreateInfoVo

参数

参数类型

描述

time

String

参数解释:

创建时间

取值范围:

不涉及

timestamp

Long

参数解释:

创建时间时间戳

取值范围:

不涉及

user_id

String

参数解释:

用户ID

取值范围:

不涉及

user_name

String

参数解释:

用户名称

取值范围:

不涉及

表8 ExecuteInfoVo

参数

参数类型

描述

time

String

执行开始时间

timestamp

Long

参数解释:

执行开始时间时间戳

取值范围:

不涉及

duration

String

参数解释:

执行时长

取值范围:

不涉及

user_id

String

参数解释:

用户ID

取值范围:

不涉及

user_name

String

参数解释:

用户名称

取值范围:

不涉及

execute_times

Integer

参数解释:

执行次数

取值范围:

不涉及

表9 AssociateIssueInfoVo

参数

参数类型

描述

associate

Boolean

参数解释:

是否已关联

取值范围:

不涉及

issue_id

String

参数解释:

需求ID

取值范围:

不涉及

tracker_id

String

参数解释:

需求类型

取值范围:

不涉及

board_id

String

参数解释:

工作项层级ID

取值范围:

不涉及

tracker_name

String

参数解释:

需求类型名称

取值范围:

不涉及

表10 AssociateDefectInfoVo

参数

参数类型

描述

associate

Boolean

参数解释:

需求类型名称

取值范围:

true:已关联 false:未关联

associate_count

Integer

参数解释:

关联缺陷数

取值范围:

不涉及

请求示例

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

{
  "page_size" : 1,
  "page_number" : 15
}

响应示例

状态码:200

OK

{
  "data" : [ {
    "name" : "Case006",
    "owner" : {
      "id" : ""
    },
    "status" : {
      "id" : "0",
      "name" : "新建"
    },
    "result" : { },
    "module" : {
      "id" : "",
      "name" : ""
    },
    "iteration" : { },
    "id" : "v90200010s9rmelv",
    "number" : "TC012",
    "rank_id" : "2",
    "release_dev" : "",
    "is_keyword" : false,
    "report_url" : "",
    "project_uuid" : "1b7179edc79a431f9711434124ac9f28",
    "project_id" : "3879155",
    "service_type" : {
      "id" : "0",
      "name" : "手工测试"
    },
    "test_type" : {
      "id" : 1,
      "name" : "功能性测试"
    },
    "create_info" : {
      "time" : "2025-10-20 15:10:36",
      "timestamp" : 1760944236000,
      "user_id" : "a17801c5d15f46e28112eec8a880683d",
      "user_name" : "wangluodan1"
    },
    "execute_info" : { },
    "associate_issue_info" : {
      "associate" : true,
      "issue_id" : "1185878300068290560",
      "tracker_name" : "System Feature"
    },
    "associate_defect_info" : {
      "associate" : false
    }
  }, {
    "name" : "API003",
    "owner" : {
      "id" : ""
    },
    "status" : {
      "id" : "0",
      "name" : "新建"
    },
    "result" : {
      "id" : "0",
      "name" : "成功"
    },
    "module" : {
      "id" : "",
      "name" : ""
    },
    "iteration" : { },
    "id" : "v90200010s9pk1as",
    "number" : "TC011",
    "rank_id" : "2",
    "release_dev" : "",
    "is_keyword" : false,
    "script_url" : "ApiTest/wldIPD-系统设备类1017_alpha/src/scripts/user/Case_6d60aa0ea522414ca589db5173cf33c0_2.java",
    "report_url" : "",
    "project_uuid" : "1b7179edc79a431f9711434124ac9f28",
    "project_id" : "3879155",
    "service_type" : {
      "id" : "1",
      "name" : "接口自动化"
    },
    "test_type" : {
      "id" : 1,
      "name" : "功能性测试"
    },
    "create_info" : {
      "time" : "2025-10-20 14:34:19",
      "timestamp" : 1760942059000,
      "user_id" : "a17801c5d15f46e28112eec8a880683d",
      "user_name" : "wangluodan1"
    },
    "execute_info" : {
      "time" : "2025-10-20 14:37:48",
      "timestamp" : 1760942268000,
      "duration" : "00:00:30.291",
      "user_id" : "a17801c5d15f46e28112eec8a880683d",
      "user_name" : "wangluodan1",
      "execute_times" : 3
    },
    "associate_issue_info" : {
      "associate" : false
    },
    "associate_defect_info" : {
      "associate" : false
    }
  }, {
    "name" : "功能001",
    "owner" : {
      "id" : ""
    },
    "status" : {
      "id" : "7",
      "name" : "完成"
    },
    "result" : {
      "id" : "1",
      "name" : "失败"
    },
    "module" : {
      "id" : "",
      "name" : ""
    },
    "iteration" : {
      "id" : ""
    },
    "id" : "v90200010s9p824o",
    "number" : "TC010",
    "description" : "",
    "rank_id" : "2",
    "catalog_id" : "",
    "release_dev" : "",
    "is_keyword" : false,
    "script_url" : "./Demo.py",
    "report_url" : "",
    "project_uuid" : "1b7179edc79a431f9711434124ac9f28",
    "project_id" : "3879155",
    "service_type" : {
      "id" : "7",
      "name" : "功能自动化"
    },
    "test_type" : {
      "id" : 1,
      "name" : "功能性测试"
    },
    "create_info" : {
      "time" : "2025-10-20 14:27:47",
      "timestamp" : 1760941667000,
      "user_id" : "a17801c5d15f46e28112eec8a880683d",
      "user_name" : "wangluodan1"
    },
    "execute_info" : {
      "time" : "2025-10-20 14:35:13",
      "timestamp" : 1760942113000,
      "duration" : "00:00:00.001",
      "user_id" : "a17801c5d15f46e28112eec8a880683d",
      "user_name" : "wangluodan1",
      "execute_times" : 1
    },
    "associate_issue_info" : {
      "associate" : false
    },
    "associate_defect_info" : {
      "associate" : false
    }
  }, {
    "name" : "新建测试用例",
    "owner" : {
      "id" : ""
    },
    "status" : {
      "id" : "0",
      "name" : "新建"
    },
    "result" : { },
    "module" : {
      "id" : "",
      "name" : ""
    },
    "iteration" : { },
    "id" : "v90100010s9ee7gj",
    "number" : "TC009",
    "rank_id" : "2",
    "is_keyword" : false,
    "report_url" : "",
    "project_uuid" : "1b7179edc79a431f9711434124ac9f28",
    "project_id" : "3879155",
    "service_type" : {
      "id" : "0",
      "name" : "手工测试"
    },
    "test_type" : {
      "id" : 2,
      "name" : "兼容性测试"
    },
    "create_info" : {
      "time" : "2025-10-20 11:18:55",
      "timestamp" : 1760930335000,
      "user_id" : "a17801c5d15f46e28112eec8a880683d",
      "user_name" : "wangluodan1"
    },
    "execute_info" : { },
    "associate_issue_info" : {
      "associate" : false
    },
    "associate_defect_info" : {
      "associate" : false
    }
  }, {
    "name" : "新建测试用例",
    "owner" : {
      "id" : ""
    },
    "status" : {
      "id" : "0",
      "name" : "新建"
    },
    "result" : { },
    "module" : {
      "id" : "",
      "name" : ""
    },
    "iteration" : { },
    "id" : "v90200010s9e3hnq",
    "number" : "TC008",
    "rank_id" : "2",
    "is_keyword" : false,
    "report_url" : "",
    "project_uuid" : "1b7179edc79a431f9711434124ac9f28",
    "project_id" : "3879155",
    "service_type" : {
      "id" : "0",
      "name" : "手工测试"
    },
    "test_type" : {
      "id" : 2,
      "name" : "兼容性测试"
    },
    "create_info" : {
      "time" : "2025-10-20 11:13:05",
      "timestamp" : 1760929985000,
      "user_id" : "a17801c5d15f46e28112eec8a880683d",
      "user_name" : "wangluodan1"
    },
    "execute_info" : { },
    "associate_issue_info" : {
      "associate" : false
    },
    "associate_defect_info" : {
      "associate" : false
    }
  } ],
  "total" : 49,
  "plan_case_count" : 0,
  "page_size" : 5,
  "page_number" : 1
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

相关文档