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

uip tm 测试用例

“uip tm testcases”的语法和选项,用于管理测试用例,包括创建、列出、更新、删除、链接自动化和测试用例日志管理。

uip tm testcases管理 Test Manager 项目中的测试用例:创建、列出、更新、删除、链接或取消链接 Orchestrator 自动化,检查历史结果以及在测试集中添加或删除测试用例。它还提供了testcases run — 一种直接从 Orchestrator 包执行一个或多个测试用例的方法。此页面还记录uip tm testcaselogs list-assertions (读取附加到单个测试用例日志的断言工件testcaselog finish testcaselog start

测试用例是作者身份单位。在使用testcases link-automation链接到包入口点后,它将变为可运行状态。然后,测试用例可以作为测试集的一部分执行(请参阅测试集),也可以直接通过testcases run执行。

大纲

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> [--filter <text>] [--only-failed] [--results <results...>] [--statuses <statuses...>] [--duration-period <period>] [--top <number>] [--skip <number>]
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> [-y]
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 run --project-key <key> --test-case-id <uuid...> --name <name> --execution-type <type> [--async] [--folder-key <uuid>] [--runtime-type <type>] [--robot-user-key <uuid>] [--machine-key <uuid>] [--host-machine-name <name>] [--service-user-name <name>] [--test-set-packages <json>]
uip tm testcases add --test-set-key <key> --test-case-keys <keys>
uip tm testcases remove --test-set-key <key> --test-case-keys <keys> [-y]
uip tm testcases list-steps --project-key <key> --test-case-id <uuid>

uip tm testcases steps list --project-key <key> --test-case-id <uuid>
uip tm testcases steps get --project-key <key> --step-id <uuid>
uip tm testcases steps add --project-key <key> --test-case-id <uuid> [--description <text>] [--expected-result <text>] [--action-type <type>] [--clipboard-data <text>] [--order-no <n>] [--step <json>...]
uip tm testcases steps update --project-key <key> --step-id <uuid> [--description <text>] [--expected-result <text>] [--action-type <type>] [--clipboard-data <text>]
uip tm testcases steps move --project-key <key> --step-id <uuid> --target-position <n>
uip tm testcases steps delete --project-key <key> --step-id <uuid> [-y]

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

uip tm testcaselog start --execution-id <uuid> --test-case-id <uuid> [--execution-type <type>]
uip tm testcaselog finish --test-case-log-id <uuid> [--info <text>]
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> [--filter <text>] [--only-failed] [--results <results...>] [--statuses <statuses...>] [--duration-period <period>] [--top <number>] [--skip <number>]
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> [-y]
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 run --project-key <key> --test-case-id <uuid...> --name <name> --execution-type <type> [--async] [--folder-key <uuid>] [--runtime-type <type>] [--robot-user-key <uuid>] [--machine-key <uuid>] [--host-machine-name <name>] [--service-user-name <name>] [--test-set-packages <json>]
uip tm testcases add --test-set-key <key> --test-case-keys <keys>
uip tm testcases remove --test-set-key <key> --test-case-keys <keys> [-y]
uip tm testcases list-steps --project-key <key> --test-case-id <uuid>

uip tm testcases steps list --project-key <key> --test-case-id <uuid>
uip tm testcases steps get --project-key <key> --step-id <uuid>
uip tm testcases steps add --project-key <key> --test-case-id <uuid> [--description <text>] [--expected-result <text>] [--action-type <type>] [--clipboard-data <text>] [--order-no <n>] [--step <json>...]
uip tm testcases steps update --project-key <key> --step-id <uuid> [--description <text>] [--expected-result <text>] [--action-type <type>] [--clipboard-data <text>]
uip tm testcases steps move --project-key <key> --step-id <uuid> --target-position <n>
uip tm testcases steps delete --project-key <key> --step-id <uuid> [-y]

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

uip tm testcaselog start --execution-id <uuid> --test-case-id <uuid> [--execution-type <type>]
uip tm testcaselog finish --test-case-log-id <uuid> [--info <text>]

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

创建 UIP TM 测试用例

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

参数

无。

选项

标记描述
--project-key <key>Required. Owning project.
--name <name>Required. Test case name.
--description <text>Free-form description. Defaults to empty.
--version <version>Test case version string. Defaults to 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标识符)是传递给其他动词的内容。list-result-historylist-testsets需要内部Id (UUID)。

uip tm 测试用例列表

List all test cases in a project. The CLI pages through results automatically.

参数

无。

选项

标记描述
--project-key <key>Required. Project to list.
--filter <text>Filter by name or key (server-side search).

示例

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",
      "Description": "Logs in and out"
    }
  ]
}
{
  "Code": "TestCasesList",
  "Data": [
    {
      "TestCaseKey": "DEMO:1",
      "Name": "Login smoke",
      "Description": "Logs in and out"
    }
  ]
}

uip tm 测试用例列表结果历史记录

列出单个测试用例的历史测试用例日志。获取内部--test-case-id (UUID) — 通过testcases list或从上一个TestCaseCreate输出中查找 UUID。

参数

无。

选项

标记描述
--project-key <key>Required. Owning project.
--test-case-id <uuid>Required. Internal test case UUID.
--filter <text>Search test case logs by name.
--only-failedShortcut for "show only failed logs" (default false).
--results <results...>Space-separated results to include. Accepted values come from the SDK Result enum.
--statuses <statuses...>Space-separated execution statuses. Accepted values come from the SDK TestCaseLogExecutionStatus enum.
--duration-period <period>Filter by duration bucket. Accepted values come from the SDK DurationPeriod enum.
--top <number>Page size. Defaults to 50.
--skip <number>Results to skip. Defaults to 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 测试用例更新

Rename a test case or change its description. At least one of --name or --description is required.

参数

无。

选项

标记描述
--project-key <key>Required. Owning project.
--test-case-key <key>Required. Test case key (for example, 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)",
    "Result": "Updated"
  }
}
{
  "Code": "TestCaseUpdate",
  "Data": {
    "TestCaseKey": "DEMO:1",
    "Name": "Login smoke (2026)",
    "Result": "Updated"
  }
}

uip tm 测试用例删除

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

参数

无。

选项

标记描述
--project-key <key>Required. Owning project.
--test-case-key <key>Required. Test case key (for example, DEMO:1).
-y, --yesSkip the confirmation prompt. Required in non-interactive environments.

示例

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

数据形状

{
  "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"
  }
}

Bind an Orchestrator package entry point to a test case. This is what makes the test case executable inside a test set. Internally, the command resolves the folder display name from --folder-key, looks up the matching package entry point by name, then stores the binding on the test case.

参数

无。

选项

标记描述
--project-key <key>Required. Owning project.
--test-case-key <key>Required. Test case to bind.
--folder-key <uuid>Required. Orchestrator folder UUID (from uip or folders list).
--package-name <name>Required. Orchestrator package identifier (for example, InvoiceTests).
--test-name <name>Required. The test case name inside the package (the entry point 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"
  }
}

从测试用例中删除自动化绑定。取消链接后,在再次链接之前,测试用例无法再执行。

参数

无。

选项

标记描述
--project-key <key>Required. Owning project.
--test-case-key <key>Required. Test case to unlink.

示例

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 测试用例列表自动化

List the test entry points available in an Orchestrator folder. Use this to discover the --package-name / --test-name values to pass to link-automation.

参数

无。

选项

标记描述
--project-key <key>Required. Owning project (used to scope the lookup).
--folder-key <uuid>Required. Orchestrator folder UUID.
--package-name <name>Filter the list to one package (case-insensitive exact match).

示例

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 测试用例列表测试集

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

参数

无。

选项

标记描述
--project-key <key>Required. Owning project.
--test-case-key <key>Required. Test case key (for example, 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 测试用例

直接从 Orchestrator 包运行一个或多个测试用例,而无需先创建测试集。testcases run启动执行并返回执行记录。有关此功能的更多信息,请参阅 Test Manager 文档中的执行不使用测试集的测试用例

备注:

testcases run默认情况下是同步的,它会受到阻止,直到确认执行记录为止。要在排队后立即返回,请传递--async 。要在执行完成之前阻止,请将返回的Id通过管道传输到uip tm wait

何时使用testcases runtestsets run

  • 使用testcases run直接从包中按需执行测试用例。
  • 使用testsets run执行指定的测试用例组,系统会随着时间的推移在 Test Manager 中管理这些用例。

参数

无。

选项

标记描述
--project-key <key>Test Manager project key (for example, DEMO). Optional if derivable from context.
--test-case-id <uuid...>Required. One or more test case UUIDs to run, space-separated. Get UUIDs from testcases list.
--execution-type <type>Required. Execution type: automated, manual, mixed, or none.
--name <name>Display name for the execution.
--asyncReturn immediately after queuing, without waiting for the server to confirm the execution has started. Omit to wait for the execution record to be fully created before returning.
--folder-key <uuid>Orchestrator folder to run in. Required when the test cases are linked to automations in a specific folder.
--runtime-type <type>Robot runtime type override. Accepted values: nonProduction, attended, unattended, rpaDeveloper, studioX, headless, rpaDeveloperPro, testAutomation, automationCloud, serverless, automationKit, serverlessTestAutomation, automationCloudTestAutomation, attendedStudioWeb, hosting, assistantWeb, processOrchestration, agentService, appTest, performanceTest, businessRule, caseManagement.
--robot-user-key <uuid>Robot user key for the execution target.
--machine-key <uuid>Machine key for the execution target.
--host-machine-name <name>Host machine name for the execution target.
--service-user-name <name>Service user name for the execution target.
--test-set-packages <json>JSON array of package overrides: [{"packageName":"Pkg","version":"1.0.0"}].

示例

# Simplest — run a single test case (blocks until execution record is created)
uip tm testcases run \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated \
  --name "Login smoke run"
# Simplest — run a single test case (blocks until execution record is created)
uip tm testcases run \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated \
  --name "Login smoke run"
# Run multiple test cases asynchronously, then wait for completion
id=$(uip tm testcases run \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 a1b2c3d4-0000-0000-0000-000000000002 \
  --execution-type automated \
  --name "Smoke run" \
  --async \
  --output-filter Id)

uip tm wait --execution-id "$id" --project-key DEMO --timeout 900000
uip tm report get --execution-id "$id" --project-key DEMO
# Run multiple test cases asynchronously, then wait for completion
id=$(uip tm testcases run \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 a1b2c3d4-0000-0000-0000-000000000002 \
  --execution-type automated \
  --name "Smoke run" \
  --async \
  --output-filter Id)

uip tm wait --execution-id "$id" --project-key DEMO --timeout 900000
uip tm report get --execution-id "$id" --project-key DEMO
# Full override — specify folder, runtime, machine, and package version
uip tm testcases run \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated \
  --name "Smoke run" \
  --folder-key f0f0f0f0-0000-0000-0000-000000000001 \
  --runtime-type unattended \
  --machine-key 33333333-4444-5555-6666-777777777777 \
  --test-set-packages '[{"packageName":"InvoiceTests","version":"1.0.2"}]'
# Full override — specify folder, runtime, machine, and package version
uip tm testcases run \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated \
  --name "Smoke run" \
  --folder-key f0f0f0f0-0000-0000-0000-000000000001 \
  --runtime-type unattended \
  --machine-key 33333333-4444-5555-6666-777777777777 \
  --test-set-packages '[{"packageName":"InvoiceTests","version":"1.0.2"}]'

数据形状

{
  "Code": "TestCaseRun",
  "Data": {
    "Id": "b2c3d4e5-0000-0000-0000-000000000001",
    "Name": "Login smoke run",
    "ProjectId": "00000000-0000-0000-0000-000000000abc",
    "TestSetId": "a1b2c3d4-0000-0000-0000-000000000010",
    "TestSetObjKey": "DEMO:10",
    "Status": "Running",
    "ExecutionType": "automated",
    "Source": "Manual",
    "RunId": 1,
    "FolderKey": "f0f0f0f0-0000-0000-0000-000000000001",
    "ExecutionStart": "2025-04-15T10:30:00Z",
    "EnableCoverage": false,
    "EnforceExecutionOrder": false,
    "AutopilotForRobotsSettings": { "Enabled": false },
    "OrderedExecutionSettings": { "Enabled": false },
    "VideoRecordingSettings": { "Enabled": false }
  }
}
{
  "Code": "TestCaseRun",
  "Data": {
    "Id": "b2c3d4e5-0000-0000-0000-000000000001",
    "Name": "Login smoke run",
    "ProjectId": "00000000-0000-0000-0000-000000000abc",
    "TestSetId": "a1b2c3d4-0000-0000-0000-000000000010",
    "TestSetObjKey": "DEMO:10",
    "Status": "Running",
    "ExecutionType": "automated",
    "Source": "Manual",
    "RunId": 1,
    "FolderKey": "f0f0f0f0-0000-0000-0000-000000000001",
    "ExecutionStart": "2025-04-15T10:30:00Z",
    "EnableCoverage": false,
    "EnforceExecutionOrder": false,
    "AutopilotForRobotsSettings": { "Enabled": false },
    "OrderedExecutionSettings": { "Enabled": false },
    "VideoRecordingSettings": { "Enabled": false }
  }
}

关键字段:

  • Id — 传递给uip tm waitreport getresult downloadattachment download
  • Status: "Running" — 执行可能尚未调度。
  • Source: "Manual" — 所有testcases run执行都被标记为手动触发。

端到端工作流:打包到结果

# 1. Discover your project key
uip tm project list --output json

# 2. Find the test case UUIDs you want to run
uip tm testcases list --project-key DEMO --filter "login" --output json

# 3. Find the folder that holds your package
uip or folders list --output json

# 4. Link the test case to the automation entry point
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

# 5. Run the test cases directly
id=$(uip tm testcases run \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated \
  --folder-key f0f0f0f0-0000-0000-0000-000000000001 \
  --name "PR #42 smoke" \
  --output-filter Id)

# 6. Block until done (timeout in ms — 15 minutes here)
uip tm wait \
  --execution-id "$id" \
  --project-key DEMO \
  --timeout 900000

# 7. Read the result
uip tm report get --execution-id "$id" --project-key DEMO

# 8. Download JUnit XML for CI
uip tm result download \
  --execution-id "$id" \
  --project-key DEMO \
  --result-path ./junit.xml

# 9. Download screenshots and logs
uip tm attachment download \
  --execution-id "$id" \
  --project-key DEMO \
  --only-failed \
  --result-path ./attachments
# 1. Discover your project key
uip tm project list --output json

# 2. Find the test case UUIDs you want to run
uip tm testcases list --project-key DEMO --filter "login" --output json

# 3. Find the folder that holds your package
uip or folders list --output json

# 4. Link the test case to the automation entry point
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

# 5. Run the test cases directly
id=$(uip tm testcases run \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --execution-type automated \
  --folder-key f0f0f0f0-0000-0000-0000-000000000001 \
  --name "PR #42 smoke" \
  --output-filter Id)

# 6. Block until done (timeout in ms — 15 minutes here)
uip tm wait \
  --execution-id "$id" \
  --project-key DEMO \
  --timeout 900000

# 7. Read the result
uip tm report get --execution-id "$id" --project-key DEMO

# 8. Download JUnit XML for CI
uip tm result download \
  --execution-id "$id" \
  --project-key DEMO \
  --result-path ./junit.xml

# 9. Download screenshots and logs
uip tm attachment download \
  --execution-id "$id" \
  --project-key DEMO \
  --only-failed \
  --result-path ./attachments

uip tm 测试用例添加

向现有测试集添加一个或多个测试用例。

参数

无。

选项

标记描述
--test-set-key <key>Required. Test set object key (for example, DEMO:42).
--test-case-keys <keys>Required. Comma-separated test case keys to add (for example, DEMO:1,DEMO:2).

示例

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

数据形状

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

删除 UIP TM 测试用例

从测试集中删除一个或多个测试用例。

参数

无。

选项

标记描述
--test-set-key <key>Required. Test set object key (for example, DEMO:42).
--test-case-keys <keys>Required. Comma-separated test case keys to remove (for example, DEMO:1,DEMO:2).
-y, --yesSkip the confirmation prompt. Required in non-interactive environments.

示例

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

数据形状

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

uip tm 测试用例列表步骤

列出测试用例的手动测试步骤。这是testcases steps list的别名。

参数

无。

选项

标记描述
--project-key <key>Test Manager project key (for example, DEMO).
--test-case-id <uuid>Required. Internal test case UUID.

示例

uip tm testcases list-steps \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001
uip tm testcases list-steps \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001

数据形状

{
  "Code": "TestCaseStepsList",
  "Data": [
    {
      "Id": "d4e5f6a7-0000-0000-0000-000000000001",
      "TestCaseId": "a1b2c3d4-0000-0000-0000-000000000001",
      "OrderNo": 0,
      "ActionType": "Manual",
      "Description": "Open login page",
      "ExpectedResult": "Login form is displayed"
    }
  ]
}
{
  "Code": "TestCaseStepsList",
  "Data": [
    {
      "Id": "d4e5f6a7-0000-0000-0000-000000000001",
      "TestCaseId": "a1b2c3d4-0000-0000-0000-000000000001",
      "OrderNo": 0,
      "ActionType": "Manual",
      "Description": "Open login page",
      "ExpectedResult": "Login form is displayed"
    }
  ]
}

uip tm 测试用例步骤

testcases steps是一个子组,用于管理测试用例的各个手动步骤:列出、获取、添加、更新、移动和删除。

uip tm 测试用例步骤列表

按顺序列出测试用例的步骤。

参数

无。

选项
标记描述
--project-key <key>Test Manager project key.
--test-case-id <uuid>Required. Internal test case UUID.
示例
uip tm testcases steps list \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001
uip tm testcases steps list \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001
数据形状
{
  "Code": "TestCaseStepsList",
  "Data": [
    {
      "Id": "d4e5f6a7-0000-0000-0000-000000000001",
      "OrderNo": 0,
      "ActionType": "Manual",
      "Description": "Open login page",
      "ExpectedResult": "Login form is displayed"
    }
  ]
}
{
  "Code": "TestCaseStepsList",
  "Data": [
    {
      "Id": "d4e5f6a7-0000-0000-0000-000000000001",
      "OrderNo": 0,
      "ActionType": "Manual",
      "Description": "Open login page",
      "ExpectedResult": "Login form is displayed"
    }
  ]
}

获取 UIP TM 测试用例步骤

通过 UUID 获取单个步骤。

参数

无。

选项
标记描述
--project-key <key>Test Manager project key.
--step-id <uuid>Required. Test step UUID (from steps list).
示例
uip tm testcases steps get \
  --project-key DEMO \
  --step-id d4e5f6a7-0000-0000-0000-000000000001
uip tm testcases steps get \
  --project-key DEMO \
  --step-id d4e5f6a7-0000-0000-0000-000000000001
数据形状
{
  "Code": "TestStepGet",
  "Data": {
    "Id": "d4e5f6a7-0000-0000-0000-000000000001",
    "OrderNo": 0,
    "ActionType": "Manual",
    "Description": "Open login page",
    "ExpectedResult": "Login form is displayed"
  }
}
{
  "Code": "TestStepGet",
  "Data": {
    "Id": "d4e5f6a7-0000-0000-0000-000000000001",
    "OrderNo": 0,
    "ActionType": "Manual",
    "Description": "Open login page",
    "ExpectedResult": "Login form is displayed"
  }
}

添加 uip tm 测试用例步骤

向测试用例添加一个或多个步骤。对单个步骤使用内联标志,或对多个步骤使用--step <json> (可重复)。

参数

无。

选项
标记描述
--project-key <key>Test Manager project key.
--test-case-id <uuid>Required. Test case to add steps to.
--description <text>Step description (single-step mode).
--expected-result <text>Expected outcome (single-step mode).
--action-type <type>Step action type (single-step mode).
--clipboard-data <text>Test data to copy for the step (single-step mode).
--order-no <n>0-based insert position; omit to append at the end (single-step mode).
--step <json>A step as a JSON object ({"description":"...","expectedResult":"..."}). Repeat to add several steps.
示例
# single step
uip tm testcases steps add \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --description "Open login page" \
  --expected-result "Login form is displayed"

# multiple steps
uip tm testcases steps add \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --step '{"description":"Open login page","expectedResult":"Login form is shown"}' \
  --step '{"description":"Enter credentials","clipboardData":"user@acme.com"}' \
  --step '{"description":"Click submit","expectedResult":"Dashboard loads"}'
# single step
uip tm testcases steps add \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --description "Open login page" \
  --expected-result "Login form is displayed"

# multiple steps
uip tm testcases steps add \
  --project-key DEMO \
  --test-case-id a1b2c3d4-0000-0000-0000-000000000001 \
  --step '{"description":"Open login page","expectedResult":"Login form is shown"}' \
  --step '{"description":"Enter credentials","clipboardData":"user@acme.com"}' \
  --step '{"description":"Click submit","expectedResult":"Dashboard loads"}'
数据形状
{
  "Code": "TestStepAdd",
  "Data": [
    {
      "Id": "d4e5f6a7-0000-0000-0000-000000000001",
      "OrderNo": 0,
      "Description": "Open login page",
      "ExpectedResult": "Login form is displayed"
    }
  ]
}
{
  "Code": "TestStepAdd",
  "Data": [
    {
      "Id": "d4e5f6a7-0000-0000-0000-000000000001",
      "OrderNo": 0,
      "Description": "Open login page",
      "ExpectedResult": "Login form is displayed"
    }
  ]
}

uip tm 测试用例步骤更新

更新步骤说明、预期结果、操作类型或剪贴板数据。必须至少提供其中一个字段。

参数

无。

选项
标记描述
--project-key <key>Test Manager project key.
--step-id <uuid>Required. Test step UUID.
--description <text>新说明。
--expected-result <text>New expected result.
--action-type <type>New action type.
--clipboard-data <text>New clipboard data.
示例
uip tm testcases steps update \
  --project-key DEMO \
  --step-id d4e5f6a7-0000-0000-0000-000000000001 \
  --expected-result "Dashboard is shown"
uip tm testcases steps update \
  --project-key DEMO \
  --step-id d4e5f6a7-0000-0000-0000-000000000001 \
  --expected-result "Dashboard is shown"
数据形状
{
  "Code": "TestStepUpdate",
  "Data": {
    "StepId": "d4e5f6a7-0000-0000-0000-000000000001",
    "Result": "Updated"
  }
}
{
  "Code": "TestStepUpdate",
  "Data": {
    "StepId": "d4e5f6a7-0000-0000-0000-000000000001",
    "Result": "Updated"
  }
}

uip tm 测试用例步骤移动

在测试用例顺序中,将步骤移动至新位置。

参数

无。

选项
标记描述
--project-key <key>Test Manager project key.
--step-id <uuid>Required. Test step UUID.
--target-position <n>Required. New 0-based position (0 = first). Matches the OrderNo field from steps list.
示例
uip tm testcases steps move \
  --project-key DEMO \
  --step-id d4e5f6a7-0000-0000-0000-000000000001 \
  --target-position 2
uip tm testcases steps move \
  --project-key DEMO \
  --step-id d4e5f6a7-0000-0000-0000-000000000001 \
  --target-position 2
数据形状
{
  "Code": "TestStepMove",
  "Data": {
    "StepId": "d4e5f6a7-0000-0000-0000-000000000001",
    "TargetPosition": 2,
    "Result": "Moved"
  }
}
{
  "Code": "TestStepMove",
  "Data": {
    "StepId": "d4e5f6a7-0000-0000-0000-000000000001",
    "TargetPosition": 2,
    "Result": "Moved"
  }
}

uip tm 测试用例步骤删除

从测试用例中删除步骤。这是永久性的。

参数

无。

选项
标记描述
--project-key <key>Test Manager project key.
--step-id <uuid>Required. Test step UUID.
-y, --yesRequired. Confirm this irreversible operation.
示例
uip tm testcases steps delete \
  --project-key DEMO \
  --step-id d4e5f6a7-0000-0000-0000-000000000001 \
  --yes
uip tm testcases steps delete \
  --project-key DEMO \
  --step-id d4e5f6a7-0000-0000-0000-000000000001 \
  --yes
数据形状
{
  "Code": "TestStepDelete",
  "Data": {
    "StepId": "d4e5f6a7-0000-0000-0000-000000000001",
    "Result": "Deleted"
  }
}
{
  "Code": "TestStepDelete",
  "Data": {
    "StepId": "d4e5f6a7-0000-0000-0000-000000000001",
    "Result": "Deleted"
  }
}

uip tm 测试用例日志列表断言

列出为单个测试用例日志记录的断言。每次运行测试用例都会产生一个测试用例日志;其断言是指自动化记录的各项单项检查。此动词表明测试用例日志标记为Failed原因

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

参数

无。

选项

标记描述
--test-case-log-id <uuid>Required. Test case log UUID. Get it from uip tm executions testcaselogs list or uip tm testcases list-result-history.
--project-key <key>Required. Owning project.

示例

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 }
  ]
}

uip tm 测试用例日志启动

发出信号,表示开始为执行中的特定测试用例手动输入测试用例日志。

参数

无。

选项

标记描述
--execution-id <uuid>Required. The execution in which the test case is running.
--test-case-id <uuid>Required. Internal UUID of the test case being logged.
--execution-type <type>Execution type for the log entry (for example, automated, manual). Optional.

示例

uip tm testcaselog start \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --test-case-id b2c3d4e5-0000-0000-0000-000000000001
uip tm testcaselog start \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --test-case-id b2c3d4e5-0000-0000-0000-000000000001

数据形状

{
  "Code": "TestCaseLogStart",
  "Data": {
    "TestCaseLogId": "c3d4e5f6-0000-0000-0000-000000000001",
    "Status": "InProgress"
  }
}
{
  "Code": "TestCaseLogStart",
  "Data": {
    "TestCaseLogId": "c3d4e5f6-0000-0000-0000-000000000001",
    "Status": "InProgress"
  }
}

uip tm 测试用例日志完成

表示手动开始的测试用例日志条目结束。

参数

无。

选项

标记描述
--test-case-log-id <uuid>Required. The log ID returned by testcaselog start.
--info <text>Optional error or informational message to attach to the log entry.

示例

uip tm testcaselog finish \
  --test-case-log-id c3d4e5f6-0000-0000-0000-000000000001 \
  --info "Login button not found on page"
uip tm testcaselog finish \
  --test-case-log-id c3d4e5f6-0000-0000-0000-000000000001 \
  --info "Login button not found on page"

数据形状

{
  "Code": "TestCaseLogFinish",
  "Data": {
    "TestCaseLogId": "c3d4e5f6-0000-0000-0000-000000000001",
    "Result": "Finished"
  }
}
{
  "Code": "TestCaseLogFinish",
  "Data": {
    "TestCaseLogId": "c3d4e5f6-0000-0000-0000-000000000001",
    "Result": "Finished"
  }
}
  • project — 拥有每个测试用例的作用域。
  • 测试集— 将测试用例分组到可运行的套件中。
  • executions — 测试用例日志的执行级别视图。
  • 报告— 运行摘要,包含失败案例和断言文本。

另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新