Delen via


Test Suites - Add

Add test cases to suite.

POST https://dev.azure.com/{organization}/{project}/_apis/test/Plans/{planId}/suites/{suiteId}/testcases/{testCaseIds}?api-version=7.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

planId
path True

integer

int32

ID of the test plan that contains the suite.

project
path True

string

Project ID or project name

suiteId
path True

integer

int32

ID of the test suite to which the test cases must be added.

testCaseIds
path True

string

IDs of the test cases to add to the suite. Ids are specified in comma separated format.

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.

Responses

Name Type Description
200 OK

SuiteTestCase[]

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://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/1/suites/1/testcases/39,40?api-version=7.1

Sample response

{
  "value": [
    {
      "testCase": {
        "id": "39",
        "url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/39",
        "webUrl": "https://dev.azure.com/fabrikam/web/wi.aspx?pcguid=d81542e4-cdfa-4333-b082-1ae2d6c3ad16&id=39"
      },
      "pointAssignments": [
        {
          "configuration": {
            "id": "2",
            "name": "Windows 8"
          },
          "tester": {
            "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"
          }
        }
      ]
    },
    {
      "testCase": {
        "id": "40",
        "url": "https://dev.azure.com/fabrikam/_apis/wit/workItems/40",
        "webUrl": "https://dev.azure.com/fabrikam/web/wi.aspx?pcguid=d81542e4-cdfa-4333-b082-1ae2d6c3ad16&id=40"
      },
      "pointAssignments": [
        {
          "configuration": {
            "id": "2",
            "name": "Windows 8"
          },
          "tester": {
            "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"
          }
        }
      ]
    }
  ],
  "count": 2
}

Definitions

Name Description
IdentityRef
PointAssignment

Adding test cases to a suite creates one of more test points based on the default configurations and testers assigned to the test suite. PointAssignment is the list of test points that were created for each of the test cases that were added to the test suite.

ReferenceLinks

The class to represent a collection of REST reference links.

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.

SuiteTestCase

Test case for the suite.

WorkItemReference

WorkItem reference Details.

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.

PointAssignment

Adding test cases to a suite creates one of more test points based on the default configurations and testers assigned to the test suite. PointAssignment is the list of test points that were created for each of the test cases that were added to the test suite.

Name Type Description
configuration

ShallowReference

Configuration that was assigned to the test case.

tester

IdentityRef

Tester that was assigned to the test case

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.

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

SuiteTestCase

Test case for the suite.

Name Type Description
pointAssignments

PointAssignment[]

Point Assignment for test suite's test case.

testCase

WorkItemReference

Test case workItem reference.

WorkItemReference

WorkItem reference Details.

Name Type Description
id

string

WorkItem Id.

name

string

WorkItem Name.

type

string

WorkItem Type.

url

string

WorkItem Url. Valid Values : (Bug, Task, User Story, Test Case)

webUrl

string

WorkItem WebUrl.