Clone Operation - Clone Test Plan

Clone test plan

POST https://{instance}/{collection}/{project}/_apis/test/Plans/{planId}/cloneoperation?api-version=5.0-preview.2

URI Parameters

Name In Required Type Description
collection
path True

string

The name of the Azure DevOps collection.

instance
path True

string

Azure DevOps server name ({server:port})

planId
path True

integer

int32

ID of the test plan to be cloned.

project
path True

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '5.0-preview.2' to use this version of the api.

Request Body

Name Type Description
destinationTestPlan

TestPlan

The test plan resource.

options

CloneOptions

suiteIds

integer[]

Responses

Name Type Description
200 OK

CloneOperationInformation

successful operation

Security

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

Name Description
vso.test_write Grants the ability to read, create, and update test plans, cases, results and other test management related artifacts.

Examples

Sample Request

POST https://{instance}/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/1/cloneoperation?api-version=5.0-preview.2

{
  "destinationTestPlan": {
    "name": "DestinationSuite",
    "Project": {
      "Name": "fabrikam-fiber-tfvc2"
    }
  },
  "options": {
    "copyAncestorHierarchy": true,
    "copyAllSuites": true,
    "overrideParameters": {
      "System.AreaPath": "fabrikam-fiber-tfvc2",
      "System.IterationPath": "fabrikam-fiber-tfvc2"
    }
  },
  "suiteIds": [
    2
  ]
}

Sample Response

{
  "opId": 2,
  "creationDate": "0001-01-01T00:00:00",
  "completionDate": "0001-01-01T00:00:00",
  "state": "queued",
  "message": null,
  "cloneStatistics": null,
  "resultObjectType": "testPlan",
  "destinationObject": {
    "id": "18",
    "name": "DestinationPlan",
    "url": "https://fabrikam:8080/tfs/fabrikam-fiber-tfvc2/_apis/test/Plans/18"
  },
  "sourceObject": {
    "id": "1",
    "name": "TestPlan1",
    "url": "https://fabrikam:8080/tfs/fabrikam-fiber-tfvc/_apis/test/Plans/1"
  },
  "destinationPlan": {
    "id": "18",
    "name": "DestinationPlan",
    "url": "https://fabrikam:8080/tfs/fabrikam-fiber-tfvc2/_apis/test/Plans/18"
  },
  "sourcePlan": {
    "id": "1",
    "name": "TestPlan1",
    "url": "https://fabrikam:8080/tfs/fabrikam-fiber-tfvc/_apis/test/Plans/1"
  },
  "destinationProject": {
    "name": "fabrikam-fiber-tfvc2",
    "url": "https://fabrikam:8080/tfs/_apis/projects/fabrikam-fiber-tfvc2"
  },
  "sourceProject": {
    "name": "fabrikam-fiber-tfvc",
    "url": "https://fabrikam:8080/tfs/_apis/projects/fabrikam-fiber-tfvc"
  },
  "url": "https://fabrikam:8080/tfs/fabrikam-fiber-tfvc/_apis/test/cloneOperation/2"
}

Definitions

Name Description
CloneOperationInformation

Detail About Clone Operation.

CloneOperationState

Current state of the operation. When State reaches Suceeded or Failed, the operation is complete

CloneOptions
CloneStatistics
IdentityRef
ReferenceLinks

The class to represent a collection of REST reference links.

ReleaseEnvironmentDefinitionReference

Reference to release environment resource.

ResultObjectType

The type of the object generated as a result of the Clone operation

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

TestOutcomeSettings

Test outcome settings

TestPlan

The test plan resource.

TestPlanCloneRequest

CloneOperationInformation

Detail About Clone Operation.

Name Type Description
cloneStatistics

CloneStatistics

Clone Statistics

completionDate

string

If the operation is complete, the DateTime of completion. If operation is not complete, this is DateTime.MaxValue

creationDate

string

DateTime when the operation was started

destinationObject

ShallowReference

Shallow reference of the destination

destinationPlan

ShallowReference

Shallow reference of the destination

destinationProject

ShallowReference

Shallow reference of the destination

message

string

If the operation has Failed, Message contains the reason for failure. Null otherwise.

opId

integer

The ID of the operation

resultObjectType

ResultObjectType

The type of the object generated as a result of the Clone operation

sourceObject

ShallowReference

Shallow reference of the source

sourcePlan

ShallowReference

Shallow reference of the source

sourceProject

ShallowReference

Shallow reference of the source

state

CloneOperationState

Current state of the operation. When State reaches Suceeded or Failed, the operation is complete

url

string

Url for geting the clone information

CloneOperationState

Current state of the operation. When State reaches Suceeded or Failed, the operation is complete

Name Type Description
failed

string

value for Failed State

inProgress

string

value for Inprogress state

queued

string

Value for Queued State

succeeded

string

value for Success state

CloneOptions

Name Type Description
cloneRequirements

boolean

If set to true requirements will be cloned

copyAllSuites

boolean

copy all suites from a source plan

copyAncestorHierarchy

boolean

copy ancestor hieracrchy

destinationWorkItemType

string

Name of the workitem type of the clone

overrideParameters

object

Key value pairs where the key value is overridden by the value.

relatedLinkComment

string

Comment on the link that will link the new clone test case to the original Set null for no comment

CloneStatistics

Name Type Description
clonedRequirementsCount

integer

Number of Requirments cloned so far.

clonedSharedStepsCount

integer

Number of shared steps cloned so far.

clonedTestCasesCount

integer

Number of test cases cloned so far

totalRequirementsCount

integer

Total number of requirements to be cloned

totalTestCasesCount

integer

Total number of test cases to be cloned

IdentityRef

Name Type Description
_links

ReferenceLinks

This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject.

descriptor

string

The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and collections.

directoryAlias

string

displayName

string

This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider.

id

string

imageUrl

string

inactive

boolean

isAadIdentity

boolean

isContainer

boolean

isDeletedInOrigin

boolean

profileUrl

string

uniqueName

string

url

string

This url is the full route to the source resource of this graph subject.

The class to represent a collection of REST reference links.

Name Type Description
links

object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.

ReleaseEnvironmentDefinitionReference

Reference to release environment resource.

Name Type Description
definitionId

integer

ID of the release definition that contains the release environment definition.

environmentDefinitionId

integer

ID of the release environment definition.

ResultObjectType

The type of the object generated as a result of the Clone operation

Name Type Description
testPlan

string

Plan Clone

testSuite

string

Suite Clone

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

Name Type Description
id

string

ID of the resource

name

string

Name of the linked resource (definition name, controller name, etc.)

url

string

Full http link to the resource

TestOutcomeSettings

Test outcome settings

Name Type Description
syncOutcomeAcrossSuites

boolean

Value to configure how test outcomes for the same tests across suites are shown

TestPlan

The test plan resource.

Name Type Description
area

ShallowReference

Area of the test plan.

build

ShallowReference

Build to be tested.

buildDefinition

ShallowReference

The Build Definition that generates a build associated with this test plan.

description

string

Description of the test plan.

endDate

string

End date for the test plan.

id

integer

ID of the test plan.

iteration

string

Iteration path of the test plan.

name

string

Name of the test plan.

owner

IdentityRef

Owner of the test plan.

previousBuild

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

project

ShallowReference

Project which contains the test plan.

releaseEnvironmentDefinition

ReleaseEnvironmentDefinitionReference

Release Environment to be used to deploy the build and run automated tests from this test plan.

revision

integer

Revision of the test plan.

rootSuite

ShallowReference

Root test suite of the test plan.

startDate

string

Start date for the test plan.

state

string

State of the test plan.

testOutcomeSettings

TestOutcomeSettings

Value to configure how same tests across test suites under a test plan need to behave

updatedBy

IdentityRef

updatedDate

string

url

string

URL of the test plan resource.

TestPlanCloneRequest

Name Type Description
destinationTestPlan

TestPlan

The test plan resource.

options

CloneOptions

suiteIds

integer[]