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

uip tm 执行

“uip tm 执行”的语法和选项,可列出、筛选和重试测试执行,并检查已完成运行的测试用例日志。

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

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

大纲

uip tm executions list --project-key <key> [--test-set-id <uuid>] [--filter <text>] [--limit <n>] [--offset <n>]
uip tm executions list-filtered --project-key <key> [--status <status>] [--execution-type <type>] [--execution-finished-interval <interval>] [--updated-by <userId>] [--search <text>] [--labels <labels...>] [--test-execution-ids <ids...>] [--sort-by <expr>] [--limit <n>] [--offset <n>]
uip tm executions testcaselogs list --execution-id <uuid> --project-key <key> [--only-failed] [--filter <text>] [--limit <n>] [--offset <n>]
uip tm executions run --project-key <key> --execution-id <uuid> --execution-type <type> [--test-case-log-ids <ids...>] [--async]
uip tm executions retry --execution-id <uuid> (--project-key <key> | --test-set-key <key>) [--execution-type <type>]
uip tm executions get-stats --execution-id <uuid> --project-key <key>
uip tm executions list --project-key <key> [--test-set-id <uuid>] [--filter <text>] [--limit <n>] [--offset <n>]
uip tm executions list-filtered --project-key <key> [--status <status>] [--execution-type <type>] [--execution-finished-interval <interval>] [--updated-by <userId>] [--search <text>] [--labels <labels...>] [--test-execution-ids <ids...>] [--sort-by <expr>] [--limit <n>] [--offset <n>]
uip tm executions testcaselogs list --execution-id <uuid> --project-key <key> [--only-failed] [--filter <text>] [--limit <n>] [--offset <n>]
uip tm executions run --project-key <key> --execution-id <uuid> --execution-type <type> [--test-case-log-ids <ids...>] [--async]
uip tm executions retry --execution-id <uuid> (--project-key <key> | --test-set-key <key>) [--execution-type <type>]
uip tm executions get-stats --execution-id <uuid> --project-key <key>

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

uip tm 执行列表

列出与测试集关联的执行。--test-set-id是可选的 — 省略它以列出项目中所有测试集的执行情况。

参数

无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --test-set-id <uuid> — 测试集 UUID( Id字段来自testsets list而不是TestSetKey )。
  • --filter <text> — 按名称搜索执行。
  • --limit <n> — 页面大小。默认为50
  • --offset <n> — 要跳过的结果。默认为0

示例

uip tm executions list \
  --project-key DEMO \
  --test-set-id a1b2c3d4-0000-0000-0000-000000000001 \
  --limit 2
uip tm executions list \
  --project-key DEMO \
  --test-set-id a1b2c3d4-0000-0000-0000-000000000001 \
  --limit 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 执行

使用高级服务器端筛选器列出执行。注意: --status--execution-type是单数单值标志。日期范围筛选是通过--execution-finished-interval完成的,而不是日期标志。

参数

无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --status <status> — 按单个执行状态筛选。接受的值来自 SDK TestExecutionStatus枚举。运行--help以查看当前集合。
  • --execution-type <type> — 按单个执行类型( automatedmanualmixednone )筛选。
  • --execution-finished-interval <interval> — 按执行最近完成的时间筛选。接受的值来自 SDK TestExecutionFinishedInterval枚举。
  • --updated-by <userId> — 按上次更新执行的用户 ID 筛选。
  • --search <text> — 对执行名称和元数据进行自由文本搜索。
  • --labels <labels...> — 要作为筛选依据的以空格分隔的标签名称。
  • --test-execution-ids <ids...> — 要包含的以空格分隔的执行 UUID。
  • --sort-by <expr> — 排序表达式(字段名称,可以添加后缀:asc:desc )。
  • --limit <n> — 页面大小。默认为50
  • --offset <n> — 要跳过的结果。默认为0

示例

uip tm executions list-filtered \
  --project-key DEMO \
  --status Failed \
  --execution-type automated \
  --limit 10
uip tm executions list-filtered \
  --project-key DEMO \
  --status Failed \
  --execution-type automated \
  --limit 10

数据形状

{
  "Code": "ExecutionsFilteredList",
  "Data": [
    {
      "Id": "b2c3d4e5-0000-0000-0000-000000000002",
      "Name": "Nightly Run 2025-04-14",
      "Status": "Failed",
      "ExecutionType": "automated"
    }
  ]
}
{
  "Code": "ExecutionsFilteredList",
  "Data": [
    {
      "Id": "b2c3d4e5-0000-0000-0000-000000000002",
      "Name": "Nightly Run 2025-04-14",
      "Status": "Failed",
      "ExecutionType": "automated"
    }
  ]
}

uip tm 执行测试用例日志列表

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

参数

无。

选项

  • --execution-id <uuid> (必填) — 要检查的执行。
  • --project-key <key> (必填) — 拥有项目。
  • --only-failed — 仅显示失败的日志。
  • --filter <text> — 按名称搜索日志。
  • --limit <n> — 页面大小。默认为50
  • --offset <n> — 要跳过的结果。默认为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 testcaselog list-assertions ,查看为何将测试用例日志标记为Failed

uip tm 执行运行

按 ID 重新运行现有执行。这与开始新的执行不同— 它会在同一执行记录中重播,针对所有测试用例或特定子集。

备注:

要开始全新的执行,请改用uip tm testsets run

参数

无。

选项

  • --project-key <key> (必填) — 拥有项目。
  • --execution-id <uuid> (必填) — 要重新运行的现有执行的 ID。
  • --execution-type <type> (必填) — 要运行的测试用例( automatedmanualmixednone )。
  • --test-case-log-ids <ids...> — 以空格分隔的测试用例日志 UUID。如果提供,则仅重新运行这些特定日志。
  • --async — 排队后立即返回,无需等待确认。

示例

# re-run the entire execution
uip tm executions run \
  --project-key DEMO \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated

# re-run specific failed logs only
uip tm executions run \
  --project-key DEMO \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated \
  --test-case-log-ids c3d4e5f6-0000-0000-0000-000000000001 c3d4e5f6-0000-0000-0000-000000000002
# re-run the entire execution
uip tm executions run \
  --project-key DEMO \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated

# re-run specific failed logs only
uip tm executions run \
  --project-key DEMO \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated \
  --test-case-log-ids c3d4e5f6-0000-0000-0000-000000000001 c3d4e5f6-0000-0000-0000-000000000002

数据形状

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

uip tm 执行重试

仅就地重试已完成执行的失败测试用例。该命令将获取执行的统计信息,并拒绝继续,除非运行处于最终状态。如果有 0 个失败案例,则系统会退出0并显示一条消息。此重试会重用相同的执行 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 执行获取统计信息

按 ID 获取测试执行,以及通过/失败/无聚合计数。用于读取已完成执行的最终结论,而无需获取完整报告。

参数

无。

选项

  • --execution-id <uuid> (必填) — 测试执行 UUID。
  • --project-key <key> (必填) — 拥有项目。

示例

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

数据形状

{
  "Code": "ExecutionStats",
  "Data": {
    "Id": "a1b2c3d4-0000-0000-0000-000000000001",
    "Name": "Nightly Run 2025-04-15",
    "Status": "Finished",
    "ExecutionType": "automated",
    "Passed": 8,
    "Failed": 2,
    "None": 0,
    "ExecutionStart": "2025-04-15T10:00:00Z",
    "ExecutionFinished": "2025-04-15T11:00:00Z"
  }
}
{
  "Code": "ExecutionStats",
  "Data": {
    "Id": "a1b2c3d4-0000-0000-0000-000000000001",
    "Name": "Nightly Run 2025-04-15",
    "Status": "Finished",
    "ExecutionType": "automated",
    "Passed": 8,
    "Failed": 2,
    "None": 0,
    "ExecutionStart": "2025-04-15T10:00:00Z",
    "ExecutionFinished": "2025-04-15T11:00:00Z"
  }
}

退出代码

标准 CI 模式是一个包含三步骤的管道:

  1. 启动uip tm testsets run返回ExecutionId并退出0
  2. 阻止uip tm wait会轮询,直到执行达到最终状态。完成时退出0 ,超时时退出2 ,失败时退出1
  3. 结论uip tm report get读取Passed / Failed项计数。您的脚本构建明确失败。
id=$(uip tm testsets run \
  --project-key DEMO \
  --test-set-key DEMO:10 \
  --execution-type automated \
  --output-filter .Data.ExecutionId)

if ! uip tm wait --execution-id "$id" --project-key DEMO --timeout 1800000; then
  code=$?
  [ "$code" -eq 2 ] && { echo "timed out" >&2; exit 2; }
  echo "wait failed ($code)" >&2; exit "$code"
fi

failed=$(uip tm report get \
  --execution-id "$id" --project-key DEMO --output-filter .Data.Failed)
[ "$failed" -gt 0 ] && { echo "$failed test(s) failed" >&2; exit 1; }
echo "all passed"
id=$(uip tm testsets run \
  --project-key DEMO \
  --test-set-key DEMO:10 \
  --execution-type automated \
  --output-filter .Data.ExecutionId)

if ! uip tm wait --execution-id "$id" --project-key DEMO --timeout 1800000; then
  code=$?
  [ "$code" -eq 2 ] && { echo "timed out" >&2; exit 2; }
  echo "wait failed ($code)" >&2; exit "$code"
fi

failed=$(uip tm report get \
  --execution-id "$id" --project-key DEMO --output-filter .Data.Failed)
[ "$failed" -gt 0 ] && { echo "$failed test(s) failed" >&2; exit 1; }
echo "all passed"

另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新