Test Plans - Create

Create a test plan.

POST https://dev.azure.com/{organization}/{project}/_apis/testplan/plans?api-version=7.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

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 '7.1' to use this version of the api.

Request Body

Name Type Description
areaPath

string

Area of the test plan.

buildDefinition

BuildDefinitionReference

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

buildId

integer

Build to be tested.

description

string

Description of the test plan.

endDate

string

End date for 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.

releaseEnvironmentDefinition

ReleaseEnvironmentDefinitionReference

Release Environment to be used to deploy the build and run automated tests from this 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

Responses

Name Type Description
200 OK

TestPlan

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

Create a test plan with all details.
Create a test plan with name, area path and iteration.

Create a test plan with all details.

Sample request

POST https://dev.azure.com/fabrikam/{project}/_apis/testplan/plans?api-version=7.1

{
  "name": "newCreatedPlan2",
  "areaPath": "sampleProject\\Team1",
  "description": "description of the test plan",
  "startDate": "2018-08-19T20:49:15.8884886+05:30",
  "endDate": "2018-08-26T20:49:15.8884886+05:30",
  "iteration": "sampleProject\\Iteration 2",
  "owner": null,
  "state": "Inactive",
  "buildId": 3,
  "buildDefinition": {
    "id": 2,
    "name": ""
  },
  "releaseEnvironmentDefinition": {
    "definitionId": 1,
    "environmentDefinitionId": 1
  },
  "testOutcomeSettings": {
    "syncOutcomeAcrossSuites": true
  }
}

Sample response

{
  "id": 31,
  "project": {
    "id": "afb62ab2-bd74-41c2-991e-40bbb9c8ca91",
    "name": "sampleProject",
    "state": "unchanged",
    "visibility": "unchanged"
  },
  "updatedDate": "2018-08-17T15:19:16.993Z",
  "updatedBy": {
    "displayName": "Fabrikam Fiber",
    "url": "https://vssps.dev.azure.com/fabrikam/Aea08ebc7-105f-4bb2-a36b-f92e0e9de65a/_apis/Identities/0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aad.MGZkYmRhZDgtNmFmYi03MTQ5LTlhZjktYzBhMjE2MTM3ZDFk"
      }
    },
    "id": "0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "uniqueName": "fabrikamfiber1@microsoft.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "descriptor": "aad.MGZkYmRhZDgtNmFmYi03MTQ5LTlhZjktYzBhMjE2MTM3ZDFk"
  },
  "rootSuite": {
    "id": 32,
    "name": "newCreatedPlan2",
    "plan": {
      "id": 31,
      "name": "newCreatedPlan2"
    }
  },
  "_links": {
    "_self": {
      "href": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/31"
    },
    "clientUrl": {
      "href": "mtms://fabrikam.visualstudio.com:443/p:sampleProject/Testing/testplan/connect?id=31"
    },
    "rootSuite": {
      "href": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/31/Suites/32"
    },
    "build": {
      "href": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/build/Builds/3"
    },
    "buildDefinition": {
      "href": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/build/Definitions/2"
    }
  },
  "revision": 2,
  "name": "newCreatedPlan2",
  "areaPath": "sampleProject\\Team1",
  "description": "description of the test plan",
  "startDate": "2018-08-19T20:49:15.8884886+05:30",
  "endDate": "2018-08-26T20:49:15.8884886+05:30",
  "iteration": "sampleProject\\Iteration 2",
  "owner": {
    "displayName": "Fabrikam Fiber",
    "url": "https://vssps.dev.azure.com/fabrikam/Aea08ebc7-105f-4bb2-a36b-f92e0e9de65a/_apis/Identities/0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aad.MGZkYmRhZDgtNmFmYi03MTQ5LTlhZjktYzBhMjE2MTM3ZDFk"
      }
    },
    "id": "0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "uniqueName": "fabrikamfiber1@microsoft.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "descriptor": "aad.MGZkYmRhZDgtNmFmYi03MTQ5LTlhZjktYzBhMjE2MTM3ZDFk"
  },
  "state": "Inactive",
  "buildId": 3,
  "buildDefinition": {
    "id": 2,
    "name": ""
  },
  "releaseEnvironmentDefinition": {
    "definitionId": 1,
    "environmentDefinitionId": 1
  },
  "testOutcomeSettings": {
    "syncOutcomeAcrossSuites": true
  }
}

Create a test plan with name, area path and iteration.

Sample request

POST https://dev.azure.com/fabrikam/{project}/_apis/testplan/plans?api-version=7.1

{
  "name": "newCreatedPlan1",
  "areaPath": "sampleProject\\Team1",
  "iteration": "sampleProject\\Iteration 2",
  "owner": null
}

Sample response

{
  "id": 29,
  "project": {
    "id": "afb62ab2-bd74-41c2-991e-40bbb9c8ca91",
    "name": "sampleProject",
    "state": "unchanged",
    "visibility": "unchanged"
  },
  "updatedDate": "2018-08-17T15:19:13.967Z",
  "updatedBy": {
    "displayName": "Fabrikam Fiber",
    "url": "https://vssps.dev.azure.com/fabrikam/Aea08ebc7-105f-4bb2-a36b-f92e0e9de65a/_apis/Identities/0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aad.MGZkYmRhZDgtNmFmYi03MTQ5LTlhZjktYzBhMjE2MTM3ZDFk"
      }
    },
    "id": "0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "uniqueName": "fabrikamfiber1@microsoft.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "descriptor": "aad.MGZkYmRhZDgtNmFmYi03MTQ5LTlhZjktYzBhMjE2MTM3ZDFk"
  },
  "rootSuite": {
    "id": 30,
    "name": "newCreatedPlan1",
    "plan": {
      "id": 29,
      "name": "newCreatedPlan1"
    }
  },
  "_links": {
    "_self": {
      "href": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/29"
    },
    "clientUrl": {
      "href": "mtms://fabrikam.visualstudio.com:443/p:sampleProject/Testing/testplan/connect?id=29"
    },
    "rootSuite": {
      "href": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/29/Suites/30"
    }
  },
  "revision": 1,
  "name": "newCreatedPlan1",
  "areaPath": "sampleProject\\Team1",
  "startDate": "2018-08-17T15:19:13.6734848Z",
  "endDate": "2018-08-24T15:19:13.6734848Z",
  "iteration": "sampleProject\\Iteration 2",
  "owner": {
    "displayName": "Fabrikam Fiber",
    "url": "https://vssps.dev.azure.com/fabrikam/Aea08ebc7-105f-4bb2-a36b-f92e0e9de65a/_apis/Identities/0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "_links": {
      "avatar": {
        "href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aad.MGZkYmRhZDgtNmFmYi03MTQ5LTlhZjktYzBhMjE2MTM3ZDFk"
      }
    },
    "id": "0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "uniqueName": "fabrikamfiber1@microsoft.com",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=0fdbdad8-6afb-6149-9af9-c0a216137d1d",
    "descriptor": "aad.MGZkYmRhZDgtNmFmYi03MTQ5LTlhZjktYzBhMjE2MTM3ZDFk"
  },
  "state": "Active",
  "testOutcomeSettings": {
    "syncOutcomeAcrossSuites": false
  }
}

Definitions

Name Description
BuildDefinitionReference

The build definition reference resource

IdentityRef
ProjectState

Project state.

ProjectVisibility

Project visibility.

ReferenceLinks

The class to represent a collection of REST reference links.

ReleaseEnvironmentDefinitionReference

Reference to release environment resource.

TeamProjectReference

Represents a shallow reference to a TeamProject.

TestOutcomeSettings

Test outcome settings

TestPlan

The test plan resource.

TestPlanCreateParams

The test plan create parameters.

TestSuiteReference

The test suite reference resource.

BuildDefinitionReference

The build definition reference resource

Name Type Description
id

integer

ID of the build definition

name

string

Name of the build definition

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 Organizations.

directoryAlias

string

Deprecated - Can be retrieved by querying the Graph user referenced in the "self" entry of the IdentityRef "_links" dictionary

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

Deprecated - Available in the "avatar" entry of the IdentityRef "_links" dictionary

inactive

boolean

Deprecated - Can be retrieved by querying the Graph membership state referenced in the "membershipState" entry of the GraphUser "_links" dictionary

isAadIdentity

boolean

Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsAadUserType/Descriptor.IsAadGroupType)

isContainer

boolean

Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsGroupType)

isDeletedInOrigin

boolean

profileUrl

string

Deprecated - not in use in most preexisting implementations of ToIdentityRef

uniqueName

string

Deprecated - use Domain+PrincipalName instead

url

string

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

ProjectState

Project state.

Name Type Description
all

string

All projects regardless of state except Deleted.

createPending

string

Project has been queued for creation, but the process has not yet started.

deleted

string

Project has been deleted.

deleting

string

Project is in the process of being deleted.

new

string

Project is in the process of being created.

unchanged

string

Project has not been changed.

wellFormed

string

Project is completely created and ready to use.

ProjectVisibility

Project visibility.

Name Type Description
private

string

The project is only visible to users with explicit access.

public

string

The project is visible to all.

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.

TeamProjectReference

Represents a shallow reference to a TeamProject.

Name Type Description
abbreviation

string

Project abbreviation.

defaultTeamImageUrl

string

Url to default team identity image.

description

string

The project's description (if any).

id

string

Project identifier.

lastUpdateTime

string

Project last update time.

name

string

Project name.

revision

integer

Project revision.

state

ProjectState

Project state.

url

string

Url to the full version of the object.

visibility

ProjectVisibility

Project visibility.

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
_links

ReferenceLinks

Relevant links

areaPath

string

Area of the test plan.

buildDefinition

BuildDefinitionReference

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

buildId

integer

Build to be tested.

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.

previousBuildId

integer

Previous build Id associated with the test plan

project

TeamProjectReference

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

TestSuiteReference

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

Identity Reference for the last update of the test plan

updatedDate

string

Updated date of the test plan

TestPlanCreateParams

The test plan create parameters.

Name Type Description
areaPath

string

Area of the test plan.

buildDefinition

BuildDefinitionReference

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

buildId

integer

Build to be tested.

description

string

Description of the test plan.

endDate

string

End date for 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.

releaseEnvironmentDefinition

ReleaseEnvironmentDefinitionReference

Release Environment to be used to deploy the build and run automated tests from this 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

TestSuiteReference

The test suite reference resource.

Name Type Description
id

integer

ID of the test suite.

name

string

Name of the test suite.