“uip tm objectlabel”的语法和选项,用于管理附加到 Test Manager 对象的标签,例如测试用例和需求。
uip tm objectlabel 管理附加到 Test Manager 对象(需求、测试用例、测试集、测试执行和测试用例日志)的标签。标签是自由格式字符串,用于对对象进行标记和分组,以便进行筛选和搜索。
该组中的每个动词(包括get都需要--project-key和--object-type 。--object-ids 和 --labels 为复数形式,并始终以空格分隔;单数形式 --object-id 和 --label 不存在。
大纲
uip tm objectlabel list --project-key <key> --object-type <type> [--object-ids <uuid...>] [--label-types <types...>] [--filter <text>] [--sort-by <expr>] [--limit <n>] [--offset <n>]
uip tm objectlabel get --project-key <key> --object-type <type> --label-id <uuid>
uip tm objectlabel add --project-key <key> --object-type <type> --object-ids <uuid...> --labels <name...> [--label-type <type>] [--remove-other-labels]
uip tm objectlabel remove --project-key <key> --object-type <type> --object-ids <uuid...> (--labels <name...> | --remove-all-labels) [-y]
uip tm objectlabel list --project-key <key> --object-type <type> [--object-ids <uuid...>] [--label-types <types...>] [--filter <text>] [--sort-by <expr>] [--limit <n>] [--offset <n>]
uip tm objectlabel get --project-key <key> --object-type <type> --label-id <uuid>
uip tm objectlabel add --project-key <key> --object-type <type> --object-ids <uuid...> --labels <name...> [--label-type <type>] [--remove-other-labels]
uip tm objectlabel remove --project-key <key> --object-type <type> --object-ids <uuid...> (--labels <name...> | --remove-all-labels) [-y]
--object-type 接受 Requirement、TestCase、TestSet、TestExecution 或 TestCaseLog。--label-type/--label-types 接受连线形式的值 userLabel、systemLabel 和 internalLabel — 不接受此 CLI 其他位置中使用的帕斯卡拼写法形式。
UIP TM 对象标签列表
列出用于一种对象类型(已分页)的不同标签名称。这不会返回标签分配的行 — 对于单个行的详细信息,请使用 get。
参数
无。
选项
--project-key <key>(必填) — 拥有项目。--object-type <type>(必填) — 要为其列出标签的对象类型。--object-ids <uuid...>— 限制为分配给这些对象的标签(用空格分隔)。省略在整个对象类型中的搜索。--label-types <type...>— 按标签类型筛选(userLabel、systemLabel、internalLabel,以空格分隔)。默认为userLabel+systemLabel。--filter <text>— 匹配标签名称依据的前缀(服务器端StartsWith,而非常规子字符串搜索)。--sort-by <expr>— 排序表达式,例如name asc。--limit <n>— 页面大小。默认为50。--offset <n>— 要跳过的结果。默认为0。
示例
uip tm objectlabel list \
--project-key DEMO \
--object-type TestCase \
--filter smo \
--limit 50
uip tm objectlabel list \
--project-key DEMO \
--object-type TestCase \
--filter smo \
--limit 50
数据形状
{
"Code": "ObjectLabelsList",
"Data": [
{ "Name": "smoke" },
{ "Name": "smoke-test" }
]
}
{
"Code": "ObjectLabelsList",
"Data": [
{ "Name": "smoke" },
{ "Name": "smoke-test" }
]
}
每行只有{ "Name": "<label>" } — 不会返回Id ObjectId、 或LabelType list。要获取特定分配行的完整详细信息(包括其 Id),请使用 objectlabel get。
uip tm 对象标签获取
通过分配 UUID 获取单个标签分配行。
参数
无。
选项
--project-key <key>(必填) — 拥有项目。--object-type <type>(必填项) — 标签所属的对象类型。--label-id <uuid>(必填) — 标签分配行的 UUID。这是分配记录 UUID,不是标签名称。
示例
uip tm objectlabel get \
--project-key DEMO \
--object-type TestCase \
--label-id a1b2c3d4-0000-0000-0000-000000000001
uip tm objectlabel get \
--project-key DEMO \
--object-type TestCase \
--label-id a1b2c3d4-0000-0000-0000-000000000001
数据形状
{
"Code": "ObjectLabelGet",
"Data": {
"Id": "a1b2c3d4-0000-0000-0000-000000000001",
"ProjectId": "p1",
"ObjectId": "f9e8d7c6-0000-0000-0000-000000000001",
"ObjectType": "TestCase",
"Name": "smoke",
"Description": "",
"LabelType": "UserLabel"
}
}
{
"Code": "ObjectLabelGet",
"Data": {
"Id": "a1b2c3d4-0000-0000-0000-000000000001",
"ProjectId": "p1",
"ObjectId": "f9e8d7c6-0000-0000-0000-000000000001",
"ObjectType": "TestCase",
"Name": "smoke",
"Description": "",
"LabelType": "UserLabel"
}
}
此响应中的 LabelType 为帕斯卡命名法(UserLabel, SystemLabel, InternalLabel),即使 --label-type/--label-types 输入标志采用驼峰式命名法连接形式。
uip tm 对象标签添加
为一个或多个对象添加标签。两种不同的行为,具体取决于是否传递 --label-type:
- 没有
--label-type(默认):在所有对象和标签上调用一次批量添加。传递--remove-other-labels可使其成为授权标签集,添加后,这些对象上任何--labels中没有的非系统标签都将被删除。 - 使用
--label-type:单独分配每个标签(循环每个对象 × 标签对),因此可以记录特定的标签类型。在此模式下,--remove-other-labels将被忽略。
参数
无。
选项
--project-key <key>(必填) — 拥有项目。--object-type <type>(必填) — 对象类型。--object-ids <uuid...>(必填) — 要应用标签的对象 UUID,以空格分隔。--labels <name...>(必填) — 要添加的以空格分隔的标签名称。--label-type <type>— 标签类型(userLabel、systemLabel、internalLabel)。设置后,会切换到上述每对的分配路径。--remove-other-labels— 添加后,删除这些对象上不存在于--labels中的任何非系统标签。设置为“--label-type”时被忽略。
示例
# Bulk add — multiple labels to multiple objects in one call
uip tm objectlabel add \
--project-key DEMO \
--object-type TestCase \
--object-ids id1 id2 \
--labels smoke regression
# With a specific label type — assigns each label individually
uip tm objectlabel add \
--project-key DEMO \
--object-type TestCase \
--object-ids id1 id2 \
--labels smoke \
--label-type systemLabel
# Bulk add — multiple labels to multiple objects in one call
uip tm objectlabel add \
--project-key DEMO \
--object-type TestCase \
--object-ids id1 id2 \
--labels smoke regression
# With a specific label type — assigns each label individually
uip tm objectlabel add \
--project-key DEMO \
--object-type TestCase \
--object-ids id1 id2 \
--labels smoke \
--label-type systemLabel
数据形状
{
"Code": "ObjectLabelsAdd",
"Data": {
"ObjectCount": 2,
"LabelCount": 2,
"Result": "Added"
}
}
{
"Code": "ObjectLabelsAdd",
"Data": {
"ObjectCount": 2,
"LabelCount": 2,
"Result": "Added"
}
}
当 --label-type 被传递时,响应将包含它:
{
"Code": "ObjectLabelsAdd",
"Data": {
"ObjectCount": 2,
"LabelCount": 1,
"LabelType": "systemLabel",
"Result": "Added"
}
}
{
"Code": "ObjectLabelsAdd",
"Data": {
"ObjectCount": 2,
"LabelCount": 1,
"LabelType": "systemLabel",
"Result": "Added"
}
}
uip tm 对象标签删除
从一个或多个对象中删除标签。这是破坏性操作 — 需要-y, --yes ; CLI 从不提示。提供 --labels 以删除特定标签,或提供 --remove-all-labels 从指定对象中清除所有非系统标签 — 两者互斥。
参数
无。
选项
--project-key <key>(必填) — 拥有项目。--object-type <type>(必填) — 对象类型。--object-ids <uuid...>(必填项) — 以空格分隔的对象 UUID。--labels <name...>— 要删除的以空格分隔的标签名称。除非设置了--remove-all-labels,否则为必填项。--remove-all-labels— 清除所列对象上的每个非系统标签。与--labels互斥。-y, --yes— 确认此不可撤销的操作。必需 — CLI 从不提示。
示例
# remove specific labels
uip tm objectlabel remove \
--project-key DEMO \
--object-type TestCase \
--object-ids id1 id2 \
--labels regression \
--yes
# clear every non-system label
uip tm objectlabel remove \
--project-key DEMO \
--object-type TestCase \
--object-ids id1 id2 \
--remove-all-labels \
--yes
# remove specific labels
uip tm objectlabel remove \
--project-key DEMO \
--object-type TestCase \
--object-ids id1 id2 \
--labels regression \
--yes
# clear every non-system label
uip tm objectlabel remove \
--project-key DEMO \
--object-type TestCase \
--object-ids id1 id2 \
--remove-all-labels \
--yes
数据形状
{
"Code": "ObjectLabelsRemove",
"Data": {
"ObjectCount": 2,
"LabelCount": 1,
"Result": "Removed"
}
}
{
"Code": "ObjectLabelsRemove",
"Data": {
"ObjectCount": 2,
"LabelCount": 1,
"Result": "Removed"
}
}
如果使用 --remove-all-labels,响应将报告 RemoveAllLabels 而不是 LabelCount,并且 Result 是 AllRemoved:
{
"Code": "ObjectLabelsRemove",
"Data": {
"ObjectCount": 2,
"RemoveAllLabels": true,
"Result": "AllRemoved"
}
}
{
"Code": "ObjectLabelsRemove",
"Data": {
"ObjectCount": 2,
"RemoveAllLabels": true,
"Result": "AllRemoved"
}
}
相关内容
- requirements — 需求可以携带对象标签。
- 自定义字段— 用于标签类型自定义字段值的单独标签机制 (
customfield label);不同于objectlabel的自由格式标签。