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

UiPath CLI 用户指南

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

uip tm executions

uip tm executions检查和操作测试执行,即由uip tm testsets run生成的对象。使用这些动词列出测试集的执行,枚举已完成运行的测试用例日志,并且仅就地重试失败的用例。

启动执行的命令是uip tm testsets run ,该命令返回ExecutionId 。此页面上的每个动词均采用该 ID(或从上下文中派生)。

大纲

uip tm executions list --project-key <key> --test-set-id <uuid> [filters…]
uip tm executions testcaselogs list --execution-id <uuid> --project-key <key> [filters…]
uip tm executions retry --execution-id <uuid> (--project-key <key> | --test-set-key <key>) [--execution-type <type>]
uip tm executions list --project-key <key> --test-set-id <uuid> [filters…]
uip tm executions testcaselogs list --execution-id <uuid> --project-key <key> [filters…]
uip tm executions retry --execution-id <uuid> (--project-key <key> | --test-set-key <key>) [--execution-type <type>]

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

uip tm executions list

列出与测试集关联的执行。筛选器在服务器端应用; CLI 每次调用返回一页,大小为--top / --skip

参数:无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --test-set-id <uuid> (必填) — 测试集 UUID( Id中的字段,而不是testsets list中的TestSetKey )。
  • --filter <text> — 按名称搜索执行。
  • --status <status> — 按执行状态筛选。接受的值来自 SDK TestExecutionStatus枚举。
  • --execution-type <type> — 按执行类型筛选。接受的值来自于 SDK 的ExecutionType枚举( automatedmanualmixednone )。
  • --execution-finished-interval <interval> — 按执行最近完成的时间筛选。接受的值来自 SDK TestExecutionFinishedInterval枚举。
  • --top <number> — 页面大小。默认为50
  • --skip <number> — 要跳过的结果。默认为0
备注:

--status--execution-type--execution-finished-interval接受的确切枚举值由 Test Manager SDK 在运行时生成。运行uip tm executions list --help以查看已安装工具的当前集合版本。

示例

uip tm executions list \
  --project-key DEMO \
  --test-set-id a1b2c3d4-0000-0000-0000-000000000001 \
  --top 2
uip tm executions list \
  --project-key DEMO \
  --test-set-id a1b2c3d4-0000-0000-0000-000000000001 \
  --top 2

数据形状

{
  "Code": "ExecutionsList",
  "Data": [
    {
      "Id": "b2c3d4e5-0000-0000-0000-000000000001",
      "Name": "Nightly Run 2025-04-15",
      "Status": "Passed"
    },
    {
      "Id": "b2c3d4e5-0000-0000-0000-000000000002",
      "Name": "Nightly Run 2025-04-14",
      "Status": "Failed"
    }
  ]
}
{
  "Code": "ExecutionsList",
  "Data": [
    {
      "Id": "b2c3d4e5-0000-0000-0000-000000000001",
      "Name": "Nightly Run 2025-04-15",
      "Status": "Passed"
    },
    {
      "Id": "b2c3d4e5-0000-0000-0000-000000000002",
      "Name": "Nightly Run 2025-04-14",
      "Status": "Failed"
    }
  ]
}

uip tm executions testcaselogs list

列出单次执行生成的测试用例日志。每个日志都是一个测试用例的运行,包含结果、状态和时间。

参数:无。

选项

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

示例

uip tm executions testcaselogs list \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO \
  --only-failed
uip tm executions testcaselogs list \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO \
  --only-failed

数据形状

{
  "Code": "ExecutionTestCaseLogs",
  "Data": [
    {
      "Id": "c3d4e5f6-0000-0000-0000-000000000001",
      "TestCaseName": "Login flow",
      "Status": "Finished",
      "Result": "Failed"
    }
  ]
}
{
  "Code": "ExecutionTestCaseLogs",
  "Data": [
    {
      "Id": "c3d4e5f6-0000-0000-0000-000000000001",
      "TestCaseName": "Login flow",
      "Status": "Finished",
      "Result": "Failed"
    }
  ]
}

输出中的每个Id都是一个测试用例日志 UUID。将其提供给uip tm testcaselogs list-assertions ,查看为何将测试用例日志标记为Failed

uip tm executions retry

仅就重试已完成执行的失败测试用例。该命令:

  1. 获取执行的统计信息,并拒绝继续,除非运行处于最终状态(否则它将退出1 ,并显示指导消息)。
  2. 如果有 0 个失败案例,则打印Message信封并退出0 — 这是有意非造成错误。
  3. 否则,收集每个失败的测试用例日志 ID(已分页),并启动仅针对这些日志的重试。

此重试会重用相同的执行 ID;此操作不会新建连接器。

参数:无。

选项

  • --execution-id <uuid> (必填) — 执行并重试。
  • --project-key <key> — 拥有项目。此参数或--test-set-key为必填项。
  • --test-set-key <key> — 测试集密钥(例如DEMO:42 );项目键从前缀派生。
  • --execution-type <type> — 重试的执行类型: automated (默认)manualmixednone

示例

uip tm executions retry \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO
uip tm executions retry \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO

数据形状— 重试失败时:

{
  "Code": "ExecutionRetry",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "Status": "Running",
    "StartTime": "2025-04-15T10:30:00Z",
    "RetriedCount": 3
  }
}
{
  "Code": "ExecutionRetry",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "Status": "Running",
    "StartTime": "2025-04-15T10:30:00Z",
    "RetriedCount": 3
  }
}

没有重试失败情况时:

{
  "Code": "ExecutionRetry",
  "Data": {
    "Message": "Execution 'a1b2c3d4-0000-0000-0000-000000000001' has no failed test cases to retry."
  }
}
{
  "Code": "ExecutionRetry",
  "Data": {
    "Message": "Execution 'a1b2c3d4-0000-0000-0000-000000000001' has no failed test cases to retry."
  }
}

退出代码

所有uip tm executions …动词都遵循标准退出代码0表示成功(即使retry找不到任何内容可重试), 1表示一般失败, 2表示身份验证失败, 3表示验证错误。

Test Manager 运行生命周期添加了一个值得显式调用的行为,该行为存在于wait上,而不是执行动词本身上:

区分“超时”和“完成但失败”

没有单个tm动词测试失败而退出非零。标准 CI 模式是一个包含三步骤的管道:

  1. 启动uip tm testsets run返回ExecutionId ,并在运行加入队列后立即退出0
  2. 阻止uip tm wait --execution-id <id> --timeout <seconds>会轮询,直到执行达到最终状态。
    • 执行完成后退出0 (无论通过/失败 — 此处的“完成”为成功信号)。
    • --timeout过期时退出2 。这是特定于域的:共享合同为2保留AuthenticationError ,但wait将其重用于TimeoutError ,因此脚本可以在不解析文本的情况下在“花费时间过长”上分支。请参阅uip tm wait退出代码下的说明。
    • API 失败、中断或中止时,在1退出。
  3. 结果uip tm report get --execution-id <id>Passed / Failed / Skipped / PassRate 。您的脚本将决定阶段的呈现方式,并明确地使构建失败(例如exit 1Failed > 0时)。每当成功生成摘要时,无论其正在总结的运行的结果如何, report get本身都会退出0
# Start the run
id=$(uip tm testsets run --test-set-key DEMO:10 --output-filter .Data.ExecutionId)

# Block with a timeout; branch on the outcome
if ! uip tm wait --execution-id "$id" --timeout 1800; then
  code=$?
  if [ "$code" -eq 2 ]; then
    echo "timed out" >&2
    exit 2
  fi
  echo "wait failed ($code)" >&2
  exit "$code"
fi

# Decide pass/fail from the summary
failed=$(uip tm report get --execution-id "$id" --project-key DEMO --output-filter .Data.Failed)
if [ "$failed" -gt 0 ]; then
  echo "$failed test case(s) failed" >&2
  exit 1
fi
echo "all passed"
# Start the run
id=$(uip tm testsets run --test-set-key DEMO:10 --output-filter .Data.ExecutionId)

# Block with a timeout; branch on the outcome
if ! uip tm wait --execution-id "$id" --timeout 1800; then
  code=$?
  if [ "$code" -eq 2 ]; then
    echo "timed out" >&2
    exit 2
  fi
  echo "wait failed ($code)" >&2
  exit "$code"
fi

# Decide pass/fail from the summary
failed=$(uip tm report get --execution-id "$id" --project-key DEMO --output-filter .Data.Failed)
if [ "$failed" -gt 0 ]; then
  echo "$failed test case(s) failed" >&2
  exit 1
fi
echo "all passed"
  • testsets run — start an execution.
  • wait — 阻止,直到执行达到终止状态。
  • 报告结果附件— 运行后工件。
  • testcasestestcaselogs list-assertions turns a failed log into per-assertion detail.

另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新