Clone Operation - Clone Test Suite

克隆测试套件

POST https://dev.azure.com/{organization}/{project}/_apis/test/Plans/{planId}/Suites/{sourceSuiteId}/cloneoperation?api-version=5.0-preview.2

URI 参数

名称 必需 类型 说明
organization
path True

string

Azure DevOps 组织的名称。

planId
path True

integer

int32

要克隆的套件所在的测试计划的 ID

project
path True

string

项目 ID 或项目名称

sourceSuiteId
path True

integer

int32

要克隆的测试套件的 ID

api-version
query True

string

要使用的 API 版本。 应将其设置为“5.0-preview.2”才能使用此版本的 API。

请求正文

名称 类型 说明
cloneOptions

CloneOptions

克隆用于克隆测试套件的选项。

destinationSuiteId

integer

套件 ID,我们必须在该 ID 下克隆套件。

destinationSuiteProjectName

string

目标套件项目名称。

响应

名称 类型 说明
200 OK

CloneOperationInformation

成功的操作

安全性

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

名称 说明
vso.test_write 授予读取、创建和更新测试计划、事例、结果和其他测试管理相关项目的能力。

示例

Sample Request

POST https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/1/Suites/{sourceSuiteId}/cloneoperation?api-version=5.0-preview.2

{
  "destinationSuiteId": 13,
  "destinationSuiteProjectName": "fabrikam-fiber-tfvc2",
  "cloneOptions": {
    "copyAncestorHierarchy": true,
    "overrideParameters": {
      "System.AreaPath": "fabrikam-fiber-tfvc2",
      "System.IterationPath": "fabrikam-fiber-tfvc2"
    }
  }
}

Sample Response

{
  "opId": 3,
  "creationDate": "0001-01-01T00:00:00",
  "completionDate": "0001-01-01T00:00:00",
  "state": "queued",
  "message": null,
  "cloneStatistics": null,
  "resultObjectType": "testSuite",
  "destinationObject": {
    "id": "14",
    "name": "simpleCloned",
    "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc2/_apis/test/Plans/13/Suites/14"
  },
  "sourceObject": {
    "id": "1",
    "name": "TestSuite1",
    "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/1/Suites/2"
  },
  "destinationPlan": {
    "id": "18",
    "name": "DestinationPlan",
    "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc2/_apis/test/Plans/18"
  },
  "sourcePlan": {
    "id": "1",
    "name": "TestPlan1",
    "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/1"
  },
  "destinationProject": {
    "name": "fabrikam-fiber-tfvc2",
    "url": "https://dev.azure.com/fabrikam/_apis/projects/fabrikam-fiber-tfvc2"
  },
  "sourceProject": {
    "name": "fabrikam-fiber-tfvc",
    "url": "https://dev.azure.com/fabrikam/_apis/projects/fabrikam-fiber-tfvc"
  },
  "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/cloneOperation/3"
}

定义

名称 说明
CloneOperationInformation

有关克隆操作的详细信息。

CloneOperationState

操作的当前状态。 当状态达到“成功”或“失败”时,操作已完成

CloneOptions
CloneStatistics
ResultObjectType

克隆操作生成的对象的类型

ShallowReference

对某些其他资源的抽象引用。 此类用于为生成数据协定提供一种统一的方式来引用其他资源,以便轻松遍历链接。

TestSuiteCloneRequest

测试套件克隆请求

CloneOperationInformation

有关克隆操作的详细信息。

名称 类型 说明
cloneStatistics

CloneStatistics

克隆统计信息

completionDate

string

如果操作已完成,则为完成日期/时间。 如果操作未完成,则为 DateTime.MaxValue

creationDate

string

开始操作的日期/时间

destinationObject

ShallowReference

目标的浅表引用

destinationPlan

ShallowReference

目标的浅表引用

destinationProject

ShallowReference

目标的浅表引用

message

string

如果操作失败,则 Message 包含失败的原因。 否则为 Null。

opId

integer

操作的 ID

resultObjectType

ResultObjectType

克隆操作生成的对象的类型

sourceObject

ShallowReference

源的浅表引用

sourcePlan

ShallowReference

源的浅表引用

sourceProject

ShallowReference

源的浅表引用

state

CloneOperationState

操作的当前状态。 当状态达到“成功”或“失败”时,操作已完成

url

string

用于获取克隆信息的 URL

CloneOperationState

操作的当前状态。 当状态达到“成功”或“失败”时,操作已完成

名称 类型 说明
failed

string

失败状态的值

inProgress

string

Inprogress 状态的值

queued

string

排队状态的值

succeeded

string

成功状态的值

CloneOptions

名称 类型 说明
cloneRequirements

boolean

如果设置为 true,则将克隆要求

copyAllSuites

boolean

从源计划复制所有套件

copyAncestorHierarchy

boolean

复制祖先 hieracrchy

destinationWorkItemType

string

克隆的工作项类型的名称

overrideParameters

object

键值对,其中键值由 值替代。

relatedLinkComment

string

对链接的注释,该链接会将新的克隆测试用例链接到原始的 Set null(无注释)

CloneStatistics

名称 类型 说明
clonedRequirementsCount

integer

到目前为止克隆的“要求”数。

clonedSharedStepsCount

integer

到目前为止克隆的共享步骤数。

clonedTestCasesCount

integer

到目前为止克隆的测试用例数

totalRequirementsCount

integer

要克隆的要求总数

totalTestCasesCount

integer

要克隆的测试用例总数

ResultObjectType

克隆操作生成的对象的类型

名称 类型 说明
testPlan

string

计划克隆

testSuite

string

套件克隆

ShallowReference

对某些其他资源的抽象引用。 此类用于为生成数据协定提供一种统一的方式来引用其他资源,以便轻松遍历链接。

名称 类型 说明
id

string

资源的 ID

name

string

链接资源的名称 (定义名称、控制器名称等)

url

string

指向资源的完整 http 链接

TestSuiteCloneRequest

测试套件克隆请求

名称 类型 说明
cloneOptions

CloneOptions

克隆用于克隆测试套件的选项。

destinationSuiteId

integer

套件 ID,我们必须在该 ID 下克隆套件。

destinationSuiteProjectName

string

目标套件项目名称。