UiPath Documentation
uipath-cli
latest
false
重要 :
请注意,此内容已使用机器翻译进行了本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

UiPath CLI 用户指南

上次更新日期 2026年5月20日

uip tm testcases

uip tm testcases manages test cases within a Test Manager project: create, list, update, delete, link or unlink an Orchestrator automation, inspect historical results, and add or remove test cases from a test set. This page also documents uip tm testcaselogs list-assertions, which reads the assertion artifacts attached to a single test case log produced by a run.

A test case is the unit of authorship. It becomes runnable once it is linked to a package entry point with testcases link-automation, and it runs as part of a test set (see testsets).

大纲

uip tm testcases create --project-key <key> --name <name> [--description <text>] [--version <version>]
uip tm testcases list --project-key <key> [--filter <text>]
uip tm testcases list-result-history --project-key <key> --test-case-id <uuid> [filters…]
uip tm testcases update --project-key <key> --test-case-key <key> [--name <name>] [--description <text>]
uip tm testcases delete --project-key <key> --test-case-key <key>
uip tm testcases link-automation --project-key <key> --test-case-key <key> --folder-key <uuid> --package-name <name> --test-name <name>
uip tm testcases unlink-automation --project-key <key> --test-case-key <key>
uip tm testcases list-automations --project-key <key> --folder-key <uuid> [--package-name <name>]
uip tm testcases list-testsets --project-key <key> --test-case-key <key>
uip tm testcases add --test-set-key <key> --test-case-keys <keys>
uip tm testcases remove --test-set-key <key> --test-case-keys <keys>

uip tm testcaselogs list-assertions --project-key <key> --test-case-log-id <uuid>
uip tm testcases create --project-key <key> --name <name> [--description <text>] [--version <version>]
uip tm testcases list --project-key <key> [--filter <text>]
uip tm testcases list-result-history --project-key <key> --test-case-id <uuid> [filters…]
uip tm testcases update --project-key <key> --test-case-key <key> [--name <name>] [--description <text>]
uip tm testcases delete --project-key <key> --test-case-key <key>
uip tm testcases link-automation --project-key <key> --test-case-key <key> --folder-key <uuid> --package-name <name> --test-name <name>
uip tm testcases unlink-automation --project-key <key> --test-case-key <key>
uip tm testcases list-automations --project-key <key> --folder-key <uuid> [--package-name <name>]
uip tm testcases list-testsets --project-key <key> --test-case-key <key>
uip tm testcases add --test-set-key <key> --test-case-keys <keys>
uip tm testcases remove --test-set-key <key> --test-case-keys <keys>

uip tm testcaselogs list-assertions --project-key <key> --test-case-log-id <uuid>

所有动词都遵循全局选项和标准退出代码。每个动词接受-t, --tenant <name>--log-level <level> (默认为Information )。

uip tm testcases create

在项目中创建一个新的测试用例。

参数:无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --name <name> (必填) — 测试用例名称。
  • --description <text> — 自由格式说明。默认为空。
  • --version <version> — 测试用例版本字符串。默认为1.0.0

示例

uip tm testcases create \
  --project-key DEMO \
  --name "Login smoke" \
  --description "Logs in and out"
uip tm testcases create \
  --project-key DEMO \
  --name "Login smoke" \
  --description "Logs in and out"

数据形状

{
  "Code": "TestCaseCreate",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "Id": "a1b2c3d4-0000-0000-0000-000000000001",
    "Name": "Login smoke",
    "Description": "Logs in and out",
    "Version": "1.0.0"
  }
}
{
  "Code": "TestCaseCreate",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "Id": "a1b2c3d4-0000-0000-0000-000000000001",
    "Name": "Login smoke",
    "Description": "Logs in and out",
    "Version": "1.0.0"
  }
}

TestCaseKey (公共PROJECT:N标识符)是传递给其他动词的内容。只有Id需要内部list-result-history

uip tm testcases list

列出项目中的所有测试用例。CLI 自动对结果进行分页;此动词未公开任何分页选项。

参数:无。

选项

  • --project-key <key> (必填) — 要列出的项目。
  • --filter <text> — 按名称或键筛选(服务器端搜索)。

示例

uip tm testcases list --project-key DEMO --filter login
uip tm testcases list --project-key DEMO --filter login

数据形状

{
  "Code": "TestCasesList",
  "Data": [
    {
      "TestCaseKey": "DEMO:1",
      "Name": "Login smoke",
      "Version": "1.0.0",
      "Description": "Logs in and out"
    }
  ]
}
{
  "Code": "TestCasesList",
  "Data": [
    {
      "TestCaseKey": "DEMO:1",
      "Name": "Login smoke",
      "Version": "1.0.0",
      "Description": "Logs in and out"
    }
  ]
}

uip tm testcases list-result-history

列出单个测试用例的历史测试用例日志。采用内部--test-case-id (UUID),而非PROJECT:N键 — 通过testcases list查找 UUID 或从上一个TestCaseCreate输出中查找。

参数:无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --test-case-id <uuid> (必填) — 内部测试用例 UUID。
  • --filter <text> — 按名称搜索测试用例日志。
  • --only-failed —“仅显示失败的日志”的快捷方式(默认为false )。
  • --results <results...> — 要包含的以空格分隔的结果。接受的值来自 SDK Result枚举。
  • --statuses <statuses...> — 用空格分隔执行状态。接受的值来自 SDK TestCaseLogExecutionStatus枚举。
  • --duration-period <period> — 按持续时间存储桶筛选。接受的值来自 SDK DurationPeriod枚举。
  • --top <number> — 页面大小。默认为50
  • --skip <number> — 要跳过的结果。默认为0
备注:

--results--statuses--duration-period的确切可接受值由已安装的工具版本附带的 Test Manager SDK 枚举在运行时生成。运行uip tm testcases list-result-history --help以查看当前集合。

示例

uip tm testcases list-result-history \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --only-failed
uip tm testcases list-result-history \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --only-failed

数据形状

{
  "Code": "TestCaseResultHistory",
  "Data": [
    {
      "Id": "b2c3d4e5-0000-0000-0000-000000000001",
      "Result": "Failed",
      "Status": "Finished",
      "ExecutionEnd": "2025-04-15T12:00:00Z"
    }
  ]
}
{
  "Code": "TestCaseResultHistory",
  "Data": [
    {
      "Id": "b2c3d4e5-0000-0000-0000-000000000001",
      "Result": "Failed",
      "Status": "Finished",
      "ExecutionEnd": "2025-04-15T12:00:00Z"
    }
  ]
}

uip tm testcases update

重命名测试用例或更改其描述。至少需要--name--description其中一个;否则,命令将失败,并显示验证错误。

参数:无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --test-case-key <key> (必填项) — 测试用例键(例如DEMO:1 )。
  • --name <name> — 新名称。
  • --description <text> — 新说明。

示例

uip tm testcases update \
  --project-key DEMO \
  --test-case-key DEMO:1 \
  --name "Login smoke (2026)"
uip tm testcases update \
  --project-key DEMO \
  --test-case-key DEMO:1 \
  --name "Login smoke (2026)"

数据形状

{
  "Code": "TestCaseUpdate",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "Name": "Login smoke (2026)",
    "Description": "Logs in and out",
    "Result": "Updated"
  }
}
{
  "Code": "TestCaseUpdate",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "Name": "Login smoke (2026)",
    "Description": "Logs in and out",
    "Result": "Updated"
  }
}

uip tm testcases delete

按测试用例的密钥删除测试用例。

参数:无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --test-case-key <key> (必填项) — 测试用例键(例如DEMO:1 )。

示例

uip tm testcases delete --project-key DEMO --test-case-key DEMO:1
uip tm testcases delete --project-key DEMO --test-case-key DEMO:1

数据形状

{
  "Code": "TestCaseDelete",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "Id": "a1b2c3d4-0000-0000-0000-000000000001",
    "Result": "Deleted"
  }
}
{
  "Code": "TestCaseDelete",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "Id": "a1b2c3d4-0000-0000-0000-000000000001",
    "Result": "Deleted"
  }
}

将 Orchestrator 包入口点绑定到测试用例。这就是使测试用例在测试集中可执行的原因。

该命令在内部解析来自--folder-key文件夹显示名称,按名称查找匹配的包入口点,然后将绑定存储到测试用例上。--folder-key--package-name--test-name必须全部解析为具体入口点,否则命令将失败。

参数:无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --test-case-key <key> (必填) — 要绑定的测试用例。
  • --folder-key <uuid> (必填) — Orchestrator 文件夹 UUID(来自uip or folders list )。
  • --package-name <name> (必填项) — Orchestrator 包标识符(例如InvoiceTests )。
  • --test-name <name> (必填) — 包中的测试用例名称(入口点名称)。

示例

uip tm testcases link-automation \
  --project-key DEMO \
  --test-case-key DEMO:1 \
  --folder-key f0f0f0f0-0000-0000-0000-000000000001 \
  --package-name InvoiceTests \
  --test-name SmokeTest
uip tm testcases link-automation \
  --project-key DEMO \
  --test-case-key DEMO:1 \
  --folder-key f0f0f0f0-0000-0000-0000-000000000001 \
  --package-name InvoiceTests \
  --test-name SmokeTest

数据形状

{
  "Code": "TestCaseLinkAutomation",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "PackageName": "InvoiceTests",
    "PackageSource": "Shared",
    "TestName": "SmokeTest",
    "Result": "Linked"
  }
}
{
  "Code": "TestCaseLinkAutomation",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "PackageName": "InvoiceTests",
    "PackageSource": "Shared",
    "TestName": "SmokeTest",
    "Result": "Linked"
  }
}

PackageSource是从--folder-key解析的文件夹的显示名称。

从测试用例中删除包-入口点绑定。取消链接后,在再次链接之前,测试用例无法再执行。

参数:无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --test-case-key <key> (必填) — 要取消链接的测试用例。

示例

uip tm testcases unlink-automation --project-key DEMO --test-case-key DEMO:1
uip tm testcases unlink-automation --project-key DEMO --test-case-key DEMO:1

数据形状

{
  "Code": "TestCaseUnlinkAutomation",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "Result": "Unlinked"
  }
}
{
  "Code": "TestCaseUnlinkAutomation",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "Result": "Unlinked"
  }
}

uip tm testcases list-automations

“列出 Orchestrator 文件夹中可用的测试入口点”— 用于发现--package-name / --test-name值以传递给link-automation

参数:无。

选项

  • --project-key <key> (必填) — 拥有项目(用于限定查找范围)。
  • --folder-key <uuid> (必填) — Orchestrator 文件夹 UUID。
  • --package-name <name> — 从列表中筛选一个包(不区分大小写的精确匹配)。

示例

uip tm testcases list-automations \
  --project-key DEMO \
  --folder-key f0f0f0f0-0000-0000-0000-000000000001
uip tm testcases list-automations \
  --project-key DEMO \
  --folder-key f0f0f0f0-0000-0000-0000-000000000001

数据形状

{
  "Code": "TestAutomationsList",
  "Data": [
    {
      "PackageName": "InvoiceTests",
      "TestName": "SmokeTest",
      "PackageVersion": "1.0.2"
    }
  ]
}
{
  "Code": "TestAutomationsList",
  "Data": [
    {
      "PackageName": "InvoiceTests",
      "TestName": "SmokeTest",
      "PackageVersion": "1.0.2"
    }
  ]
}

uip tm testcases list-testsets

列出包含给定测试用例的每个测试集。

参数:无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --test-case-key <key> (必填项) — 测试用例键(例如DEMO:1 )。

示例

uip tm testcases list-testsets --project-key DEMO --test-case-key DEMO:1
uip tm testcases list-testsets --project-key DEMO --test-case-key DEMO:1

数据形状

{
  "Code": "TestCaseTestSetsList",
  "Data": [
    {
      "TestSetKey": "DEMO:10",
      "Name": "Smoke Suite",
      "FolderKey": "f0f0f0f0-0000-0000-0000-000000000001"
    }
  ]
}
{
  "Code": "TestCaseTestSetsList",
  "Data": [
    {
      "TestSetKey": "DEMO:10",
      "Name": "Smoke Suite",
      "FolderKey": "f0f0f0f0-0000-0000-0000-000000000001"
    }
  ]
}

uip tm testcases add

向测试集中添加一个或多个测试用例。CLI 会将每个密钥解析为其内部 UUID,并在一个请求中调用分配端点。如果有任何密钥未知,则在进行任何更改之前整个调用都会失败。

参数:无。

选项

  • --test-set-key <key> (必填) — 要修改的测试集。
  • --test-case-keys <keys> (必填) — 以逗号分隔的测试用例密钥(例如DEMO:1,DEMO:2 )。逗号两边的空格将被忽略。

示例

uip tm testcases add \
  --test-set-key DEMO:10 \
  --test-case-keys DEMO:1,DEMO:2
uip tm testcases add \
  --test-set-key DEMO:10 \
  --test-case-keys DEMO:1,DEMO:2

数据形状

{
  "Code": "TestCaseAdd",
  "Data": {
    "TestSetKey": "DEMO:10",
    "Added": "DEMO:1, DEMO:2",
    "Result": "Added"
  }
}
{
  "Code": "TestCaseAdd",
  "Data": {
    "TestSetKey": "DEMO:10",
    "Added": "DEMO:1, DEMO:2",
    "Result": "Added"
  }
}

uip tm testcases remove

从测试集中删除一个或多个测试用例。与testcases add语义相同,但调用取消分配端点。

参数:无。

选项

  • --test-set-key <key> (必填) — 要修改的测试集。
  • --test-case-keys <keys> (必填) — 要删除的测试用例密钥,以逗号分隔。

示例

uip tm testcases remove \
  --test-set-key DEMO:10 \
  --test-case-keys DEMO:1,DEMO:2
uip tm testcases remove \
  --test-set-key DEMO:10 \
  --test-case-keys DEMO:1,DEMO:2

数据形状

{
  "Code": "TestCaseRemove",
  "Data": {
    "TestSetKey": "DEMO:10",
    "Removed": "DEMO:1, DEMO:2",
    "Result": "Removed"
  }
}
{
  "Code": "TestCaseRemove",
  "Data": {
    "TestSetKey": "DEMO:10",
    "Removed": "DEMO:1, DEMO:2",
    "Result": "Removed"
  }
}

uip tm testcaselogs list-assertions

列出为单个测试用例日志记录的断言。每次运行测试用例都会产生一个测试用例日志;其断言是指记录的自动化的各项检查( ExpectVerifyExpression等)。当您想要找出测试用例日志标记为Failed原因时,请使用此选项。

此动词已在testcaselogs而非testcases下注册,但将其记录在此处,因为它会读取测试用例日志的断言工件。

参数:无。

选项

  • --test-case-log-id <uuid> (必填项) — 测试用例日志 UUID。从uip tm executions testcaselogs listuip tm testcases list-result-history获取。
  • --project-key <key> (必填) — 拥有项目。

示例

uip tm testcaselogs list-assertions \
  --test-case-log-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO
uip tm testcaselogs list-assertions \
  --test-case-log-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO

数据形状

{
  "Code": "TestCaseLogAssertions",
  "Data": [
    { "Message": "Title contains 'Welcome'", "Succeeded": true },
    { "Message": "Button 'Login' visible", "Succeeded": false }
  ]
}
{
  "Code": "TestCaseLogAssertions",
  "Data": [
    { "Message": "Title contains 'Welcome'", "Succeeded": true },
    { "Message": "Button 'Login' visible", "Succeeded": false }
  ]
}
  • project — 拥有每个测试用例的作用域。
  • testsets — group test cases into a runnable suite.
  • executions — execution-level views of test case logs (execution testcaselogs list).
  • 报告— 运行摘要,包含失败案例和断言文本。

另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新