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

Test Manager SDK 入门

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

先决条件

授权代码

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

通过身份管理配置

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

要配置和授权您的应用程序,您需要添加外部应用程序

定义集成的作用域时,选择“Test Manager”作为“资源”。有关详细信息,请参阅“作用域”

通过 Test Manager CLI 配置

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

要将应用程序与 Test Manager 集成并开始使用,您需要配置授权:配置客户端和作用域,然后获取客户端 ID 和客户端密码。

配置授权

要在 Test Manager 和应用程序之间建立服务到服务连接,您将使用 Test Manager 配置工具作为主要 CLI 工具,以获取客户端,为集成提供访问权限和作用域。您可以在默认安装位置中找到与每个版本一起打包的此工具 testmanager.exe,如下所示:

C:\Program Files (x86)\UiPath\TestManager\Tools\TestManagerProvisioner

或者,您可以在自定义安装文件夹中找到可执行文件。 有关超出集成范围的命令和选项的列表,请参阅 。

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

备注:

命令

选项

描述

register third-party-s2sclient

-iu, --identityUrl (必填)

Identity Server 所在的绝对 URL。

 
-iit, --identityInstallationToken <identityinstallationtoken> (必填)

用于在 Identity Server 中预配客户端的认证令牌。

 
cscopes, --clientScopes <clientscopes> (必填)

显示创建客户端时要使用的客户端作用域。

 

`-cid, --clientID

<客户端 ID>`

显示创建客户端时要使用的客户端 ID。如果您不提供客户端 ID,系统会自动将其生成。

 

-cname, --clientName <clientname>

显示创建客户端时要使用的客户端名称。如果您不提供客户端名称,则会自动生成此字段。

 

-csecret, --clientSecret <clientsecret>

显示创建客户端时要使用的客户端密码。如果您不提供客户端密码,系统会自动将其生成

 

-lang, --language <language>

指定错误消息的语言。

 

-?, -h?, --help

显示帮助和用法信息。

Shell 脚本示例

在以下示例中,register third-party-s2sclient命令后跟 Orchestrator 身份 URL、身份安装令牌和 Test Manager 项目作用域。
testmanager.exe <code>
register third-party-s2sclient</code>
-iu "https://orchestratorURL/identity" <code>
-iit "e908741iofjikasjijfapuosf09210-012opjawdfsaodgfsadgu90029183i1jiratjapo" </code>
-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*gbj9testmanager.exe <code>
register third-party-s2sclient</code>
-iu "https://orchestratorURL/identity" <code>
-iit "e908741iofjikasjijfapuosf09210-012opjawdfsaodgfsadgu90029183i1jiratjapo" </code>
-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 调用

获取 https://[test-manager-URL.com]/api/projects
Headers
    Content-Type: application/json
  Authorization: "Bearer [Oauth Access Token]"Content-Type: application/json<code> </code>{
  "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
  }
}Headers
    Content-Type: application/json
  Authorization: "Bearer [Oauth Access Token]"Content-Type: application/json<code> </code>{
  "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 调用

获取 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
  }
}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
  }
}

此页面是否有帮助?

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