Runs - Create
建立新的測試回合。
POST https://dev.azure.com/{organization}/{project}/_apis/test/runs?api-version=7.1
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
organization
|
path | True |
string |
Azure DevOps 組織的名稱。 |
|
project
|
path | True |
string |
項目識別碼或項目名稱 |
|
api-version
|
query | True |
string |
要使用的 API 版本。 這應該設定為 『7.1』 以使用此版本的 API。 |
要求本文
| 名稱 | 類型 | Description |
|---|---|---|
| automated |
boolean |
如果測試回合是自動化的,則為 true,否則為 false。 根據預設,它會是 false。 |
| build |
其所屬組建的抽象參考。 |
|
| buildDropLocation |
string |
卸除用於測試回合的組建位置。 |
| buildFlavor |
string |
用於測試回合的組建類別。 (例如:發行、偵錯) |
| buildPlatform |
string |
用於測試回合的組建平臺。 (例如:x86、amd64) |
| buildReference |
測試回合的 BuildReference。 |
|
| comment |
string |
分析回合的批注。 |
| completeDate |
string |
執行完成的日期時間。 |
| configurationIds |
integer[] (int32) |
與執行相關聯的測試組態標識碼。 |
| controller |
string |
用於自動化執行的測試控制器名稱。 |
| customTestFields |
測試回合的其他屬性。 |
|
| dtlAutEnvironment |
DtlAutEnvironment 的抽象參考。 |
|
| dtlTestEnvironment |
DtlTestEnvironment 的抽象參考。 |
|
| dueDate |
string |
測試回合的到期日期和時間。 |
| environmentDetails |
這是暫存類別,可提供測試回合環境的詳細數據。 |
|
| errorMessage |
string |
與執行相關聯的錯誤訊息。 |
| filter |
用於探索執行的篩選條件。 |
|
| iteration |
string |
要在其中建立回合的反覆專案。 小組專案的根反覆項目預設為 |
| name |
string |
測試回合的名稱。 |
| owner |
執行之擁有者的顯示名稱。 |
|
| pipelineReference |
這個測試回合所屬之管線的參考。 PipelineReference.PipelineId 應等於 RunCreateModel.Build.Id |
|
| plan |
其所屬計劃的抽象參考。 |
|
| pointIds |
integer[] (int32) |
執行中要使用的測試點標識碼。 |
| releaseEnvironmentUri |
string |
與執行相關聯的發行環境 URI。 |
| releaseReference |
與測試回合相關聯的發行參考。 |
|
| releaseUri |
string |
與執行相關聯的發行 URI。 |
| runSummary |
執行類型 = NoConfigRun 的執行摘要。 |
|
| runTimeout |
string (TimeSpan) |
時間範圍直到運行逾時。 |
| sourceWorkflow |
string |
測試回合的SourceWorkFlow(CI/CD)。 |
| startDate |
string |
執行的開始日期時間。 |
| state |
string |
執行的狀態。 類型 TestRunState 有效狀態 - NotStarted、InProgress、Waiting |
| tags |
Test |
要附加測試回合的標籤,最多可以新增5個標記來執行。 |
| testConfigurationsMapping |
string |
測試回合的TestConfigurationMapping。 |
| testEnvironmentId |
string |
與回合相關聯的測試環境標識碼。 |
| testSettings |
測試設定資源的抽象參考。 |
|
| type |
string |
run(RunType) 有效值的類型:(Unspecified、Normal、Blocking、Web、MtrRunInitiatedFromWeb、RunWithDtlEnv、NoConfigRun) |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
成功作業 |
安全性
oauth2
類型:
oauth2
Flow:
accessCode
授權 URL:
https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
權杖 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
範圍
| 名稱 | Description |
|---|---|
| vso.test_write | 授與讀取、建立和更新測試計劃、案例、結果和其他測試管理相關成品的能力。 |
範例
範例要求
POST https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/runs?api-version=7.1
{
"name": "NewTestRun",
"plan": {
"id": "1"
},
"pointIds": [
1,
1
]
}
範例回覆
{
"id": 31,
"name": "NewTestRun",
"url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Runs/31",
"isAutomated": false,
"iteration": "Fabrikam-Fiber-TFVC\\Release 1\\Sprint 1",
"owner": {
"id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
"displayName": "Chuck Reinhart",
"uniqueName": "fabrikamfiber3@hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
},
"project": {
"id": "eb6e4656-77fc-42a1-9181-4c6d8e9da5d1",
"name": "Fabrikam-Fiber-TFVC",
"url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
},
"startedDate": "2014-05-28T16:39:00.44Z",
"state": "InProgress",
"plan": {
"id": "1",
"name": "sprint1",
"url": "https://dev.azure.com/fabrikam/fabrikam-fiber-tfvc/_apis/test/Plans/1"
},
"postProcessState": "Complete",
"totalTests": 2,
"incompleteTests": 2,
"createdDate": "2014-05-28T16:39:00.4Z",
"lastUpdatedDate": "2014-05-28T16:39:00.44Z",
"lastUpdatedBy": {
"id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
"displayName": "Chuck Reinhart",
"uniqueName": "fabrikamfiber3@hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
},
"revision": 2
}
定義
| 名稱 | Description |
|---|---|
|
Build |
BuildConfiguration 詳細數據。 |
|
Custom |
自訂欄位資訊。 允許的索引鍵:值組 - (AttemptId: int value, IsTestResultFlaky: bool) |
|
Dtl |
這是暫存類別,可提供測試回合環境的詳細數據。 |
|
Identity |
|
|
Job |
管線中的作業。 這與 YAML 中的矩陣相關。 |
|
Phase |
管線中的階段 |
|
Pipeline |
管線參考 |
|
Reference |
表示 REST 參考連結集合的類別。 |
|
Release |
版本的參考。 |
|
Result |
所指定結果/計數的 ResultMetadata。 |
|
Run |
測試回合建立詳細數據。 |
|
Run |
這個類別用來提供用於探索的篩選條件 |
|
Run |
測試每個結果的執行統計數據。 |
|
Run |
針對每個輸出類型的測試執行摘要。 |
|
Shallow |
一些其他資源的抽象參考。 這個類別可用來提供建置數據合約,以統一的方式參考其他資源,以提供簡單的透過連結周遊的方式。 |
|
Stage |
管線中的階段 |
|
Test |
測試環境詳細數據。 |
|
Test |
|
|
Test |
測試解析狀態詳細數據。 |
|
Test |
測試回合詳細數據。 |
|
Test |
測試回合的子狀態類型。 |
|
Test |
附加至執行或結果的標籤。 |
BuildConfiguration
BuildConfiguration 詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| branchName |
string |
產生組建的分支名稱。 |
| buildDefinitionId |
integer (int32) |
BuildDefinitionId for build。 |
| buildSystem |
string |
建置系統。 |
| creationDate |
string (date-time) |
組建建立日期。 |
| flavor |
string |
組建類別(例如組建/發行)。 |
| id |
integer (int32) |
BuildConfiguration識別符。 |
| number |
string |
組建編號。 |
| platform |
string |
BuildConfiguration Platform。 |
| project |
與此 BuildConfiguration 相關聯的專案。 |
|
| repositoryGuid |
string |
組建的存放庫 Guid。 |
| repositoryType |
string |
存放庫類型(例如TFSGit)。 |
| sourceVersion |
string |
已觸發組建的來源版本(/第一次認可)。 |
| targetBranchName |
string |
Target BranchName。 |
| uri |
string |
組建 URI。 |
CustomTestField
自訂欄位資訊。 允許的索引鍵:值組 - (AttemptId: int value, IsTestResultFlaky: bool)
| 名稱 | 類型 | Description |
|---|---|---|
| fieldName |
string |
功能變數名稱。 |
| value |
object |
域值。 |
DtlEnvironmentDetails
這是暫存類別,可提供測試回合環境的詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| csmContent |
string |
|
| csmParameters |
string |
|
| subscriptionName |
string |
IdentityRef
| 名稱 | 類型 | Description |
|---|---|---|
| _links |
此欄位包含圖表主旨的相關零或更多有趣連結。 您可以叫用這些連結,以取得此圖表主題的其他關聯性或更詳細的資訊。 |
|
| descriptor |
string |
描述元是在系統執行時參考圖表主旨的主要方式。 此欄位會唯一識別帳戶和組織之間的相同圖表主題。 |
| directoryAlias |
string |
已淘汰 - 查詢 IdentityRef “_links” 字典中參考的 Graph 使用者,即可擷取 |
| displayName |
string |
這是圖形主體的非唯一顯示名稱。 若要變更此欄位,您必須在來源提供者中變更其值。 |
| id |
string |
|
| imageUrl |
string |
已淘汰 - 可在 IdentityRef “_links” 字典的 “avatar” 專案中取得 |
| inactive |
boolean |
已淘汰 - 可藉由查詢 GraphUser “_links” 字典的 “membershipState” 專案中參考的 Graph 成員資格狀態來擷取 |
| isAadIdentity |
boolean |
已淘汰 - 可以從描述元的主體類型推斷 (Descriptor.IsAadUserType/Descriptor.IsAadGroupType) |
| isContainer |
boolean |
已淘汰 - 可以從描述元的主體類型推斷 (Descriptor.IsGroupType) |
| isDeletedInOrigin |
boolean |
|
| profileUrl |
string |
已淘汰 - 未在 ToIdentityRef 的大部分預先存在實作中使用 |
| uniqueName |
string |
已淘汰 - 請改用 Domain+PrincipalName |
| url |
string |
此 URL 是此圖表主體來源資源的完整路由。 |
JobReference
管線中的作業。 這與 YAML 中的矩陣相關。
| 名稱 | 類型 | Description |
|---|---|---|
| attempt |
integer (int32) |
嘗試作業數目 |
| jobName |
string |
YAML 中的矩陣會產生具有矩陣中不同輸入之作業的複本。 JobName 是這些輸入的名稱。 名稱支援的長度上限為 256 個字元。 |
PhaseReference
管線中的階段
| 名稱 | 類型 | Description |
|---|---|---|
| attempt |
integer (int32) |
嘗試階段數目 |
| phaseName |
string |
階段的名稱。 名稱支援的長度上限為 256 個字元。 |
PipelineReference
管線參考
| 名稱 | 類型 | Description |
|---|---|---|
| jobReference |
作業的參考 |
|
| phaseReference |
階段的參考。 |
|
| pipelineId |
integer (int32) |
與此管線實例相關的管線參考。 |
| stageReference |
階段的參考。 |
ReferenceLinks
表示 REST 參考連結集合的類別。
| 名稱 | 類型 | Description |
|---|---|---|
| links |
object |
連結的只讀檢視。 因為參考連結是只讀的,所以我們只想要將其公開為只讀。 |
ReleaseReference
版本的參考。
| 名稱 | 類型 | Description |
|---|---|---|
| attempt |
integer (int32) |
發行嘗試次數。 |
| creationDate |
string (date-time) |
發行建立日期(UTC)。 |
| definitionId |
integer (int32) |
發行定義標識碼。 |
| environmentCreationDate |
string (date-time) |
環境建立日期(UTC)。 |
| environmentDefinitionId |
integer (int32) |
發行環境定義標識碼。 |
| environmentDefinitionName |
string |
釋放環境定義名稱。 |
| environmentId |
integer (int32) |
發行環境標識碼。 |
| environmentName |
string |
發行環境名稱。 |
| id |
integer (int32) |
版本標識碼。 |
| name |
string |
版本名稱。 |
ResultMetadata
所指定結果/計數的 ResultMetadata。
| 值 | Description |
|---|---|
| flaky |
Flaky 元數據 |
| rerun |
重新執行元數據 |
RunCreateModel
測試回合建立詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| automated |
boolean |
如果測試回合是自動化的,則為 true,否則為 false。 根據預設,它會是 false。 |
| build |
其所屬組建的抽象參考。 |
|
| buildDropLocation |
string |
卸除用於測試回合的組建位置。 |
| buildFlavor |
string |
用於測試回合的組建類別。 (例如:發行、偵錯) |
| buildPlatform |
string |
用於測試回合的組建平臺。 (例如:x86、amd64) |
| buildReference |
測試回合的 BuildReference。 |
|
| comment |
string |
分析回合的批注。 |
| completeDate |
string |
執行完成的日期時間。 |
| configurationIds |
integer[] (int32) |
與執行相關聯的測試組態標識碼。 |
| controller |
string |
用於自動化執行的測試控制器名稱。 |
| customTestFields |
測試回合的其他屬性。 |
|
| dtlAutEnvironment |
DtlAutEnvironment 的抽象參考。 |
|
| dtlTestEnvironment |
DtlTestEnvironment 的抽象參考。 |
|
| dueDate |
string |
測試回合的到期日期和時間。 |
| environmentDetails |
這是暫存類別,可提供測試回合環境的詳細數據。 |
|
| errorMessage |
string |
與執行相關聯的錯誤訊息。 |
| filter |
用於探索執行的篩選條件。 |
|
| iteration |
string |
要在其中建立回合的反覆專案。 小組專案的根反覆項目預設為 |
| name |
string |
測試回合的名稱。 |
| owner |
執行之擁有者的顯示名稱。 |
|
| pipelineReference |
這個測試回合所屬之管線的參考。 PipelineReference.PipelineId 應等於 RunCreateModel.Build.Id |
|
| plan |
其所屬計劃的抽象參考。 |
|
| pointIds |
integer[] (int32) |
執行中要使用的測試點標識碼。 |
| releaseEnvironmentUri |
string |
與執行相關聯的發行環境 URI。 |
| releaseReference |
與測試回合相關聯的發行參考。 |
|
| releaseUri |
string |
與執行相關聯的發行 URI。 |
| runSummary |
執行類型 = NoConfigRun 的執行摘要。 |
|
| runTimeout |
string (TimeSpan) |
時間範圍直到運行逾時。 |
| sourceWorkflow |
string |
測試回合的SourceWorkFlow(CI/CD)。 |
| startDate |
string |
執行的開始日期時間。 |
| state |
string |
執行的狀態。 類型 TestRunState 有效狀態 - NotStarted、InProgress、Waiting |
| tags |
Test |
要附加測試回合的標籤,最多可以新增5個標記來執行。 |
| testConfigurationsMapping |
string |
測試回合的TestConfigurationMapping。 |
| testEnvironmentId |
string |
與回合相關聯的測試環境標識碼。 |
| testSettings |
測試設定資源的抽象參考。 |
|
| type |
string |
run(RunType) 有效值的類型:(Unspecified、Normal、Blocking、Web、MtrRunInitiatedFromWeb、RunWithDtlEnv、NoConfigRun) |
RunFilter
這個類別用來提供用於探索的篩選條件
| 名稱 | 類型 | Description |
|---|---|---|
| sourceFilter |
string |
測試案例來源的篩選 (測試容器) |
| testCaseFilter |
string |
測試案例的篩選 |
RunStatistic
測試每個結果的執行統計數據。
| 名稱 | 類型 | Description |
|---|---|---|
| count |
integer (int32) |
給定結果的測試結果計數。 |
| outcome |
string |
測試結果結果 |
| resolutionState |
測試回合解析狀態。 |
|
| resultMetadata |
所指定結果/計數的 ResultMetadata。 |
|
| state |
string |
測試回合的狀態 |
RunSummaryModel
針對每個輸出類型的測試執行摘要。
| 名稱 | 類型 | Description |
|---|---|---|
| duration |
integer (int64) |
以毫秒為單位的總時間。 |
| resultCount |
integer (int32) |
結果 TestOutcome 的結果數目 |
| testOutcome |
摘要是以結果為基礎 |
ShallowReference
一些其他資源的抽象參考。 這個類別可用來提供建置數據合約,以統一的方式參考其他資源,以提供簡單的透過連結周遊的方式。
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string |
資源的標識碼 |
| name |
string |
連結資源名稱(定義名稱、控制器名稱等) |
| url |
string |
資源的完整 HTTP 連結 |
StageReference
管線中的階段
| 名稱 | 類型 | Description |
|---|---|---|
| attempt |
integer (int32) |
嘗試階段數目 |
| stageName |
string |
階段的名稱。 名稱支援的長度上限為 256 個字元。 |
TestEnvironment
測試環境詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| environmentId |
string (uuid) |
測試環境標識碼。 |
| environmentName |
string |
測試環境名稱。 |
TestOutcome
| 值 | Description |
|---|---|
| aborted |
測試已中止。 這不是由使用者手勢所造成,而是由架構決策所造成。 |
| blocked |
測試有機會執行,但不是,因為 ITestElement.IsRunnable == false。 |
| error |
我們嘗試執行測試時發生系統錯誤。 |
| failed |
測試已執行,但發生問題。 問題可能涉及例外狀況或失敗的判斷提示。 |
| inProgress |
測試目前正在執行。 已針對 TCM 圖表新增此專案 |
| inconclusive |
測試已完成,但我們無法指出它是否已通過或失敗。 可用於中止的測試... |
| none |
測試尚未完成,或測試類型未報告通過/失敗。 |
| notApplicable |
測試不適用於執行。 |
| notExecuted |
測試未執行。 這是由使用者手勢所造成,例如使用者按下停止按鈕。 |
| notImpacted |
測試不會受到影響。 已新增 fot TIA。 |
| passed |
測試已執行 w/o 任何問題。 |
| paused |
測試已暫停。 |
| timeout |
測試逾時 |
| unspecified |
只在更新期間使用,以保留現有的值。 |
| warning |
若要由執行層級結果使用。 這不是失敗。 |
TestResolutionState
測試解析狀態詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| id |
integer (int32) |
測試解析狀態標識碼。 |
| name |
string |
測試解析狀態名稱。 |
| project |
一些其他資源的抽象參考。 這個類別可用來提供建置數據合約,以統一的方式參考其他資源,以提供簡單的透過連結周遊的方式。 |
TestRun
測試回合詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| build |
與此測試回合相關聯的組建。 |
|
| buildConfiguration |
建立與此測試回合相關聯的組態詳細數據。 |
|
| comment |
string |
分析回合的批注。 |
| completedDate |
string (date-time) |
執行完成的日期時間。 |
| controller |
string |
測試執行控制器。 |
| createdDate |
string (date-time) |
測試回合 CreatedDate。 |
| customFields |
TestRun 的自定義欄位清單。 |
|
| dropLocation |
string |
卸除測試回合的位置。 |
| dtlAutEnvironment |
一些其他資源的抽象參考。 這個類別可用來提供建置數據合約,以統一的方式參考其他資源,以提供簡單的透過連結周遊的方式。 |
|
| dtlEnvironment |
一些其他資源的抽象參考。 這個類別可用來提供建置數據合約,以統一的方式參考其他資源,以提供簡單的透過連結周遊的方式。 |
|
| dtlEnvironmentCreationDetails |
這是暫存類別,可提供測試回合環境的詳細數據。 |
|
| dueDate |
string (date-time) |
測試回合的到期日期和時間。 |
| errorMessage |
string |
與執行相關聯的錯誤訊息。 |
| filter |
這個類別用來提供用於探索的篩選條件 |
|
| id |
integer (int32) |
測試回合的標識碼。 |
| incompleteTests |
integer (int32) |
不完整的測試數目。 |
| isAutomated |
boolean |
如果測試回合是自動化的,則為 true,否則為 false。 |
| iteration |
string |
執行所屬的反覆專案。 |
| lastUpdatedBy |
上次更新測試回合的小組基礎標識碼。 |
|
| lastUpdatedDate |
string (date-time) |
上次更新的日期和時間 |
| name |
string |
測試回合的名稱。 |
| notApplicableTests |
integer (int32) |
不適用的測試數目。 |
| owner |
執行擁有者的Team Foundation識別碼。 |
|
| passedTests |
integer (int32) |
執行中通過的測試數目 |
| phase |
string |
testRun 的階段/狀態。 |
| pipelineReference |
這個測試回合所屬之管線的參考。 |
|
| plan |
與此測試回合相關聯的測試計劃。 |
|
| postProcessState |
string |
後續處理狀態。 |
| project |
與此執行相關聯的專案。 |
|
| release |
測試回合的版本參考。 |
|
| releaseEnvironmentUri |
string |
TestRun 的版本環境 URI。 |
| releaseUri |
string |
TestRun 的版本 URI。 |
| revision |
integer (int32) |
|
| runStatistics |
依結果執行 RunSummary。 |
|
| startedDate |
string (date-time) |
執行的開始日期時間。 |
| state |
string |
執行的狀態。 類型 TestRunState 有效狀態 - 未指定、NotStarted、InProgress、Completed、Waiting、Aborted、NeedsInvestigation |
| substate |
TestRun Substate。 |
|
| tags |
Test |
附加至此測試回合的標籤。 |
| testEnvironment |
與執行相關聯的測試環境。 |
|
| testMessageLogId |
integer (int32) |
|
| testSettings |
一些其他資源的抽象參考。 這個類別可用來提供建置數據合約,以統一的方式參考其他資源,以提供簡單的透過連結周遊的方式。 |
|
| totalTests |
integer (int32) |
執行中的測試總數 |
| unanalyzedTests |
integer (int32) |
執行中失敗的測試數目。 |
| url |
string |
測試回合的 URL |
| webAccessUrl |
string |
TestRun 的 Web 存取 URL。 |
TestRunSubstate
測試回合的子狀態類型。
| 值 | Description |
|---|---|
| abortedBySystem |
由系統中止時執行狀態。 |
| analyzed |
分析之後執行狀態。 |
| canceledByUser |
建立環境時執行狀態。 |
| cancellationInProgress |
取消進行時執行狀態。 |
| creatingEnvironment |
建立環境時執行狀態。 |
| none |
使用 noState 執行。 |
| pendingAnalysis |
暫止分析時執行狀態。 |
| runningTests |
執行測試時執行狀態。 |
| timedOut |
運行時間為 timedOut 時執行狀態。 |
TestTag
附加至執行或結果的標籤。
| 名稱 | 類型 | Description |
|---|---|---|
| name |
string |
標記的名稱,英數位元值小於 30 個字元 |