- 概述
 - UiPath CLI
 - Azure DevOps 扩展程序
 - Jenkins 插件
 

CI/CD 集成用户指南
UiPath 运行测试
Application: Testing
Type: Post-Build task
UiPath Run tests is available in standard jobs and pipelines, and lets you:
- 在 Orchestrator 中运行现有测试集。
 - 通过指定 UiPath 测试项目的路径,打包、部署和运行测试用例。
 
After the test run has finished, the Test Result tab is published to the Jenkins build, showing the detailed results. Additionally, a JUnit test results file is created to the test result output path, when specified, or to the workspace root if not specified.
根据结果,构建将被标记为成功(所有测试用例都通过)或不稳定(至少一个测试用例失败)。

配置
|   作业参数  |   描述  | 
|---|---|
|   目标  |  
  | 
|   测试结果输出路径  |   执行的测试集将测试结果返回为junit.xml 。指定应存储结果的路径,该路径相对于 Jenkins 工作区目录(例如result.xml )。  | 
|   输入参数  |   为测试用例定义自定义参数,以覆盖测试集级别的默认值。通过参数,您可以在运行时参数化测试用例。要定义参数,您需要发布包含参数的包。  | 
|   Orchestrator 地址  |   用以对包进行部署的 Orchestrator 实例地址。  | 
|   Orchestrator 租户  |   用以对包进行部署的 Orchestrator 租户。  | 
|   Orchestrator 文件夹  |   待部署的文件夹。 environments字段。对于新式文件夹,设置environments 。非必填项。要输入子文件夹,请确保同时输入父文件夹的名称和子文件夹的名称。例如,使用AccountingTeam\TeamJohn 。  | 
|   环境(对于传统文件夹为必需)  |   将包部署为流程的环境。对于包含现有流程的项目和环境,系统将更新流程,使其使用最新的项目版本。指定系统将包部署为流程的环境。对于包含现有流程的项目和环境,系统将更新流程,使其使用最新的项目版本。  | 
|   身份验证  |   要对 Orchestrator 进行身份验证,您需要预先在 Jenkins 中创建凭据。 有四个用于身份验证的选项: (1) 使用用户名和密码对本地部署 Orchestrator 进行身份验证。 ( 2 ) 使用刷新令牌(API 密钥)对 Cloud Orchestrator 进行身份验证。 ( 3 ) 使用外部应用身份验证对 Cloud Orchestrator 进行身份验证。 ( 4 ) 使用 对本地部署 Orchestrator 进行身份验证。  | 
|   超时 (秒)  |   测试运行的执行超时。 默认值为 7200 秒。 如果在 Orchestrator 上的执行完成并返回结果之前超时,则构建将取消并标记为失败。  | 
|   追踪日志记录级别  |   用于启用跟踪日志记录的设置为以下级别之一: 
  | 
管道示例
pipeline {  agent any  environment {    MAJOR = '1'    MINOR = '0'  }  stages {    stage ('PostBuild') {      steps {        UiPathTest (          testTarget: [$class: 'TestSetEntry', testSet: "My Test Set"],          orchestratorAddress: "OrchestratorUrl",          orchestratorTenant: "tenant name",          folderName: "folder name",          timeout: "10000",          traceLoggingLevel: 'None',          testResultsOutputPath: "result.xml",          credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: "credentialsId"]        )      }    }  }}pipeline {  agent any  environment {    MAJOR = '1'    MINOR = '0'  }  stages {    stage ('PostBuild') {      steps {        UiPathTest (          testTarget: [$class: 'TestSetEntry', testSet: "My Test Set"],          orchestratorAddress: "OrchestratorUrl",          orchestratorTenant: "tenant name",          folderName: "folder name",          timeout: "10000",          traceLoggingLevel: 'None',          testResultsOutputPath: "result.xml",          credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: "credentialsId"]        )      }    }  }}