Test Suite
2023.4
False
横幅背景图像
Test Suite 用户指南
上次更新日期 2024年2月28日

作业

UiPath 安装平台

在以下情况下,您可以使用 UiPathInstallPlatform 任务:

  • 您想要下载其他版本的 CLI,以便打包 Windows 和跨平台项目等。
  • 构建代理无权访问 UiPath NuGet 订阅源。

    您应该在插件中的任何其他任务之前执行 UiPathInstallPlatform 任务。 仅当缓存中没有兼容版本时, UiPath 安装平台 任务才会从 NuGet 公共订阅源下载 CLI。



CLI 版本选择器

从“ 选择 CLI 版本” 下拉列表中,选择要与 Azure DevOps 扩展一起使用的 CLI 版本。

下拉列表中的选项包括:

  • CLI 的最新可用版本。
  • 与所选 CLI 版本兼容所需的环境要求。


CLI 的 nupkg 的路径

如果您的管道无法访问 UiPath 公共订阅源,并且无法下载您从下拉列表中选择的 CLI 版本,请按照以下步骤操作:

  1. UiPath 公共订阅源中下载所需的 CLI 版本。
  2. 将下载的 NUPKG 文件放置在构建代理的代理工作区目录中。 请记住 NUPKG 文件在代理工作区目录中的路径。 例如, ${WORKSPACE}\nupkg\UiPath.CLI.xx.xx.xx.nupkg

    使用 InstallPlatform 任务,并在“ CLI 的 nupkg 路径” 字段中输入步骤 2 中使用的路径

UiPath 运行作业

“UiPath 运行作业”构建后步骤将启动已在 Orchestrator 实例上部署的流程。在 Orchestrator 2020.10 版本中,您可以在“流程”选项卡中找到此任务运行的流程。在 Orchestrator 2021.10 及更高版本中,您可以在“流程”下的“自动化”中找到此任务运行的流程。



配置

作业参数

描述

流程(必填)

流程名称。 您可以从 Orchestrator 用户界面获取流程名称。

如果流程部署在新式文件夹中,则此参数应为“流程”选项卡中的 流程 名称。 如果流程部署在传统文件夹中,则参数必须由流程的 名称环境 组成(例如: NAME: ProcessA ENVIRONMENT: Production ProcessName: ProcessA_Production )。

参数

JSON 输入文件的完整路径。 当流程需要输入时使用。

优先级

运行作业优先级。

策略

指定作业运行策略、已动态分配的作业,或者机器人指定的作业。选择以下选项之一:

  • 动态分配
  • 特定机器人

作业类型 (仅适用于新式文件夹)

选择要用于执行作业的运行时的许可模式。

Orchestrator 地址

您将在其中运行流程的 Orchestrator 实例的地址。

Orchestrator 租户

指定 Orchestrator 租户。

Orchestrator 文件夹

指定部署指定流程的文件夹。
要输入子文件夹,请确保同时输入父文件夹的名称和子文件夹的名称。例如,AccountingTeam\TeamJohn

身份验证

要对 Orchestrator 进行身份验证,您需要预先在 Jenkins 中创建凭据。 有四个用于身份验证的选项:

(1) 使用用户名和密码对本地部署 Orchestrator 进行身份验证。

( 2 ) 使用刷新令牌(API 密钥)对 Cloud Orchestrator 进行身份验证。

(3) 使用外部应用身份验证对 Cloud Orchestrator 进行身份验证。

(4) 使用外部应用程序身份验证向本地部署 Orchestrator 进行身份验证

作业结果输出路径

指定作业结果的输出路径(例如testResults.json )。 结果以 JSON 格式输出。
若未获指定,结果将以 UiPathResults.json 形式输出到工件阶段目录中。输出结果为 JSON 格式。

超时

指定作业运行的超时时间 (以秒为单位)。

作业失败即失败

至少有一个作业失败时,任务失败。默认值为 TRUE

等待作业完成

等待作业运行完成。默认值为 TRUE

追踪日志记录级别

用于启用跟踪日志记录的设置为以下级别之一:

  • 重要事项
  • 错误
  • Warning
  • 信息
  • 详细。 (默认设置为“ ”)。

    可用于调试目的。

作业数

作业运行数。默认值为 1

用户(仅适用于新式文件夹)

用户名。此用户不可为计算机用户或 Orchestrator 用户。

对于本地用户,格式应为 MachineName\UserName

计算机(仅适用于新式文件夹)

计算机名称。

机器人名称

指定机器人名称的逗号分隔列表。

管道示例

pipeline {
  agent any
  environment {
      MAJOR = '1'
      MINOR = '0'
  }
  stages {
    stage ('Build') {
        UiPathRunJob(
          credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'),
          failWhenJobFails: true,
          folderName: 'A_Classic',
          orchestratorAddress: 'https://testorchestrator.some-domain.com',
          orchestratorTenant: 'Default',
          parametersFilePath: '',
          priority: 'Low',
          processName: 'ProcessA_EnvB',
          resultFilePath: 'output.json',
          strategy: Dynamically(jobsCount: 1, machine: 'TestMachine', user: 'TestUser'), timeout: 3600, waitForJobCompletion: true, traceLoggingLevel: 'None'
        )
        UiPathRunJob(
          credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'),
          failWhenJobFails: true,
          folderName: 'A_Classic',
          orchestratorAddress: 'https://testorchestrator.some-domain.com',
          orchestratorTenant: 'Default',
          parametersFilePath: '',
          priority: 'Low',
          processName: 'ProcessA_EnvB',
          resultFilePath: 'output.json',
          strategy: Robot('robot1,robot2'),
          timeout: 1800,
          waitForJobCompletion: false,
          traceLoggingLevel: 'None'
        )
    }
  }
}pipeline {
  agent any
  environment {
      MAJOR = '1'
      MINOR = '0'
  }
  stages {
    stage ('Build') {
        UiPathRunJob(
          credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'),
          failWhenJobFails: true,
          folderName: 'A_Classic',
          orchestratorAddress: 'https://testorchestrator.some-domain.com',
          orchestratorTenant: 'Default',
          parametersFilePath: '',
          priority: 'Low',
          processName: 'ProcessA_EnvB',
          resultFilePath: 'output.json',
          strategy: Dynamically(jobsCount: 1, machine: 'TestMachine', user: 'TestUser'), timeout: 3600, waitForJobCompletion: true, traceLoggingLevel: 'None'
        )
        UiPathRunJob(
          credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'),
          failWhenJobFails: true,
          folderName: 'A_Classic',
          orchestratorAddress: 'https://testorchestrator.some-domain.com',
          orchestratorTenant: 'Default',
          parametersFilePath: '',
          priority: 'Low',
          processName: 'ProcessA_EnvB',
          resultFilePath: 'output.json',
          strategy: Robot('robot1,robot2'),
          timeout: 1800,
          waitForJobCompletion: false,
          traceLoggingLevel: 'None'
        )
    }
  }
}

JSON 输入文件

要配置“ 运行作业” 任务,请输入一个 JSON 文件,其中包含在 Orchestrator 中运行流程所需的参数。 Orchestrator 仅验证原始值。 下面概述了可传递到 Orchestrator 的输入参数的所需格式:

参数所需格式示例
字符串用引号将值括起来。'string value'
Int32像提供任何整数一样提供值。 11
布尔值提供 truefalse形式的值。 true
Double提供浮点值。3.5
Datetime提供有效的 JSON 表示。"2012-04-23T18:25:43.511Z"
数组以有效 JSON 的形式提供值。[1,1,2,3,5,8] 或者 ["firstString", "secondString"]

JSON 架构示例

以下是 JSON 架构示例,显示了如何在 JSON 文件中输入所需参数。 确保用于将流程发布到 Orchestrator 的 Studio 项目中存在 JSON 文件中传递的参数。

{
    'in_JenkinsBaseUrl': 'http://localhost:8080/jenkins/',
    'in_JenkinsBuildName': '02_UiPathApplicationDemo'
}{
    'in_JenkinsBaseUrl': 'http://localhost:8080/jenkins/',
    'in_JenkinsBuildName': '02_UiPathApplicationDemo'
}

UiPath 管理资产

UiPath 管理资产 ”步骤使您能够部署、更新或删除 Orchestrator 实例上的资产。 要部署资产,您必须在 CSV 文件中对其进行描述,如下例中以uft-8编码的文件所示。
name,type,value,description
asset_1_name,text,asset_value,this is an test description   # we can have comments
asset_2_name,integer,123
asset_3_name,boolean,false
asset_4_name,credential,"username::password"name,type,value,description
asset_1_name,text,asset_value,this is an test description   # we can have comments
asset_2_name,integer,123
asset_3_name,boolean,false
asset_4_name,credential,"username::password"

资产分为四种类型:

  • 文本
  • 整数
  • 布尔值
  • 凭据。对于凭据,您必须通过使用 :: 分隔两个字段来对用户名和密码进行编码。


配置

作业参数

描述

操作

如何处理提供的资产:部署或删除。 如果已部署的资产存在,则系统将对其进行更新。

Orchestrator 地址

您将在其中部署或更新资产的 Orchestrator 实例的地址。

Orchestrator 租户

指定系统用以对资产进行部署或更新的 Orchestrator 租户。

Orchestrator 文件夹

指定将部署或更新资产的文件夹。

要输入子文件夹,请确保同时输入父文件夹的名称和子文件夹的名称。例如,AccountingTeam\TeamJohn

身份验证

要对 Orchestrator 进行身份验证,您需要预先在 Jenkins 中创建凭据。 有四个用于身份验证的选项:

(1) 使用用户名和密码对本地部署 Orchestrator 进行身份验证。

( 2 ) 使用刷新令牌(API 密钥)对 Cloud Orchestrator 进行身份验证。

(3) 使用外部应用身份验证对 Cloud Orchestrator 进行身份验证。

(4) 使用外部应用程序身份验证向本地部署 Orchestrator 进行身份验证

CSV 文件路径

包含资产详细信息的 CSV 文件的路径。 同一文件可用于部署或更新资产,但更新不需要该类型。

type字段也可以为空,但列必须存在。 对于删除,仅使用name列,因此其他列可以为空,但必须存在。
您可以为每个资产设置可选说明(例如: typevaluedescription )。 请确保删除所有换行符,因为每一行都将被解释为新资产。

追踪日志记录级别

用于启用跟踪日志记录的设置为以下级别之一:

  • 重要事项
  • 错误
  • Warning
  • 信息
  • 详细。 (默认设置为“ ”)。

    可用于调试目的。

管道示例

pipeline {
  agent any
  environment {
      MAJOR = '1'
      MINOR = '0'
  }
  stages {
    stage ('Build') {
        UiPathAssets (
            assetsAction: DeployAssets(), 
            credentials: Token(accountName: '', credentialsId: ''), 
            filePath: '${WORKSPACE}/test.csv', 
            folderName: 'Default', 
            orchestratorAddress: 'https://test-orchestrator.somedomain.com', 
            orchestratorTenant: 'Default',
            traceLoggingLevel: 'None'
        )
        UiPathAssets(
            assetsAction: DeleteAssets(),
            credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'),
            filePath: '${WORKSPACE}/test.csv',
            folderName: 'Default',
            orchestratorAddress: 'https://test-orchestrator.somedomain.com',
            orchestratorTenant: 'Default',
            traceLoggingLevel: 'None'
        )
    }
  }
}pipeline {
  agent any
  environment {
      MAJOR = '1'
      MINOR = '0'
  }
  stages {
    stage ('Build') {
        UiPathAssets (
            assetsAction: DeployAssets(), 
            credentials: Token(accountName: '', credentialsId: ''), 
            filePath: '${WORKSPACE}/test.csv', 
            folderName: 'Default', 
            orchestratorAddress: 'https://test-orchestrator.somedomain.com', 
            orchestratorTenant: 'Default',
            traceLoggingLevel: 'None'
        )
        UiPathAssets(
            assetsAction: DeleteAssets(),
            credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'),
            filePath: '${WORKSPACE}/test.csv',
            folderName: 'Default',
            orchestratorAddress: 'https://test-orchestrator.somedomain.com',
            orchestratorTenant: 'Default',
            traceLoggingLevel: 'None'
        )
    }
  }
}

UiPath 包

应用程序: RPA

类型: 构建任务

UiPath Pack 在标准作业和管道中提供,可用于将现有 UiPath 项目打包到 NuGet 包中。



配置

作业参数

描述

选择版本控制方法

UiPath 包已进行版本控制。 使用 UiPath 包,您可以在 3 个不同的选项之间进行选择:

(1) 自动生成

(2) 定义自定义版本

(3) 使用项目中设置的当前版本。

项目路径

待打包项目所在位置。该位置可为 project.json 文件的直接路径,或包含一个或多个项目的目录。如果是后者,则针对每个级别,系统均会分别打包每个项目。

OutputFolder

要在其中创建包的文件夹的路径。

输出类型

项目的输出类型。 项目类型有 5 个选项:

(1) 项目的输出类型

(2) 打包流程项目

(3) 打包库项目

(4) 打包测试项目

(5) 打包对象项目。

运行工作流分析

在打包之前运行工作流分析,通过预定义的规则检查项目是否存在违规行为。 在出现错误时使作业失败。 默认情况下,不运行分析。

追踪日志记录级别

用于启用跟踪日志记录的设置为以下级别之一:

  • 重要事项
  • 错误
  • Warning
  • 信息
  • 详细。 (默认设置为“ ”)。

    可用于调试目的。

使用 Orchestrator

打包库时使用 Orchestrator 订阅源。 Orchestrator 必须为 20.4 或更高版本。 库订阅源需要允许在“ 租户 ” >“ 设置 ” >“ 部署”中进行 API 密钥身份验证。

Orchestrator 地址

还原库依赖项的 Orchestrator 实例地址。

Orchestrator 租户

应从中还原库依赖项的 Orchestrator 租户。

身份验证

要对 Orchestrator 进行身份验证,您需要预先在 Jenkins 中创建凭据。 有四个用于身份验证的选项:

(1) 使用用户名和密码对本地部署 Orchestrator 进行身份验证。

( 2 ) 使用刷新令牌(API 密钥)对 Cloud Orchestrator 进行身份验证。

(3) 使用外部应用身份验证对 Cloud Orchestrator 进行身份验证。

(4) 使用 外部应用身份验证对本地部署 Orchestrator 进行身份验证。

管道示例

ipeline {
  agent any
  environment {
      MAJOR = '1'
      MINOR = '0'
  }
  stages {
    stage ('Build') {
      steps {
        UiPathPack (
          outputPath: "Output\)\)\)\)${env.BUILD_NUMBER}",
          projectJsonPath: "UiBank\)\)\)\)project.json",
          version: [$class: 'ManualVersionEntry', version: "${MAJOR}.${MINOR}.${env.BUILD_NUMBER}"]
          useOrchestrator: true,
          traceLoggingLevel: "None",
          orchestratorAddress: "OrchestratorUrl",
          orchestratorTenant: "tenant name",
          credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: “credentialsId”]
        )
      }
    }
  }
}ipeline {
  agent any
  environment {
      MAJOR = '1'
      MINOR = '0'
  }
  stages {
    stage ('Build') {
      steps {
        UiPathPack (
          outputPath: "Output\)\)\)\)${env.BUILD_NUMBER}",
          projectJsonPath: "UiBank\)\)\)\)project.json",
          version: [$class: 'ManualVersionEntry', version: "${MAJOR}.${MINOR}.${env.BUILD_NUMBER}"]
          useOrchestrator: true,
          traceLoggingLevel: "None",
          orchestratorAddress: "OrchestratorUrl",
          orchestratorTenant: "tenant name",
          credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: “credentialsId”]
        )
      }
    }
  }
}

UiPath 部署

应用程序: RPA

类型: 构建后任务

UiPath Deploy 在标准作业和管道中提供,可让您将 UiPath NuGet 包部署到 UiPath Orchestrator 上。



配置

作业参数

描述

包路径

包含 UiPath Nuget 包的文件夹。

Orchestrator 地址

用以对包进行部署的 Orchestrator 实例地址。

Orchestrator 租户

用以对包进行部署的 Orchestrator 租户。

Orchestrator 文件夹

待部署的文件夹。如果此文件夹为传统文件夹,您还将需要设置 environments 字段。对于新式文件夹,则无需设置 environments 字段。
要输入子文件夹,请确保同时输入父文件夹的名称和子文件夹的名称。例如,AccountingTeam\TeamJohn

环境 (传统文件夹为必需

将包部署为流程的环境。对于包含现有流程的项目和环境,系统将更新流程,使其使用最新的项目版本。指定系统将包部署为流程的环境。对于包含现有流程的项目和环境,系统将更新流程,使其使用最新的项目版本。

入口点

指定入口点以创建或更新流程。入口点指定从项目根目录开始的 filePath。

条件:

  • 入口点可用于 Orchestrator 21.4 或更高版本(例如 21.4.UiPathDeploy.entryPoints)。对于低于 21.4 的 Orchestrator 版本,您需要输入任何值,因为该字段不得留空。
  • 默认入口点设置为 Main.xaml
  • 对于传统文件夹(已弃用),您只能为每个环境指定一个入口点。
  • 有关详细信息,请参阅“Orchestrator 入口点”。

身份验证

要对 Orchestrator 进行身份验证,您需要预先在 Jenkins 中创建凭据。 有四个用于身份验证的选项:

(1) 使用用户名和密码对本地部署 Orchestrator 进行身份验证。

( 2 ) 使用刷新令牌(API 密钥)对 Cloud Orchestrator 进行身份验证。

(3) 使用外部应用身份验证对 Cloud Orchestrator 进行身份验证。

(4) 使用外部应用程序身份验证向本地部署 Orchestrator 进行身份验证

追踪日志记录级别

用于启用跟踪日志记录的设置为以下级别之一:

  • 重要事项
  • 错误
  • Warning
  • 信息
  • 详细。 (默认设置为“ ”)。

    可用于调试目的。

备注:

确保您的网络允许访问以下 NuGet 包订阅源:

  • https://api.nuget.org/v3/index.json
  • https://uipath.pkgs.visualstudio.com/_packaging/nuget-packages/nuget/v3/index.json
  • https://uipath.pkgs.visualstudio.com/Public.Feeds/_packaging/UiPath-* Internal/nuget/v3/index.json
  • https://www.myget.org/F/workflow
  • http://www.myget.org/F/uipath
  • https://www.myget.org/F/uipath-dev/api/v3/index.json

管道示例

pipeline {
  agent any
  environment {
      MAJOR = '1'
      MINOR = '0'
  }
  stages {
    stage ('PostBuild') {
      steps {
        UiPathDeploy (
          packagePath: "path\)\)\)    o\)\)NuGetpackage",
          orchestratorAddress: "OrchestratorUrl",
          orchestratorTenant: "tenant name",
          folderName: "folder name",
          environments: "environment",
          credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: “credentialsId”],
          traceLoggingLevel: 'None'
        )
      }
    }
  }
}pipeline {
  agent any
  environment {
      MAJOR = '1'
      MINOR = '0'
  }
  stages {
    stage ('PostBuild') {
      steps {
        UiPathDeploy (
          packagePath: "path\)\)\)    o\)\)NuGetpackage",
          orchestratorAddress: "OrchestratorUrl",
          orchestratorTenant: "tenant name",
          folderName: "folder name",
          environments: "environment",
          credentials: [$class: 'UserPassAuthenticationEntry', credentialsId: “credentialsId”],
          traceLoggingLevel: 'None'
        )
      }
    }
  }
}

UiPath 运行测试

应用程序:测试

类型: 构建后任务

UiPath Run 测试 可在标准作业和管道中使用,并允许您:

  • 在 Orchestrator 中运行现有测试集。
  • 通过指定 UiPath 测试项目的路径,打包、部署和运行测试用例。

测试运行完成后,“ 测试结果 ” 选项卡将发布到 Jenkins 内部版本,并显示详细结果。 此外,系统还会在测试结果输出路径(如果指定)中创建 JUnit 测试结果文件,如果未指定,则会在工作区根目录中创建。

根据结果,构建将被标记为成功(所有测试用例都通过)或不稳定(至少一个测试用例失败)。



配置

作业参数

描述

目标

  • 在 UiPath Orchestrator 上指定现有测试集(以执行测试集)。
  • 提供 UiPath 测试项目的project.json路径(以执行测试项目)。

测试结果输出路径

已执行的测试集将测试结果返回为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 上的执行完成并返回结果之前超时,则构建将取消并标记为失败。

追踪日志记录级别

用于启用跟踪日志记录的设置为以下级别之一:

  • 重要事项
  • 错误
  • Warning
  • 信息
  • 详细。 (默认设置为“ ”)。

    可用于调试目的。

管道示例

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

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.