批量新建接口用例,APITest调用或者新建性能测试用例
功能介绍
批量新建接口用例
调用方法
请参见如何调用API。
URI
POST /v4/{project_id}/batch/add/automatic/testcases
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
项目UUID,项目唯一标识,固定长度32位字符(字母和数字)。获取方式请参见获取项目ID。 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
type |
否 |
String |
类型 |
|
uri |
否 |
String |
用例URI |
|
steps |
否 |
Array of TestCaseStepInfo objects |
测试步骤 |
|
name |
是 |
String |
名称 |
|
preparation |
否 |
String |
前置条件 |
|
remark |
否 |
String |
备注 |
|
number |
否 |
String |
用例编号 |
|
svn_script_path |
否 |
String |
脚本路径 |
|
feature_uri |
否 |
String |
目录Uri |
|
label_names |
否 |
Array of strings |
用例操作时,标签名列表 |
|
release_dev |
否 |
String |
测试版本号 |
|
version_uri |
否 |
String |
版本URI |
|
min_similarity |
否 |
String |
用例相似度下限(两位有效小数) |
响应参数
状态码:200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
status |
String |
success|error |
|
result |
请求的返回的数据对象 |
|
|
error |
ApiError object |
失败时的error信息 |
|
request_id |
String |
由接口调用方传入,建议使用UUID保证请求的唯一性。definitionsdefinitions |
|
server_address |
String |
本次请求的受理的服务地址 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
total |
Integer |
起始记录数 大于 实际总条数时, 值为0, 分页请求才有此值 |
|
value |
用例列表 |
|
|
reason |
String |
业务失败的提示内容 |
|
page_size |
Integer |
每页数据条数 |
|
page_no |
Integer |
页码 |
|
has_more |
Boolean |
是否还有更多 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
uri |
String |
资源URI |
|
type |
String |
资源类型 |
|
author |
String |
创建人 |
|
name |
String |
名称 |
|
rank |
Integer |
级别 |
|
last_modifier |
String |
最后修改人 |
|
last_modified |
String |
最后修改时间 |
|
last_modified_timestamp |
Long |
修改时间时间戳 |
|
last_change_time |
String |
最后变更时间 |
|
version_uri |
String |
版本URI |
|
origin_uri |
String |
源资源URI |
|
parent_uri |
String |
父资源URI |
|
parent_path |
String |
父资源路径 |
|
creation_version_uri |
String |
创建版本URI |
|
creation_date |
String |
创建时间 |
|
creation_date_timestamp |
Long |
创建时间时间戳 |
|
author_name |
String |
创建人名称 |
|
comment |
String |
备注 |
|
number |
String |
编号 |
|
success_list |
Array of TestCaseVo objects |
创建成功的用例列表 |
|
failed_list |
Array of TestCaseInfo objects |
创建失败的用例列表 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
uri |
String |
资源URI |
|
type |
String |
资源类型 |
|
author |
String |
创建人 |
|
name |
String |
名称 |
|
rank |
Integer |
级别 |
|
preparation |
String |
前置条件 |
|
remark |
String |
备注 |
|
stage |
String |
测试阶段 |
|
activity |
String |
测试类型 |
|
keywords |
String |
关键词 |
|
market |
String |
apitest标记是否代码已提交 |
|
designer |
String |
设计者 |
|
tags |
String |
标签 |
|
execute_parameter |
String |
执行参数 |
|
region |
String |
逻辑region |
|
owner |
String |
处理人 |
|
version_uri |
String |
版本URI |
|
origin_uri |
String |
源资源URI |
|
parent_uri |
String |
父资源URI |
|
parent_path |
String |
父资源路径 |
|
creation_version_uri |
String |
创建版本URI |
|
last_modifier |
String |
最后修改人 |
|
last_modified |
String |
最后修改时间 |
|
last_change_time |
String |
最后变更时间 |
|
creation_date |
String |
创建时间 |
|
author_id |
String |
创建人ID |
|
comment |
String |
备注 |
|
number |
String |
开发分支名称 |
|
case_type |
Integer |
用例类型 |
|
platform_type |
Integer |
执行平台类型 |
|
service_type |
Integer |
服务类型 |
|
test_type |
Integer |
测试类型 |
|
design_note |
String |
设计描述 |
|
test_step |
String |
测试步骤 |
|
expect_output |
String |
期望结果 |
|
env_type |
String |
测试环境类型 |
|
exe_platform |
String |
执行平台 |
|
testcase_project |
String |
测试工程 |
|
svn_script_path |
String |
脚本路径 |
|
map_restrict |
String |
约束条件 |
|
network_script_name |
String |
网络脚本名 |
|
auto_type |
Integer |
自动化类型 |
|
to_be_auto_exec |
Integer |
被自动化执行 |
|
last_result |
String |
最后一次结果 |
|
last_result_uri |
String |
最后一次结果Uri |
|
feature_uri |
String |
目录Uri |
|
interface_name |
String |
测试接口名 |
|
snp_no |
String |
网络问题ID |
|
dr_relation_id |
String |
关联需求编号 |
|
test_base_num |
String |
测试基数 |
|
automatically_executed |
Integer |
是否被自动化执行 |
|
first_execute_time |
String |
第一次执行时间 |
|
detect_type |
String |
检测类型 |
|
execute_param |
String |
执行参数 |
|
test_feature |
String |
分析领域 |
|
is_contract_testcase |
Integer |
是否是契约用例 |
|
time_cost |
Double |
总共耗时 |
|
custom_field_1 |
String |
自定义字段1 |
|
custom_field_2 |
String |
自定义字段2 |
|
custom_field_3 |
String |
自定义字段3 |
|
custom_field_4 |
String |
自定义字段4 |
|
be_auto_type_time |
String |
记录用例由非自动化变为自动化类型的时间 |
|
compare_number |
String |
配对用例编号 |
|
scene_flag |
String |
场景标识 |
|
base_flag |
String |
场景标识 |
|
para_validator |
String |
区别是否从yaml中生成的用例,默认false |
|
knet_node_id |
String |
knet节点id |
|
last_exe_author |
String |
最后一次执行用户 |
|
cloud_carrier |
String |
运营商 |
|
market_place |
String |
应用市场 |
|
test_mind_id |
String |
脑图id |
|
test_mind_url |
String |
脑图url |
|
commit_url |
String |
git提交url |
|
test_pattern_number |
String |
测试模式编号 |
|
test_factor_number |
String |
测试因子编号 |
|
status_code |
String |
状态Code |
|
result_code |
String |
结果Code |
|
release_id |
String |
迭代ID |
|
label_id |
String |
标签ID |
|
module_id |
String |
模块ID |
|
execute_latest_time |
String |
最后执行时间 |
|
execute_duration |
String |
执行时长 |
|
execute_times |
Integer |
执行次数 |
|
is_keyword |
Integer |
是否关键用例 |
|
release_dev |
String |
测试版本号 |
|
new_created |
String |
是否用户新增用例 |
|
project_id |
String |
项目UUID,项目唯一标识,固定长度32位字符(字母和数字)。获取方式请参见获取项目ID |
|
creation_version_name |
String |
创建版本名称 |
|
feature_path |
String |
特性路径 |
|
issue_id |
String |
工作项id |
|
issue_tracker_id |
String |
工作项类型id |
|
issue_assign_status |
String |
工作项分配状态 |
|
issue_name |
String |
工作项名称 |
|
issue_design_owner |
String |
工作项设计责任人 |
|
issue_design_owner_d |
String |
工作项设计责任人id |
|
tracker_name |
String |
工作项类型名称 |
|
defect_list |
Array of BaseNameAndId objects |
缺陷列表 |
|
result_name |
String |
结果名称 |
|
status_name |
String |
状态名称 |
|
module_name |
String |
模块名称 |
|
module_name_path |
String |
模块路径名称 |
|
module_id_path |
String |
模块路径id |
|
version_name |
String |
版本名称 |
|
resultCount |
Integer |
结果数量 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
type |
String |
类型 |
|
uri |
String |
用例URI |
|
steps |
Array of TestCaseStepInfo objects |
测试步骤 |
|
name |
String |
名称 |
|
preparation |
String |
前置条件 |
|
remark |
String |
备注 |
|
number |
String |
用例编号 |
|
svn_script_path |
String |
脚本路径 |
|
feature_uri |
String |
目录Uri |
|
label_names |
Array of strings |
用例操作时,标签名列表 |
|
release_dev |
String |
测试版本号 |
|
version_uri |
String |
版本URI |
|
min_similarity |
String |
用例相似度下限(两位有效小数) |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
test_step |
String |
测试步骤 |
|
expect_result |
String |
预期结果 |
|
step_actual |
String |
步骤的实际结果 |
|
step_result |
String |
步骤结果 |
状态码:400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
参数解释 接口调用失败错误码 取值范围 不涉及 |
|
error_msg |
String |
参数解释 接口调用失败错误信息 取值范围 不涉及 |
状态码:401
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
参数解释 接口调用失败错误码 取值范围 不涉及 |
|
error_msg |
String |
参数解释 接口调用失败错误信息 取值范围 不涉及 |
状态码:404
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
参数解释 接口调用失败错误码 取值范围 不涉及 |
|
error_msg |
String |
参数解释 接口调用失败错误信息 取值范围 不涉及 |
状态码:500
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
参数解释 接口调用失败错误码 取值范围 不涉及 |
|
error_msg |
String |
参数解释 接口调用失败错误信息 取值范围 不涉及 |
请求示例
post https://{endpoint}/v4/a5eb0d410ea341a192f7c12483568985}/batch/add/automatic/testcases
{
"type" : "string",
"uri" : "001s16gt6q5",
"steps" : [ { } ],
"name" : "用例",
"preparation" : "拥有测试权限",
"remark" : "3",
"number" : "用例编号:-Copy-bbe028df",
"svn_script_path" : "ApiTest/Test(API)_Alpha/src/scripts/user/script.java",
"feature_uri" : "004sobn0n0t1",
"label_names" : [ "46a5dbfd770f445da87b1a50ee37a86b" ],
"release_dev" : "fd89a8d9dce64c54ade3d7fc9d6cd2dd",
"version_uri" : "001s16gt68e",
"min_similarity" : "0.95"
}
响应示例
状态码:200
OK
{
"status" : "success",
"result" : {
"total" : 1,
"value" : {
"uri" : "001s16gt6q5",
"type" : "TestVersion",
"author" : "efdb403066474ab08836b9eeaaa23bca",
"name" : "名称",
"rank" : 1,
"last_modifier" : "efdb403066474ab08836b9eeaaa23bca",
"last_modified" : "2025-06-19T07:33:31.819Z",
"last_modified_timestamp" : 1660617231016,
"last_change_time" : "2025-06-19T07:33:31.819Z",
"version_uri" : "001s16gt68e",
"origin_uri" : "001rv5i9u14",
"parent_uri" : "001s16gt68e",
"parent_path" : "/b6c4288728234a2e804b6df9465d7b5b/001s16gt68e",
"creation_version_uri" : "001s16gt68e",
"creation_date" : "2025-06-19T07:33:31.819Z",
"creation_date_timestamp" : 1660617231016,
"author_name" : "tester",
"comment" : "备注",
"number" : "编号",
"success_list" : [ ],
"failed_list" : [ ]
}
}
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
OK |
|
400 |
Bad Request |
|
401 |
Unauthorized |
|
404 |
Not Found |
|
500 |
Internal Server Error |
错误码
请参见错误码。