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>

All verbs honor the global options and the standard exit codes. Every verb accepts --log-level <level> (default Information).

uip tm 执行列表

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

参数

无。

选项

标记描述
--project-key <key>Required. Owning project.
--test-set-id <uuid>Test set UUID (the Id field from testsets list, not TestSetKey).
--filter <text>Search executions by name.
--limit <n>Page size. Defaults to 50.
--offset <n>Results to skip. Defaults to 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>Required. Owning project.
--status <status>Filter by a single execution status. Accepted values come from the SDK TestExecutionStatus enum — run --help for the current set.
--execution-type <type>Filter by a single execution type (automated, manual, mixed, none).
--execution-finished-interval <interval>Filter by how recently the execution finished. Accepted values come from the SDK TestExecutionFinishedInterval enum.
--updated-by <userId>Filter by the user ID who last updated the execution.
--search <text>Free-text search over execution names and metadata.
--labels <labels...>Space-separated label names to filter by.
--test-execution-ids <ids...>Space-separated execution UUIDs to include.
--sort-by <expr>Sort expression (field name, optionally suffixed with :asc or :desc).
--limit <n>Page size. Defaults to 50.
--offset <n>Results to skip. Defaults to 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>Required. Execution to inspect.
--project-key <key>Required. Owning project.
--only-failedShow only failed logs.
--filter <text>Search logs by name.
--limit <n>Page size. Defaults to 50.
--offset <n>Results to skip. Defaults to 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 执行运行

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

备注:

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

参数

无。

选项

标记描述
--project-key <key>Required. Owning project.
--execution-id <uuid>Required. ID of the existing execution to re-run.
--execution-type <type>Required. Which test cases to run (automated, manual, mixed, none).
--test-case-log-ids <ids...>Space-separated test case log UUIDs. When supplied, only those specific logs are re-run.
--asyncReturn immediately after queuing without waiting for acknowledgement.

示例

# 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>Required. Execution to retry.
--project-key <key>Owning project. Either this or --test-set-key is required.
--test-set-key <key>Test set key (for example, DEMO:42); the project key is derived from the prefix.
--execution-type <type>Execution type for the retry: automated (default), manual, mixed, or none.

示例

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 执行获取统计信息

Get a test execution by ID with all its execution fields plus aggregated pass/fail/none counts. Use this when you need the raw execution record with stats — for example, to check whether an execution has finished before calling report get, or to extract timing and coverage data for external reporting.

参数

无。

选项

标记描述
--execution-id <uuid>Required. Test execution UUID. Get this from uip tm testsets run or uip tm testcases run.
--project-key <key>Required. Test Manager project key (for example, DEMO).

示例

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": "ExecutionGetStats",
  "Data": {
    "Id": "a1b2c3d4-0000-0000-0000-000000000001",
    "Name": "Nightly Run 2025-04-15",
    "Description": "Smoke + regression suite",
    "Status": "Finished",
    "ExecutionType": "automated",
    "Source": "Manual",
    "ProjectId": "00000000-0000-0000-0000-000000000abc",
    "TestSetId": "a1b2c3d4-0000-0000-0000-000000000010",
    "TestSetObjKey": "DEMO:10",
    "Passed": 8,
    "Failed": 2,
    "None": 0,
    "Duration": 3600000,
    "RunId": 12,
    "EnforceExecutionOrder": false,
    "EnableCoverage": false,
    "IsRunningAutomated": false,
    "HasTestsFromMultipleAutomationProjects": false,
    "RemoteControlAccess": "Disabled",
    "ExecutionStart": "2025-04-15T10:00:00Z",
    "ExecutionFinished": "2025-04-15T11:00:00Z",
    "ReportingDate": "2025-04-15T11:00:00Z",
    "FolderKey": "11111111-2222-3333-4444-555555555555",
    "Created": "2025-04-15T09:55:00Z",
    "CreatedBy": "11111111-2222-3333-4444-555555555555",
    "Updated": "2025-04-15T11:00:00Z",
    "UpdatedBy": "11111111-2222-3333-4444-555555555555",
    "AutopilotForRobotsSettings": { "Enabled": false },
    "OrderedExecutionSettings": { "Enabled": false },
    "VideoRecordingSettings": { "Enabled": false }
  }
}
{
  "Code": "ExecutionGetStats",
  "Data": {
    "Id": "a1b2c3d4-0000-0000-0000-000000000001",
    "Name": "Nightly Run 2025-04-15",
    "Description": "Smoke + regression suite",
    "Status": "Finished",
    "ExecutionType": "automated",
    "Source": "Manual",
    "ProjectId": "00000000-0000-0000-0000-000000000abc",
    "TestSetId": "a1b2c3d4-0000-0000-0000-000000000010",
    "TestSetObjKey": "DEMO:10",
    "Passed": 8,
    "Failed": 2,
    "None": 0,
    "Duration": 3600000,
    "RunId": 12,
    "EnforceExecutionOrder": false,
    "EnableCoverage": false,
    "IsRunningAutomated": false,
    "HasTestsFromMultipleAutomationProjects": false,
    "RemoteControlAccess": "Disabled",
    "ExecutionStart": "2025-04-15T10:00:00Z",
    "ExecutionFinished": "2025-04-15T11:00:00Z",
    "ReportingDate": "2025-04-15T11:00:00Z",
    "FolderKey": "11111111-2222-3333-4444-555555555555",
    "Created": "2025-04-15T09:55:00Z",
    "CreatedBy": "11111111-2222-3333-4444-555555555555",
    "Updated": "2025-04-15T11:00:00Z",
    "UpdatedBy": "11111111-2222-3333-4444-555555555555",
    "AutopilotForRobotsSettings": { "Enabled": false },
    "OrderedExecutionSettings": { "Enabled": false },
    "VideoRecordingSettings": { "Enabled": false }
  }
}

关键字段:

  • Passed, Failed, None — aggregated test case log counts for the execution.
  • Duration — total execution duration in milliseconds.
  • Status — the execution state. When Finished, the Passed/Failed/None counts are final.
  • IsRunningAutomatedtrue while automated test cases are still being dispatched to robots.
备注:

get-stats returns the raw execution record with counts. For a formatted summary with per-test-case failure messages, use uip tm report get instead.

退出代码

标准 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 \
  --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 \
  --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 论坛

保持更新