Test Plans - Create

Create a test plan.

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

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

Request Body

Name Type Description
area

ShallowReference

Area path to which the test plan belongs. This should be set to area path of the team that works on this test plan.

build

ShallowReference

Build ID of the build whose quality is tested by the tests in this test plan. For automated testing, this build ID is used to find the test binaries that contain automated test methods.

buildDefinition

ShallowReference

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

configurationIds

integer[]

IDs of configurations to be applied when new test suites and test cases are added to the test plan.

description

string

Description of the test plan.

endDate

string

End date for the test plan.

iteration

string

Iteration path assigned to the test plan. This indicates when the target iteration by which the testing in this plan is supposed to be complete and the product is ready to be released.

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

Test Outcome settings

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 in an area and iteration.
Create a test plan with a description.
Create a test plan with start date and end date.

Create a test plan in an area and iteration.

Sample request

POST https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/plans?api-version=5.0

{
  "name": "ANewPlan",
  "area": {
    "name": "Fabrikam-Fiber-TFVC\\Quality assurance"
  },
  "iteration": "Fabrikam-Fiber-TFVC\\Release 1"
}

Sample response

{
  "id": 16,
  "name": "ANewPlan",
  "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/16",
  "project": {
    "id": "eb6e4656-77fc-42a1-9181-4c6d8e9da5d1",
    "name": "Fabrikam-Fiber-TFVC",
    "url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
  },
  "area": {
    "id": "411",
    "name": "Fabrikam-Fiber-TFVC\\Quality assurance"
  },
  "startDate": "2014-05-06T13:43:02.803578Z",
  "endDate": "2014-05-13T13:43:02.803578Z",
  "iteration": "Fabrikam-Fiber-TFVC\\Release 1",
  "updatedDate": "2014-05-06T13:43:02.187Z",
  "updatedBy": {
    "id": "e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "displayName": "Fabrikam Fiber",
    "uniqueName": "fabrikamfiber1@outlook.com",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=e5a5f7f8-6507-4c34-b397-6c4818e002f4"
  },
  "owner": {
    "id": "e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "displayName": "Fabrikam Fiber",
    "uniqueName": "fabrikamfiber1@outlook.com",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=e5a5f7f8-6507-4c34-b397-6c4818e002f4"
  },
  "revision": 1,
  "state": "Active",
  "rootSuite": {
    "id": "33",
    "name": "ANewPlan",
    "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/16/Suites/33"
  },
  "clientUrl": "mtms://fabrikam.visualstudio.com:443/DefaultCollection/p:Fabrikam-Fiber-TFVC/Testing/testplan/connect?id=16"
}

Create a test plan with a description.

Sample request

POST https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/plans?api-version=5.0

{
  "name": "newCreatedPlan",
  "description": "This is a new test plan"
}

Sample response

{
  "id": 15,
  "name": "newCreatedPlan",
  "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/15",
  "project": {
    "id": "eb6e4656-77fc-42a1-9181-4c6d8e9da5d1",
    "name": "Fabrikam-Fiber-TFVC",
    "url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
  },
  "area": {
    "id": "343",
    "name": "Fabrikam-Fiber-TFVC"
  },
  "description": "This is a new test plan",
  "startDate": "2014-05-06T13:42:59.3008007Z",
  "endDate": "2014-05-13T13:42:59.3008007Z",
  "iteration": "Fabrikam-Fiber-TFVC",
  "updatedDate": "2014-05-06T13:42:58.71Z",
  "updatedBy": {
    "id": "e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "displayName": "Fabrikam Fiber",
    "uniqueName": "fabrikamfiber1@outlook.com",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=e5a5f7f8-6507-4c34-b397-6c4818e002f4"
  },
  "owner": {
    "id": "e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "displayName": "Fabrikam Fiber",
    "uniqueName": "fabrikamfiber1@outlook.com",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=e5a5f7f8-6507-4c34-b397-6c4818e002f4"
  },
  "revision": 1,
  "state": "Active",
  "rootSuite": {
    "id": "32",
    "name": "newCreatedPlan",
    "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/15/Suites/32"
  },
  "clientUrl": "mtms://fabrikam.visualstudio.com:443/DefaultCollection/p:Fabrikam-Fiber-TFVC/Testing/testplan/connect?id=15"
}

Create a test plan with start date and end date.

Sample request

POST https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/plans?api-version=5.0

{
  "name": "ANewPlan",
  "startDate": "2014-05-01",
  "endDate": "2014-05-10"
}

Sample response

{
  "id": 17,
  "name": "ANewPlan",
  "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/17",
  "project": {
    "id": "eb6e4656-77fc-42a1-9181-4c6d8e9da5d1",
    "name": "Fabrikam-Fiber-TFVC",
    "url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
  },
  "area": {
    "id": "343",
    "name": "Fabrikam-Fiber-TFVC"
  },
  "startDate": "2014-05-01T00:00:00Z",
  "endDate": "2014-05-10T00:00:00Z",
  "iteration": "Fabrikam-Fiber-TFVC",
  "updatedDate": "2014-05-06T13:43:04.743Z",
  "updatedBy": {
    "id": "e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "displayName": "Fabrikam Fiber",
    "uniqueName": "fabrikamfiber1@outlook.com",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=e5a5f7f8-6507-4c34-b397-6c4818e002f4"
  },
  "owner": {
    "id": "e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "displayName": "Fabrikam Fiber",
    "uniqueName": "fabrikamfiber1@outlook.com",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/e5a5f7f8-6507-4c34-b397-6c4818e002f4",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=e5a5f7f8-6507-4c34-b397-6c4818e002f4"
  },
  "revision": 1,
  "state": "Active",
  "rootSuite": {
    "id": "34",
    "name": "ANewPlan",
    "url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/17/Suites/34"
  },
  "clientUrl": "mtms://fabrikam.visualstudio.com:443/DefaultCollection/p:Fabrikam-Fiber-TFVC/Testing/testplan/connect?id=17"
}

Definitions

Name Description
IdentityRef
PlanUpdateModel

A model class used for creating and updating test plans.

ReferenceLinks

The class to represent a collection of REST reference links.

ReleaseEnvironmentDefinitionReference

Reference to release environment resource.

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.

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

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.

PlanUpdateModel

A model class used for creating and updating test plans.

Name Type Description
area

ShallowReference

Area path to which the test plan belongs. This should be set to area path of the team that works on this test plan.

build

ShallowReference

Build ID of the build whose quality is tested by the tests in this test plan. For automated testing, this build ID is used to find the test binaries that contain automated test methods.

buildDefinition

ShallowReference

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

configurationIds

integer[]

IDs of configurations to be applied when new test suites and test cases are added to the test plan.

description

string

Description of the test plan.

endDate

string

End date for the test plan.

iteration

string

Iteration path assigned to the test plan. This indicates when the target iteration by which the testing in this plan is supposed to be complete and the product is ready to be released.

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

Test Outcome settings

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.

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.