# 说明

批量创建用例,返回用例

# url

https://api.tapd.cn/api/testx/case/v1/namespaces/{namespace}/repos/{repo_uid}/versions/{version_uid}/cases/batch-create

# 支持格式

JSON

# HTTP请求方式

POST

# 请求数限制

支持批量插入

# 请求参数

# Request

字段名 必选 类型及范围 说明
Namespace string 项目命名空间
RepoUid string 仓库唯一标识
RepoVersionUid string 仓库版本唯一标识
TargetFolderUid string 目标目录
Folder repeated Folder 目录信息
Cases repeated Case 用例信息

# Folder

字段名 必选 类型及范围 说明
Uid string 唯一标识
RepoUid string 仓库唯一标识
RepoVersionUid string 仓库版本唯一标识
FolderUid string 目录唯一标识
Name string 目录名称
Owners repeated string 负责人列表
Description string 描述信息

# Case

字段名 必选 类型及范围 说明
Uid string 唯一标识
RepoUid string 仓库唯一标识
RepoVersionUid string 仓库版本唯一标识
FolderUid string 目录唯一标识
Name string 用例名称
Description string 描述信息
Priority Priority 优先级(枚举值:Unknown, P0, P1, P2, P3)
PreConditions string 前置条件
Type string 用例类型
StepType StepType 步骤类型(枚举值:STEP, TEXT)
Steps repeated CaseStep 步骤列表
StepText CaseStep 文本步骤
Attachments repeated CaseAttachment 附件列表
CustomFields repeated Property 自定义字段
Labels repeated Label 标签列表
Issues repeated Issue 关联问题列表
Owners repeated string 负责人列表
ManHourEstimated string 评估工时
RunTimes string 执行次数

# CaseStep

字段名 必选 类型及范围 说明
Content string 步骤描述
ExpectedResult string 预期结果

# CaseAttachment

字段名 必选 类型及范围 说明
Key string 附件Key
FileName string 文件名
Size uint64 文件大小

# Property

字段名 必选 类型及范围 说明
Name string 属性名称
Label string 显示值
Value google.protobuf.Value 实际值
Url string 超链接地址
flag string 属性标志

# Label

字段名 必选 类型及范围 说明
Name string 标签名称
Value string 标签值
Color string 颜色
Uneditable bool 是否可编辑
DisplayName string 前端展示名

# Issue

字段名 必选 类型及范围 说明
IssueUid string 需求唯一标识
IssueName string 需求名称
IssueUrl string 需求链接
WorkspaceUid string 工作空间唯一标识
Type Type 需求类型(枚举值:UNKNOWN, ITERATION, VERSION, STORY, TASK, BUG, TODO, PLAN)
Source Source 需求来源(枚举值:NONE, TAPD, LOCAL_WORD)

# 入参示例

    {
        "TargetFolderUid": "5077356",
        "Folders": [{
            "Name": "folder-1",
            "FolderUid": "0",
            "Folders": [{
                "Name": "folder-1-1",
                "Cases": [{
                        "ManHourEstimated": "",
                        "Labels": [],
                        "Priority": "P1",
                        "Attachments": [],
                        "Steps": [],
                        "StepType": "STEP",
                        "PreConditions": "",
                        "Description": "",
                        "Name": "folder-1-case-1"
                    },
                    {
                        "ManHourEstimated": "",
                        "Labels": [],
                        "Priority": "P1",
                        "Attachments": [],
                        "Steps": [],
                        "StepType": "STEP",
                        "PreConditions": "",
                        "Description": "",
                        "Name": "folder-1-case-2"
                    }
                ]
            }],
            "Cases": [{
                    "ManHourEstimated": "",
                    "Labels": [],
                    "Priority": "P1",
                    "Attachments": [],
                    "Steps": [],
                    "StepType": "STEP",
                    "PreConditions": "",
                    "Description": "",
                    "Name": "case-1"
                },
                {
                    "ManHourEstimated": "",
                    "Labels": [],
                    "Priority": "P1",
                    "Attachments": [],
                    "Steps": [],
                    "StepType": "STEP",
                    "PreConditions": "",
                    "Description": "",
                    "Name": "case-2"
                }
            ]
        }],
        "Cases": [{
                "ManHourEstimated": "",
                "Labels": [],
                "Priority": "P1",
                "Attachments": [],
                "Steps": [],
                "StepType": "STEP",
                "PreConditions": "",
                "Description": "",
                "Name": "case-1"
            },
            {
                "ManHourEstimated": "",
                "Labels": [],
                "Priority": "P1",
                "Attachments": [],
                "Steps": [],
                "StepType": "STEP",
                "PreConditions": "",
                "Description": "",
                "Name": "case-2"
            }
        ]
    }
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
68
69
70
71
72
73
74
75
76
77
78
79

# 返回结果

{
    "Error": null,
    "Data": {
        "Audit": {
            "Creator": "xxx",
            "Updater": "xxx",
            "CreatedAt": "2025-07-12T10:58:42+08:00",
            "UpdatedAt": "2025-07-12T10:58:42+08:00",
            "Tenant": "xx"
        },
        "Uid": "12572733",
        "RepoUid": "17099",
        "RepoVersionUid": "18167",
        "FolderUid": "12571827",
        "FullPath": "/test/",
        "UUID": "2f275e19-c053-4af9-b682-07d8c5ed13a6",
        "Name": "测试",
        "Description": "test desc",
        "Priority": "P1",
        "PreConditions": "test pre cond",
        "Type": "44907",
        "StepType": "STEP",
        "Steps": [
            {
                "Id": "16068067",
                "Content": "1",
                "ExpectedResult": "2",
                "NID": "cstp-ezyXrQVLFy"
            }
        ],
        "StepText": null,
        "Attachments": [
            {
                "Id": "xxxx",
                "Key": "/testimage.png",
                "FileName": "testimage.png",
                "Size": "223596"
            }
        ],
        "CustomFields": [
            {
                "Name": "ceshizidingyi",
                "Label": "测试自定义",
                "Value": "45297",
                "Url": "",
                "flag": ""
            }
        ],
        "Labels": [
            {
                "Name": "34456",
                "Value": "",
                "Tag": "",
                "Color": "#7ad94e",
                "Uneditable": false,
                "DisplayName": "121",
                "Module": ""
            }
        ],
        "Source": "TESTX",
        "IsManualRelation": false,
        "Issues": [
            {
                "IssueUid": "1166136271001007531",
                "Namespace": "",
                "WorkspaceUid": "66136271",
                "IssueUrl": "66136271",
                "Type": "STORY",
                "Source": "TAPD",
                "Detail": null,
                "IssueName": "",
                "IsDeleted": false,
                "Uid": ""
            }
        ],
        "Owners": [
            "734242230"
        ],
        "ManHourEstimated": "1",
        "Path": ".12571827.",
        "RunTimes": "0",
        "IsFolder": false
    }
}
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

# 测试用例字段说明

# Source

取值 含义
TESTX 来源于 CT(Continuous Testing),指持续测试

# Priority

取值 含义
Unknown 未知优先级
P0 最高优先级
P1 高优先级
P2 中优先级
P3 低优先级

# StepType

取值 含义
STEP 默认类型,即测试用例步骤为非文本类型
TEXT 文本类型,即测试用例步骤为文本类型

# IssueType

取值 含义
UNKNOWN 未知
ITERATION 迭代
VERSION 版本
STORY 需求
TASK 子任务
BUG bug

# IssueSource

取值 含义
NONE
TAPD TAPD
LOCAL_WORD word本地文
上次更新: 2025-07-22 14:18:47