上传文件生成关键字和用例 - CreateTestcasesByImportFile
功能介绍
上传yaml、json等生成关键字和用例
调用方法
请参见如何调用API。
URI
POST /v1/{project_id}/testcases/import
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
project_id | 是 | String | 参数解释: 项目UUID,项目唯一标识,固定长度32位字符(字母和数字)。获取方式请参见获取项目ID 约束限制: 不涉及 取值范围: 项目uuid应符合如下规则:长度等于32位,包含大小写字母、数字 默认取值: 不涉及 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
activity_id | 是 | String | 活动唯一标识 |
algorithm_type | 是 | Integer | 算法类型 |
cloudtest_service_id | 否 | String | 测试计划服务唯一标识 |
group_name | 否 | String | 关键字目录编号 |
iterator_uri | 否 | String | 迭代uri |
请求参数
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
X-Auth-Token | 是 | String | 参数解释: 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 必传。 取值范围: 字符串长度不少于1,不超过10万。 默认取值: 不涉及。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
request | 是 | File | 文件流 |
响应参数
状态码:200
参数 | 参数类型 | 描述 |
|---|---|---|
code | String | 错误码 |
error | 统一错误返回 | |
reason | String | 失败原因 |
result | CreateTCByFileResponse object | 结果 |
status | String | 状态
|
参数 | 参数类型 | 描述 |
|---|---|---|
code | String | 错误码 |
detail | CreateTCByFileResponse object | 错误信息详情 |
reason | String | 错误原因 |
参数 | 参数类型 | 描述 |
|---|---|---|
basic_aw_list | Array of BasicAw objects | 基本的关键字列表 |
swaggerTitle | String | swagger的标题 |
testcase_list | Array of Testcase objects | 测试用例列表 |
参数 | 参数类型 | 描述 |
|---|---|---|
aw_code | String | 关键字代码, hasCode为1时有效 |
aw_description | String | 脚本模板描述信息,在用例更新时添加 |
aw_ins_list | Array of AwInstance objects | 组合关键字包含的关键字实例信息,关键字类型为2时该字段有效 |
aw_mark | Integer | 关键字标记 0-normal;1-new;2-update 3-delete |
aw_operationid | String | 接口的唯一标识 |
aw_tags | String | 接口的标签 |
aw_type | Integer | 关键字类型
|
aw_uniqueid | String | 关键字唯一标识和标签的拼接 |
by_order | Integer | 顺序 |
create_time | String | 创建时间 |
create_time_stamp | Long | 创建时间戳 |
create_time_string | String | 创建时间字符串 |
create_user | String | 创建人 |
create_user_id | String | 创建人唯一标识 |
custom_aw_libs | Array of UploadFile objects | 关键字库的文件列表 |
delete_time | String | 删除时间 |
delete_user | String | 删除人 |
description | String | 描述 |
dft_check_point_list | Array of CheckPoint objects | 默认检查点集合 |
dft_custom_header | Array of AwParam objects | 默认请求头参数对象 |
dft_retry_interval | String | 重试间隔时间 (ms) 为空表示不等待 |
dft_retry_times | String | 重试次数 |
dft_variable_list | Array of AwVariable objects | 定义的变量信息 |
extra_info | Object | 补充信息 |
group_name | String | 组名 |
has_code | Integer | 是否自带代码 0-不自带代码,该关键字依赖source字段中的源;1-自带代码 |
id | String | 唯一标识 |
import_package | Array of strings | 导入的包 |
interface_label | String | 接口的x-extend |
is_favorite | Integer | 是否是当前工程的收藏关键字,该字段不存数据库,每次获取时实时判断 |
keyword_variable_value | Array of AwVariable objects | 关键字局部变量 |
method | String | 方法 |
name | String | 名称 |
nameView | String | 关键字在页面上显示的名字 |
origin_project | String | 源工程信息,如果该关键字是从其他工程过来的(继承或者copy to local) |
output_param_list | Array of AwVariable objects | 组合关键字的输出参数信息,该字段不存数据库,实时获取 |
param_type_and_dft_value | Array of AwParam objects | 参数类型和参数默认值对应集合 |
project_id | String | 工程唯一标识 |
protocol_type | String | 协议类型 (http/dsf/other) |
public_aw_lib | PublicAwLib object | 公共关键字信息 |
public_aw_lib_id | String | 所属公共关键字库唯一标识 |
region | String | 区域名称 |
return_type | String | 返回类型 |
root_id | String | root唯一标识 |
source | String | 来源 |
special_type | Integer | 特殊AW类型
|
tmssCaseNumber | String | 关键字管理的用例编号 |
tmss_case_id | String | 关键字管理的用例唯一标识 |
update_time | String | 更新时间 |
update_time_stamp | Long | 更新时间戳 |
update_time_string | String | 更新时间字符串 |
update_user | String | 更新人 |
warningMsg | String | 警告信息 |
yamlName | String | 所属yaml文件名称,该字段不存库,用来记录从哪个yaml文件导入 |
参数 | 参数类型 | 描述 |
|---|---|---|
IsKeyWord | Integer | 是否为关键字的标识 |
IteratorCaseUri | String | 迭代用例uri |
activity_id | String | 活动唯一标识 |
addToPlan | Boolean | 加入计划 |
all_variable_names | Array of strings | 用例中可以引用的所有变量名,用于前端编写用例时提示 |
aw_instance | CaseAwInstance object | 用例和关键字实例对应关系 |
case_type | Integer | 用例类型:0商用现有类型,1从内部导过来的用例类型 |
case_variable_list | Array of AwVariable objects | 用例局部变量集合 |
changeSign | Integer | 影响标记(0:没有变更,1:发生变更) |
copyFlag | Boolean | 复制的标记 |
create_time | String | 创建时间 |
create_time_stamp | Long | 创建时间戳 |
create_time_string | String | 创建时间字符串 |
create_user | String | 创建人 |
deleteFlag | Integer | 标记数据是否被删除 0-未删除,1-删除 |
error_step | Array of integers | 错误测试阶段 |
id | String | 唯一标识 |
import_edit | Integer | 导入包名是否修改(0:未修改,1:修改) |
import_info_list | Array of strings | 导入信息集合 |
issueId | String | 问题的唯一标识 |
keyword_id | String | 关键字唯一标识 |
logic_case_id | String | 逻辑用例唯一标识 |
name | String | 名称 |
package_name | String | 包名 |
planId | String | 计划唯一标识 |
project_id | String | 工程唯一标识 |
quality_check_result | String | 检测结果 |
quality_check_time | String | 检测时间 |
region | String | 区域名称 |
releaseDev | String | 新服务新建用例版本号 |
script_name | String | 脚本名(类名) |
script_path | String | 脚本路径 |
source | String | 来源 |
status | String | 用例提交状态
|
tc_comments | String | 质量检查评论 |
tmss_case_uri | String | 测试管理用例uri |
tmss_property | TmssTestcase object | 测试管理用例属性 融合版 |
update_time | String | 更新时间 |
update_time_stamp | Long | 更新时间戳 |
update_time_string | String | 更新时间字符串 |
update_user | String | 更新人 |
user_id | String | 用户唯一标识 |
variableGroupId | String | 全局环境分组唯一标识 |
参数 | 参数类型 | 描述 |
|---|---|---|
setup_aw_list | Array of AwInstance objects | 测试用例前置步骤 |
teardown_aw_list | Array of AwInstance objects | 测试用例后置步骤 |
test_aw_list | Array of AwInstance objects | 测试步骤 |
参数 | 参数类型 | 描述 |
|---|---|---|
alias_runaw | String | 关键字内容描述字段 |
authentication_info | AuthInfo object | 认证信息 |
authentication_type | String | 认证类型,0-无认证;1-aksk认证 |
aw_description | String | 脚本模板描述信息,在用例更新时添加 |
aw_id | String | 关键字唯一标识 |
aw_type | Integer | 关键字类型
|
basic_aw | BasicAw object | 关键字 |
body_param_type | String | 关键字实例的参数body体类型
|
by_order | Integer | 顺序 |
changeSign | Integer | 变化标志 |
check_point_list | Array of CheckPoint objects | 检查点集合 |
children | Array of AwInstance objects | 关键字实例 |
condition_statement | String | 条件语句 |
condition_type | Integer | 条件类型 0-not condition;1-if begin;2-if |
create_time | String | 创建时间 |
create_time_stamp | Long | 创建时间戳 |
create_time_string | String | 创建时间字符串 |
create_user | String | 创建人 |
custom_header | Array of AwParam objects | 测试步骤自定义请求头集合;后续自定义URL请求头不再使用该字段 |
description | String | 描述 |
error_info | ErrorInfo object | 执行的错误日志内容列表 |
extra_info | ExtraInfo object | 补充信息 |
from_outside | Integer | 该关键字是否来自外部工程 0-no;1-yes |
hasLevel | Integer | 层级 |
header_array | Object | 请求头列表 |
his_script | String | 值不为null表示老的IF判断语句;值为null表示新的IF判断语句 |
id | String | 唯一标识 |
is_basic | Integer | 是否模板类型测试步骤 0:自定义URL配置类型;1:模板类型测试步骤 |
is_contract_aw | Integer | 是否是契约关键字 0-否;1-yes |
is_disabled | Integer | 是否被禁用 0-否;1-yes |
is_sectest_aw | Integer | 是否是安全测试关键字 |
level | Integer | 用例级别 |
name | String | 名称 |
param_dependent | String | 参数依赖 |
param_dependent_enabled | Integer | 是否启用参数依赖 |
param_type_and_value | Array of AwParam objects | 参数类型和参数值对应集合 |
projectId | String | 工程唯一标识 |
region | String | 区域名称 |
relation | String | 关键字唯一标识层级关系 |
relation_id | String | 层级关系唯一标识 |
relation_type | Integer | 映射类型 1-反向删除映射;2-用例自动添加的方向删除步骤 |
retry_interval | String | 重试间隔时间 (ms) 为空表示不等待 |
retry_times | String | 重试次数 |
scriptName | String | 获取脚本生成时,要使用的步骤名称 |
service_and_stage | String | 关键字所来自工程的服务名和阶段名 fromOutside为1时该值有效 |
special_type | Integer | 测试步骤来源
|
update_time | String | 更新时间 |
update_time_stamp | Long | 更新时间戳 |
update_time_string | String | 更新时间字符串 |
update_user | String | 更新人 |
user_id | String | 用户唯一标识 |
variable_list | Array of AwVariable objects | 用例局部变量 |
参数 | 参数类型 | 描述 |
|---|---|---|
awInsId | String | 所属的关键字实例的唯一标识 |
create_time | String | 创建时间 |
create_time_stamp | Long | 创建时间戳 |
create_time_string | String | 创建时间字符串 |
create_user | String | 创建人 |
current_size | Long | 当前大小 |
filePath | String | 文件路径 |
id | String | 唯一标识 |
name | String | 名称 |
originName | String | 文件的原名 |
projectId | String | 项目唯一标识 |
region | String | 区域名称 |
testcase_id | String | 测试用例的唯一标识符 |
update_time | String | 更新时间 |
update_time_stamp | Long | 更新时间戳 |
update_time_string | String | 更新时间字符串 |
update_user | String | 更新人 |
参数 | 参数类型 | 描述 |
|---|---|---|
create_time | String | 创建时间 |
create_time_stamp | Long | 创建时间戳 |
create_time_string | String | 创建时间字符串 |
create_user | String | 创建人 |
document_link | String | 文档链接 |
id | String | 唯一标识 |
name | String | 名称 |
net_area | Array of strings | 蓝区:Blue,绿区:Green,黄区:Yellow |
obs_temp_url | String | obs临时url |
product_line | String | 产品线 |
repo_branch | String | 仓库分支 |
repo_lib_path | String | 存公共关键字依赖jar包的目录 |
repo_password | String | 仓库密码 |
repo_private_key | String | 仓库密钥 |
repo_url | String | 仓库地址 |
repo_username | String | 仓库用户名 |
update_time | String | 更新时间 |
update_time_stamp | Long | 更新时间戳 |
update_time_string | String | 更新时间字符串 |
update_user | String | 更新人 |
参数 | 参数类型 | 描述 |
|---|---|---|
comparison | String | 参数解释 比较符 |
description | String | 参数解释 描述信息 |
function_arg | String | 参数解释 类型值 |
function_type | String | 参数解释 高级提取类型
|
property | String | 参数解释 属性名称 |
value | String | 参数解释 目标值 |
参数 | 参数类型 | 描述 |
|---|---|---|
error_content | String | 错误内容的描述 |
error_index | String | 错误索引的描述 |
error_point | String | 错误点的描述 |
high_light | Boolean | 是否高亮标识 |
参数 | 参数类型 | 描述 |
|---|---|---|
childImportPackage | Array of strings | 子级导入的包 |
document_link | String | 文档链接 |
http_method | String | http请求方法 |
http_url | String | HTTP请求的URL |
importPackage | Array of strings | 导入的包 |
mock | MockInfo object | 关键字实例中的mock信息 |
outputParam | Array of AwVariable objects | 输出参数 |
param_dependent | String | 参数依赖 |
summary | String | 摘要 |
参数 | 参数类型 | 描述 |
|---|---|---|
basic_value | AwParamBasicValue object | 参数解释 关键字参数基本类型取值类 |
basic_value_list | Array of AwParamBasicValue objects | 参数解释 关键字参数, valueType为1时该值有效 |
custom_body | String | 参数解释 自定义requestBody内容,inType为2且isBodyCustom为1时有效 |
defaultValue | String | 参数解释 默认值 |
description | String | 参数解释 关键字参数描述 |
disabled | Boolean | 参数解释 是否禁用,只有非必需参数才能被禁用 |
drop_down_value | String | 参数解释 用于存储下拉菜单的值 |
enum_type | String | 参数解释 枚举类型 |
enum_type_selected | String | 参数解释 当前选中的枚举类型 |
format | String | 参数解释 num和String有效 |
in_type | Integer | 参数解释 rest接口输入参数类型
|
isChecked | Boolean | 参数解释 是否是被选中参数 |
is_big_field | Boolean | 参数解释 是否是大字段参数 |
is_body_custom | Integer | 参数解释 requestBody是否自定义,inType为2时有效。0-非自定义,用原有逻辑;1-自定义body,requestBody直接使用字段customBody |
is_contract_param | Integer | 参数解释 是否是契约关键字 0-否;1-yes |
is_sensitive | Boolean | 参数解释 是否敏感参数,0 是, 1 不是 |
item | ItemParam object | 参数解释 关键字基本参数 |
maxItems | Integer | 参数解释 Array类型最大元素数 |
maxLength | Long | 参数解释 String类型最大长度 |
maximum | Object | 参数解释 Number类型最大值 |
minItems | Integer | 参数解释 Array类型最小元素数 |
minLength | Long | 参数解释 String类型最小长度 |
minimum | Object | 参数解释 Number类型最小值 |
mock | MockInfo object | 参数解释 关键字实例中的mock信息 |
name | String | 参数解释 参数名 |
object_value | Array of AwParam objects | 参数解释 valueType为2时该值有效。valueType为3时,该值用来表示数组中单个结构体 |
object_value_list | Array<Array<AwParam>> | 参数解释 valueType为3时该值有效 |
pattern | String | 参数解释 num和String有效 |
required | Boolean | 参数解释 是否必需参数 |
type | String | 参数解释 参数类型
|
validate_rule | ValidateRule object | 参数解释 校验规则 |
value_type | Integer | 参数解释 参数值类型
|
xChoiceValue | String | 参数解释 choice选择关系 |
参数 | 参数类型 | 描述 |
|---|---|---|
basic_value | AwParamBasicValue object | 参数解释 关键字参数基本类型取值类 |
defaultValue | String | 参数解释 默认值 |
enum_type | String | 参数解释 枚举类型 |
enum_type_selected | String | 参数解释 当前选中的枚举类型 |
format | String | 参数解释 num和String有效 |
is_big_field | Boolean | 参数解释 是否是大字段参数 |
maxItems | Integer | 参数解释 Array类型最大元素数 |
maxLength | Long | 参数解释 String类型最大长度 |
maximum | Object | Number类型最大值 |
minItems | Integer | 参数解释 Array类型最小元素数 |
minLength | Long | 参数解释 String类型最小长度 |
minimum | Object | 参数解释 Number类型最小值 |
pattern | String | 参数解释 num和String有效 |
type | String | 参数解释 参数类型
|
validate_rule | ValidateRule object | 参数解释 校验规则 |
value_type | Integer | 参数解释 参数值类型
|
xChoiceValue | String | 参数解释 choice选择关系 |
参数 | 参数类型 | 描述 |
|---|---|---|
dependent_info | Array of ConditionInstance objects | 参数解释 依赖信息列表 |
enabled | Boolean | 参数解释 是否启用的标识符 |
is_configDep | Boolean | 参数解释 配置依赖的标识符 |
is_dependent | Boolean | 参数解释 是否依赖的标识符 |
message | String | 参数解释 消息 |
result | String | 参数解释 结果 |
special_char | String | 参数解释 特殊字符 |
special_char_valid | String | 参数解释 特殊字符的有效性 |
x_example | String | 参数解释 示例 |
参数 | 参数类型 | 描述 |
|---|---|---|
conditionIndex | Integer | 参数解释 条件索引,用于标识当前处理的是哪个条件 |
conditionMap | Map<String,Array<String>> | 参数解释 条件映射,键为整数,值为字符串列表,用于存储各个条件的信息 |
depParamMap | Map<String,DepParamInstance> | 参数解释 依赖参数实例的映射 |
statementIndex | Integer | 参数解释 声明索引,用于标识当前处理的是哪个声明 |
参数 | 参数类型 | 描述 |
|---|---|---|
compareValue | String | 参数解释 比较值 |
comparison | String | 参数解释 比较符 |
condition | Boolean | 参数解释 条件 |
inValidValues | Array of strings | 参数解释 无效值列表 |
name | String | 参数解释 名称 |
nullInfo | String | 参数解释 空值信息 |
relationMap | Map<String,String> | 参数解释 关系映射,key为整数,value为字符串 |
relationNum | Integer | 参数解释 关系数量 |
values | Array of strings | 参数解释 值列表 |
参数 | 参数类型 | 描述 |
|---|---|---|
by_order | Integer | 参数解释 节点顺序 |
currentPermission | String | 参数解释 当前人员权限 |
description | String | 参数解释 参数描述 |
dynamicParam | String | 参数解释 动态参数名称 |
dynamicParamFlag | Boolean | 参数解释 动态参数标志,默认为false. true代表动态参数; false代表非动态参数 |
functionParams | String | 参数解释 变量参数([]:空参、[a]:一参,[a,b]:两参) |
function_arg | String | 参数解释 提取类型的类型值 |
function_type | String | 参数解释 高级提取类型,响应提取时要使用什么方法处理参数
|
isSensitiveInfo | Boolean | 参数解释 是否是敏感字段 |
isSensitiveModified | Boolean | 参数解释 敏感字段是否被修改,不敏感字段不关注此值 |
is_out_put | Boolean | 参数解释 是否是组合关键字的输出参数,只有组合关键字下awInstance的关键字变量有该字段 |
name | String | 参数解释 参数名称 |
node_id | String | 参数解释 节点id |
node_type | Integer | 参数解释
|
oldName | String | 参数解释 旧名称 |
parent_node_id | String | 参数解释 父节点唯一标识 |
property | String | 参数解释 属性 |
regex | String | 参数解释 内置函数枚举 |
sensitiveInfoSetterTime | String | 参数解释 敏感参数设置时间 |
sensitiveInfoSetterUser | String | 参数解释 敏感参数设置者名称 |
type | String | 参数解释 类型
|
variableType | Integer | 参数解释 变量类型(0:text,10-16:分别对应7个内置函数)
|
参数 | 参数类型 | 描述 |
|---|---|---|
activity_id | String | 活动唯一标识 |
applied_product | String | 应用产品 |
author | String | 创建人 |
auto_type | String | 自动化类型 |
cataId | String | 用例分类唯一标识 |
creation_date | String | 创建日期 |
custom_field_1 | String | 自定义字段1 |
custom_field_10 | String | 自定义字段10 |
custom_field_11 | String | 自定义字段11 |
custom_field_12 | String | 自定义字段12 |
custom_field_13 | String | 自定义字段13 |
custom_field_14 | String | 自定义字段14 |
custom_field_15 | String | 自定义字段15 |
custom_field_16 | String | 自定义字段16 |
custom_field_17 | String | 自定义字段17 |
custom_field_18 | String | 自定义字段18 |
custom_field_19 | String | 自定义字段19 |
custom_field_2 | String | 自定义字段2 |
custom_field_20 | String | 自定义字段20 |
custom_field_21 | String | 自定义字段21 |
custom_field_22 | String | 自定义字段22 |
custom_field_23 | String | 自定义字段23 |
custom_field_24 | String | 自定义字段24 |
custom_field_25 | String | 自定义字段25 |
custom_field_3 | String | 自定义字段3 |
custom_field_4 | String | 自定义字段4 |
custom_field_5 | String | 自定义字段5 |
custom_field_6 | String | 自定义字段6 |
custom_field_7 | String | 自定义字段7 |
custom_field_8 | String | 自定义字段8 |
custom_field_9 | String | 自定义字段9 |
description | String | 描述 |
dr_relationid | String | dr关系唯一标识 |
env_type | String | 环境类型 |
exe_platform | String | 执行平台 |
expect_output | String | 内部预期输出 |
feature_path | String | 特性路径 |
isKeyWord | Integer | 是否为关键字 |
is_contract_testcase | String | 是否为合同测试用例 |
is_paraValidator_testcase | String | 是否为参数校验测试用例 |
labelId | Array of strings | 标签唯一标识列表 |
last_modified | String | 最后修改时间 |
last_modifier | String | 最后修改人 |
last_result | String | 最后的结果 |
level | Integer | 用例级别 |
market | String | 市场 |
moduleId | String | 模块唯一标识 |
name | String | 用例名称 |
networkScriptName | String | 公共关键字和项目的关联关系 |
node_name | String | 节点名称 |
number | String | 用例编号 |
originUri | String | 原始的uri |
owner | String | 测试的所有者 |
ownerId | String | 所有者唯一标识 |
preparation | String | 测试前置条件 |
releaseDev | String | 新服务新建用例版本号 |
releaseId | String | 发布唯一标识 |
remark | String | 备注 |
stage | String | 阶段 |
steps | Array of TmssStep objects | 存储测试步骤和预期结果值对象 |
svnScriptPath | String | 脚本路径 |
tags | String | 标签 |
test_feature | String | 测试特性 |
test_step | String | 内部测试步骤 |
test_type | Integer | 测试类型 |
uri | String | 用例基线Uri(BAM 接口覆盖率迭代下用例信息获取用) |
expectOutput | String | 预期输出 |
testStep | String | 测试步骤 |
状态码:201
Created
状态码:401
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 参数解释 接口调用失败错误码 取值范围 12-18个字符组成的字符串 |
error_msg | String | 参数解释 接口调用失败错误信息 取值范围 3-1000个字符组成的字符串 |
状态码:403
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 参数解释 接口调用失败错误码 取值范围 12-18个字符组成的字符串 |
error_msg | String | 参数解释 接口调用失败错误信息 取值范围 3-1000个字符组成的字符串 |
状态码:404
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 参数解释 接口调用失败错误码 取值范围 12-18个字符组成的字符串 |
error_msg | String | 参数解释 接口调用失败错误信息 取值范围 3-1000个字符组成的字符串 |
请求示例
post https://{endpoint}/v1/5a20b8323f3548008bd6e5669567538f/testcases/import?algorithm_type-1&group_name=42d53071c88a4673842abbc58692600f&activity_id=1&cloudtest_service_id=&iterator_uri= 响应示例
状态码:200
OK
{
"status" : "success",
"result" : "success",
"reason" : null,
"error" : null,
"code" : null
} 状态码
状态码 | 描述 |
|---|---|
200 | OK |
201 | Created |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
错误码
请参见错误码。

