订阅

UiPath Test Suite

UiPath Test Suite

将工具与 Test Manager 集成

概述


本主题中描述的授权方法提供有关如何在 Test Manager 与您的应用程序或其他合作伙伴应用程序之间建立服务到服务连接的信息。

先决条件


授权代码


您可以根据 UiPath 产品基础架构中使用的版本的特定用例,在两种配置外部 OAuth 客户端的方法之间进行选择:

通过身份管理配置


您可以在身份管理中注册应用程序,定义 Test Manager 作用域并在应用程序之间建立连接。

To configure and authorize your application, you need to add an external application.

When you define the API scopes for the integration, select Test Manager as a Resource. For more information, see Scopes.

通过 Test Manager CLI 配置


通过 Test Manager CLI 授权,您可以配置客户端,分配作用域,然后在应用程序之间建立服务到服务连接。

To integrate and start using your application with Test Manager, you need to configure authorization: Provision client and scopes and then get a client ID and client secret.

配置授权

要在 Test Manager 和应用程序之间建立服务到服务连接,您将使用 Test Manager 配置工具作为主要 CLI 工具,以获取客户端,为集成提供访问权限和作用域。您可以在默认安装位置中找到与每个版本一起打包的此工具 testmanager.exe,如下所示:
C:\Program Files (x86)\UiPath\TestManager\Tools\TestManagerProvisioner
Alternatively, you can find the executable in your custom installation folder. For a list of commands and options that are outside of the scope of your integration, see Test Manager Provisioning Tool Cheat Sheet.

以下部分列出了可用的命令行参数,包括选项和默认值,以便您配置访问权限和作用域,然后获取应用程序的客户端 ID 和客户端密码。

📘

注意

CommandOptionDescription
register third-party-s2sclient-iu, --identityUrl (Required)The absolute URL where Identity Server is located.
-iit, --identityInstallationToken <identityinstallationtoken> (Required)The authentication token for provisioning clients in Identity Server.
cscopes, --clientScopes <clientscopes> (Required)Show client scopes to be used when creating the client.
-cid, --clientID <clientid>Show the client ID to be used when creating the client. This is automatically generated if you do not provide a client ID.
-cname, --clientName <clientname>Show the client name to be used when creating the client. This is automatically generated if you do not provide a client name.
-csecret, --clientSecret <clientsecret>Show the client secret to be used when creating the client. This is automatically generated if you do not provide a client secret
-lang, --language <language>Specify the language of the error messages.
-?, -h?, --helpShow help and usage information.

Shell 脚本示例

在以下示例中,register third-party-s2sclient命令后跟 Orchestrator 身份 URL、身份安装令牌和 Test Manager 项目作用域。

testmanager.exe `
register third-party-s2sclient`
-iu "https://orchestratorURL/identity" `
-iit "e908741iofjikasjijfapuosf09210-012opjawdfsaodgfsadgu90029183i1jiratjapo" `
-cscopes "TM.Projects" "TM.Requirements.Read"
Client created successfully. Please note the data below right away. You will not be able to retrieve the secret afterwards.
ClientID: TestManager.ThirdPartyClient.36512487-1rfasdf-11451-321535
ClientName: TestManager.ThirdPartyClient.36512487-1rfasdf-11451-321535
ClientSecret: 43sdgj@efg145!fgdsg53125sfdg12a*gbj9

API 示例

要对 Test Manager 执行 API 调用,您可以查看以下获取 Test Manager 项目的示例。

身份管理授权的 API 调用

GET https://[test-manager-URL.com]/api/projects

Headers
    Content-Type: application/json
  Authorization: "Bearer [Oauth Access Token]"
Content-Type: application/json` `{
  "data": [
    {
      "projectPrefix": "INS",
      "id": "96a80aa7-5a7f-4117-c342-08d7add64671",
      "name": "Insurance Calculator",
      "description": "\"The virtual insurance calculator creates sample quotes for different types of insurance.\"",
      "created": "2020-02-10T07:07:33.167Z",
      "createdBy": "74dde091-4a16-4225-aea9-5c3a27b2d996",
      "updated": "2020-02-10T07:07:33.167Z",
      "updatedBy": "74dde091-4a16-4225-aea9-5c3a27b2d996"
    },
    {
      "projectPrefix": "ELI",
      "id": "609f7c5b-c798-46b1-c343-08d7add64671",
      "name": "Eligibility",
      "description": "Eligibility for credit",
      "created": "2020-02-10T09:24:18.63Z",
      "createdBy": "74dde091-4a16-4225-aea9-5c3a27b2d996",
      "updated": "2020-02-10T09:24:18.63Z",
      "updatedBy": "74dde091-4a16-4225-aea9-5c3a27b2d996"
    }
  ],
  "paging": {
    "total": 2,
    "page": 1,
    "pages": 1,
    "pageSize": 12,
    "returned": 2,
    "previousPage": false,
    "nextPage": false
  }
}

用于 Test Manager CLI 授权的 API 调用

GET https://[test-manager-URL.com]/api/projects

Headers
    Content-Type: application/json
  Authorization: "Bearer [Oauth Access Token]"
    X-UiPath-TenantGlobalId: [Tenant ID]
Content-Type: application/json
{
  "data": [
    {
      "projectPrefix": "INS",
      "id": "96a80aa7-5a7f-4117-c342-08d7add64671",
      "name": "Insurance Calculator",
      "description": "\"The virtual insurance calculator creates sample quotes for different types of insurance.\"",
      "created": "2020-02-10T07:07:33.167Z",
      "createdBy": "74dde091-4a16-4225-aea9-5c3a27b2d996",
      "updated": "2020-02-10T07:07:33.167Z",
      "updatedBy": "74dde091-4a16-4225-aea9-5c3a27b2d996"
    },
    {
      "projectPrefix": "ELI",
      "id": "609f7c5b-c798-46b1-c343-08d7add64671",
      "name": "Eligibility",
      "description": "Eligibility for credit",
      "created": "2020-02-10T09:24:18.63Z",
      "createdBy": "74dde091-4a16-4225-aea9-5c3a27b2d996",
      "updated": "2020-02-10T09:24:18.63Z",
      "updatedBy": "74dde091-4a16-4225-aea9-5c3a27b2d996"
    }
  ],
  "paging": {
    "total": 2,
    "page": 1,
    "pages": 1,
    "pageSize": 12,
    "returned": 2,
    "previousPage": false,
    "nextPage": false
  }
}

2 个月前更新


将工具与 Test Manager 集成


建议的编辑仅限用于 API 参考页面

您只能建议对 Markdown 正文内容进行编辑,而不能建议对 API 规范进行编辑。