共用方式為


Test Plans - Create

建立測試計劃。

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

URI 參數

名稱 位於 必要 類型 Description
organization
path True

string

Azure DevOps 組織的名稱。

project
path True

string

專案識別碼或專案名稱

api-version
query True

string

要使用的 API 版本。 這應該設定為 '5.0' 以使用此版本的 API。

要求本文

名稱 類型 Description
area

ShallowReference

測試計劃所屬的區域路徑。 這應該設定為適用于此測試計劃之小組的區域路徑。

build

ShallowReference

此測試計劃中測試品質的組建組建識別碼。 針對自動化測試,此組建識別碼可用來尋找包含自動化測試方法的測試二進位檔。

buildDefinition

ShallowReference

產生與此測試計劃相關聯的組建定義。

configurationIds

integer[]

當新的測試套件和測試案例新增至測試計劃時,要套用的組態識別碼。

description

string

測試計劃的描述。

endDate

string

測試計劃的結束日期。

iteration

string

指派給測試計劃的反復專案路徑。 這表示此方案中測試的目標反復專案應該完成,且產品已準備好發行。

name

string

測試計劃的名稱。

owner

IdentityRef

測試計劃的擁有者。

releaseEnvironmentDefinition

ReleaseEnvironmentDefinitionReference

用來從此測試計劃部署及執行自動化測試的發行環境。

startDate

string

測試計劃的開始日期。

state

string

測試計劃的狀態。

testOutcomeSettings

TestOutcomeSettings

測試結果設定

回應

名稱 類型 Description
200 OK

TestPlan

成功作業

安全性

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

名稱 Description
vso.test_write 授與讀取、建立及更新測試計劃、案例、結果和其他測試管理相關成品的能力。

範例

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"
}

定義

名稱 Description
IdentityRef
PlanUpdateModel

用於建立和更新測試計劃的模型類別。

ReferenceLinks

表示 REST 參考連結集合的類別。

ReleaseEnvironmentDefinitionReference

發行環境資源的參考。

ShallowReference

其他資源的抽象參考。 這個類別是用來提供建置資料合約的統一方式,以參考其他資源的方式,以提供輕鬆的周遊連結。

TestOutcomeSettings

測試結果設定

TestPlan

測試計劃資源。

IdentityRef

名稱 類型 Description
_links

ReferenceLinks

此欄位包含圖表主旨的相關零或更多有趣連結。 您可以叫用這些連結來取得其他關聯性,或取得此圖表主體的詳細資訊。

descriptor

string

描述項是在系統執行時參考圖形主旨的主要方式。 此欄位可唯一識別帳戶和組織之間的相同圖表主旨。

directoryAlias

string

displayName

string

這是圖形主體的非唯一顯示名稱。 若要變更此欄位,您必須變更來源提供者中的值。

id

string

imageUrl

string

inactive

boolean

isAadIdentity

boolean

isContainer

boolean

isDeletedInOrigin

boolean

profileUrl

string

uniqueName

string

url

string

此 URL 是此圖形主體來源資源的完整路由。

PlanUpdateModel

用於建立和更新測試計劃的模型類別。

名稱 類型 Description
area

ShallowReference

測試計劃所屬的區域路徑。 這應該設定為適用于此測試計劃之小組的區域路徑。

build

ShallowReference

此測試計劃中測試品質的組建組建識別碼。 針對自動化測試,此組建識別碼可用來尋找包含自動化測試方法的測試二進位檔。

buildDefinition

ShallowReference

產生與此測試計劃相關聯的組建定義。

configurationIds

integer[]

當新的測試套件和測試案例新增至測試計劃時,要套用的組態識別碼。

description

string

測試計劃的描述。

endDate

string

測試計劃的結束日期。

iteration

string

指派給測試計劃的反復專案路徑。 這表示此方案中測試的目標反復專案應該完成,且產品已準備好發行。

name

string

測試計劃的名稱。

owner

IdentityRef

測試計劃的擁有者。

releaseEnvironmentDefinition

ReleaseEnvironmentDefinitionReference

用來從此測試計劃部署及執行自動化測試的發行環境。

startDate

string

測試計劃的開始日期。

state

string

測試計劃的狀態。

testOutcomeSettings

TestOutcomeSettings

測試結果設定

表示 REST 參考連結集合的類別。

名稱 類型 Description
links

object

連結的唯讀檢視。 因為參考連結是唯讀的,所以我們只想要將它們公開為唯讀。

ReleaseEnvironmentDefinitionReference

發行環境資源的參考。

名稱 類型 Description
definitionId

integer

包含發行環境定義的發行定義識別碼。

environmentDefinitionId

integer

發行環境定義的識別碼。

ShallowReference

其他資源的抽象參考。 這個類別是用來提供建置資料合約的統一方式,以參考其他資源的方式,以提供輕鬆的周遊連結。

名稱 類型 Description
id

string

資源的識別碼

name

string

連結資源的名稱 (定義名稱、控制器名稱等。)

url

string

資源的完整 HTTP 連結

TestOutcomeSettings

測試結果設定

名稱 類型 Description
syncOutcomeAcrossSuites

boolean

設定如何在套件間顯示相同測試之測試結果的值

TestPlan

測試計劃資源。

名稱 類型 Description
area

ShallowReference

測試計劃的區域。

build

ShallowReference

要測試的組建。

buildDefinition

ShallowReference

產生與此測試計劃相關聯的組建定義。

description

string

測試計劃的描述。

endDate

string

測試計劃的結束日期。

id

integer

測試計劃的識別碼。

iteration

string

測試計劃的反復專案路徑。

name

string

測試計劃的名稱。

owner

IdentityRef

測試計劃的擁有者。

previousBuild

ShallowReference

其他資源的抽象參考。 這個類別是用來提供建置資料合約的統一方式,以參考其他資源的方式,以提供輕鬆的周遊連結。

project

ShallowReference

包含測試計劃的專案。

releaseEnvironmentDefinition

ReleaseEnvironmentDefinitionReference

用來從此測試計劃部署及執行自動化測試的發行環境。

revision

integer

測試計劃的修訂。

rootSuite

ShallowReference

測試計劃的根測試套件。

startDate

string

測試計劃的開始日期。

state

string

測試計劃的狀態。

testOutcomeSettings

TestOutcomeSettings

在測試計劃下,設定測試套件間相同測試的行為值

updatedBy

IdentityRef

updatedDate

string

url

string

測試計劃資源的 URL。