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

UiPath CLI 用户指南

UIP TM 结果

uip tm result以 CI 友好的结构化格式下载执行工件。目前,它有一个动词,用于写入 JUnit XML 文件,这是大多数 CI 测试仪表板(Azure DevOps、Jenkins、GitLab、Robot CI)使用的通用语。

大纲

uip tm result download --execution-id <uuid> (--project-key <key> | --test-set-key <key>) [--result-path <path>]
uip tm result download --execution-id <uuid> (--project-key <key> | --test-set-key <key>) [--result-path <path>]

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

uip tm 结果下载

将单个测试执行的结果下载为 JUnit XML 报告。该命令:

  1. 获取执行的统计信息、测试集名称和测试集 ID。
  2. 逐页附加到执行的每个测试用例日志。
  3. 对于每个日志,并行获取每个断言的工件(记录断言查找失败,并跳过这些失败,并非严重失败)。
  4. 获取测试集的包列表(尽最大努力 — 静默省略缺少的包)。
  5. 将所有内容序列化为 JUnit XML 并将其写入--result-path

XML 中的“链接”和“web-URL”字段使用当前会话的组织缩略名和租户名称指回 Test Manager 网页用户界面。

参数

无。

选项

  • --execution-id <uuid> (必填) — 执行下载。
  • --project-key <key> — 拥有项目。此参数或--test-set-key为必填项。
  • --test-set-key <key> — 测试集密钥(例如DEMO:42 );项目键从前缀派生。
  • --result-path <path> — 输出位置。可以是文件 ( ./junit.xml ) 或目录(文件以测试集命名)。默认为当前工作目录。

示例

uip tm result download \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO \
  --result-path ./junit.xml
uip tm result download \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO \
  --result-path ./junit.xml

数据形状

{
  "Code": "ResultDownload",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "Format": "junit",
    "OutputPath": "./junit.xml",
    "TotalTests": 10,
    "Passed": 8,
    "Failed": 2,
    "Cancelled": 0
  }
}
{
  "Code": "ResultDownload",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "Format": "junit",
    "OutputPath": "./junit.xml",
    "TotalTests": 10,
    "Passed": 8,
    "Failed": 2,
    "Cancelled": 0
  }
}

实际的 JUnit XML 将写入OutputPath 。JSON 信封仅报告成功情况以及计数摘要。

备注:

目前,输出格式固定为 JUnit XML。信封中包含Format ,以便未来的版本可以添加更多格式(例如 NUnit 或 TRX),而不会对形状进行重大更改。

在 CI 中使用输出

使用 CI 提供的任何测试报告程序任务发布 XML 文件。典型模式:

# Azure DevOps
- task: PublishTestResults@2
  inputs:
    testResultsFormat: JUnit
    testResultsFiles: junit.xml
# Azure DevOps
- task: PublishTestResults@2
  inputs:
    testResultsFormat: JUnit
    testResultsFiles: junit.xml
# GitHub Actions (via a community action)
- uses: dorny/test-reporter@v1
  with:
    name: Test Manager
    path: junit.xml
    reporter: java-junit
# GitHub Actions (via a community action)
- uses: dorny/test-reporter@v1
  with:
    name: Test Manager
    path: junit.xml
    reporter: java-junit
  • 运行测试集— 生成此处使用的ExecutionId
  • 等待— 阻止直到执行处于最终状态,然后再下载结果。
  • 报告— 如果您不需要 JUnit XML,则提供人类可读的摘要(相同数据,不同形式)。
  • 附件— 下载测试用例日志生成的屏幕截图、日志和文件。

另请参阅

  • 大纲
  • uip tm 结果下载
  • 参数
  • 选项
  • 示例
  • 数据形状
  • 在 CI 中使用输出
  • 相关内容
  • 另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新