Test cases

Last Update: 5/15/2017

api-version = 1.0

If you haven't already, look at the information on getting started with these APIs.

Get a list of test cases

GET https://{instance}/DefaultCollection/{project}/_apis/test/plans/{plan}/suites/{suite}/testcases?api-version={version}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of the team project.
plan int ID of the test plan that contains the suites.
suite int ID of the suite to get.
Query
api-version string Version of the API to use.

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/fabrikam-fiber-tfvc/_apis/test/plans/1/suites/1/testcases?api-version=1.0

Sample response

Status code: 200
{
  "value": [
    {
      "testCase": {
        "id": "39",
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/wit/workItems/39",
        "webUrl": "https://fabrikam-fiber-inc.visualstudio.com/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://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/e5a5f7f8-6507-4c34-b397-6c4818e002f4",
            "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=e5a5f7f8-6507-4c34-b397-6c4818e002f4"
          }
        }
      ]
    },
    {
      "testCase": {
        "id": "40",
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/wit/workItems/40",
        "webUrl": "https://fabrikam-fiber-inc.visualstudio.com/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://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/e5a5f7f8-6507-4c34-b397-6c4818e002f4",
            "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=e5a5f7f8-6507-4c34-b397-6c4818e002f4"
          }
        }
      ]
    }
  ],
  "count": 2
}

Get a test case

GET https://{instance}/DefaultCollection/{project}/_apis/test/plans/{plan}/suites/{suite}/testcases/{case}?api-version={version}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of the team project.
plan int ID of the test plan that contains the suites.
suite int ID of the suite that contains the test case.
case int ID of the test case to get.
Query
api-version string Version of the API to use.

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/fabrikam-fiber-tfvc/_apis/test/plans/1/suites/1/testcases/39?api-version=1.0

Sample response

Status code: 200
{
  "testCase": {
    "id": "39",
    "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/wit/workItems/39",
    "webUrl": "https://fabrikam-fiber-inc.visualstudio.com/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://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/e5a5f7f8-6507-4c34-b397-6c4818e002f4",
        "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=e5a5f7f8-6507-4c34-b397-6c4818e002f4"
      }
    }
  ]
}

Delete a test case

This API is supported as of api-version = 3.0-preview.

DELETE https://{instance}/DefaultCollection/{project}/_apis/test/testcases/{caseId}?api-version={version}
Parameter Type Notes
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of the team project.
caseId int ID of the test case to delete.
Query
api-version string Version of the API to use.

Sample request

DELETE https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/fabrikam-fiber-tfvc/_apis/test/testcases/5?api-version=3.0-preview

Sample response

Status code: 204