Results - Add

將測試結果新增至測試回合。

POST https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?api-version=7.1-preview.6

URI 參數

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

string

Azure DevOps 組織的名稱。

project
path True

string

專案識別碼或專案名稱

runId
path True

integer

int32

測試執行識別碼,其中要加入的測試結果。

api-version
query True

string

要使用的 API 版本。 這應該設定為 '7.1-preview.6',以使用此版本的 API。

要求本文

名稱 類型 Description
body

TestCaseResult[]

要新增的測試結果清單。

回應

名稱 類型 Description
200 OK

TestCaseResult[]

成功作業

安全性

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 授與讀取、建立及更新測試計劃、案例、結果和其他測試管理相關成品的能力。

範例

Sample Request

POST https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/24/results?api-version=7.1-preview.6

[
  {
    "testCaseTitle": "VerifyWebsiteTheme",
    "automatedTestName": "FabrikamFiber.WebSite.TestClass.VerifyWebsiteTheme",
    "priority": 1,
    "outcome": "Passed"
  },
  {
    "testCaseTitle": "VerifyWebsiteLinks",
    "automatedTestName": "FabrikamFiber.WebSite.TestClass.VerifyWebsiteLinks",
    "priority": 2,
    "outcome": "Failed",
    "associatedBugs": [
      {
        "id": 30
      }
    ]
  }
]

Sample Response

{
  "count": 2,
  "value": [
    {
      "id": 100000,
      "project": {},
      "testRun": {},
      "lastUpdatedBy": {
        "id": null
      },
      "url": ""
    },
    {
      "id": 100001,
      "project": {},
      "testRun": {},
      "lastUpdatedBy": {
        "id": null
      },
      "url": ""
    }
  ]
}

定義

名稱 Description
BuildReference

組建的參考。

CustomTestField

自訂欄位資訊。 允許的索引鍵:值組 - ( AttemptId:int 值、IsTestResultFlaky:bool)

FailingSince

失敗,因為測試結果的資訊。

IdentityRef
ReferenceLinks

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

ReleaseReference

發行的參考。

ResultGroupType
ShallowReference

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

SharedStepModel

共用步驟工作專案的參考。

TestActionResultModel

表示測試步驟結果。

TestCaseResult

表示測試結果。

TestCaseResultAttachmentModel

測試反復專案中的測試附件資訊。

TestCaseResultIdentifier

測試結果的參考。

TestIterationDetailsModel

表示測試反復專案結果。

TestResultParameterModel

測試反復專案中的測試參數資訊。

TestSubResult

表示測試結果的子結果。

BuildReference

組建的參考。

名稱 類型 Description
branchName

string

分支名稱。

buildSystem

string

建置系統。

definitionId

integer

組建定義識別碼。

id

integer

組建識別碼。

number

string

組建編號。

repositoryId

string

存放庫識別碼。

uri

string

建置 URI。

CustomTestField

自訂欄位資訊。 允許的索引鍵:值組 - ( AttemptId:int 值、IsTestResultFlaky:bool)

名稱 類型 Description
fieldName

string

欄位名稱。

value

object

域值。

FailingSince

失敗,因為測試結果的資訊。

名稱 類型 Description
build

BuildReference

建置參考,因為失敗。

date

string

自 UTC) 失敗 (以來的時間。

release

ReleaseReference

發行參考,因為失敗。

IdentityRef

名稱 類型 Description
_links

ReferenceLinks

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

descriptor

string

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

directoryAlias

string

已淘汰 - 藉由查詢 IdentityRef 「_links」 字典之 「self」 專案中參考的 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 是此圖表主體來源資源的完整路由。

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

名稱 類型 Description
links

object

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

ReleaseReference

發行的參考。

名稱 類型 Description
attempt

integer

發行嘗試次數。

creationDate

string

發行建立日期 (UTC) 。

definitionId

integer

發行定義識別碼。

environmentCreationDate

string

環境建立日期 (UTC) 。

environmentDefinitionId

integer

發行環境定義識別碼。

environmentDefinitionName

string

發行環境定義名稱。

environmentId

integer

發行環境識別碼。

environmentName

string

發行環境名稱。

id

integer

版本識別碼。

name

string

發行版本名稱。

ResultGroupType

名稱 類型 Description
dataDriven

string

測試結果的階層類型。

generic

string

未知的階層類型。

none

string

測試結果的分葉節點。

orderedTest

string

測試結果的階層類型。

rerun

string

測試結果的階層類型。

ShallowReference

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

名稱 類型 Description
id

string

資源的識別碼

name

string

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

url

string

資源的完整 HTTP 連結

SharedStepModel

共用步驟工作專案的參考。

名稱 類型 Description
id

integer

WorkItem 共用步驟識別碼。

revision

integer

共用步驟工作專案修訂。

TestActionResultModel

表示測試步驟結果。

名稱 類型 Description
actionPath

string

測試案例工作專案中測試步驟的路徑識別碼。 注意:1) 以十六進位格式表示,其中步驟有 8 位數。 2) 內部,第一個步驟的步驟識別碼值從 2 開始,因此 actionPath = 00000002步驟 9,會有識別碼 = 10 且 actionPath = 00000000a 步驟 15 會有識別碼 =16 且 actionPath = 00000010 3) shared 步驟的 actionPath 會與測試案例的父步驟串連。 例如,其類型為 - 0000000300000001其中00000003代表測試步驟的移動路徑,而00000001表示共用步驟的移動路徑

comment

string

結果中的批註。

completedDate

string

執行完成的時間 (UTC) 。

durationInMs

number

執行持續時間。

errorMessage

string

結果的錯誤訊息。

iterationId

integer

測試動作結果的反復專案識別碼。

outcome

string

結果的測試結果。

sharedStepModel

SharedStepModel

共用步驟工作專案的參考。

startedDate

string

執行開始的時間 (UTC) 。

stepIdentifier

string

這是測試案例的步驟識別碼。 針對共用步驟,它是測試案例工作專案中共用步驟的步驟識別碼;共用步驟中的步驟識別碼。 範例:TestCase workitem 有兩個步驟:1) Id = 1 2) 共用步驟識別碼 = 2。 在共用步驟內:識別碼為 1 步驟的) 一般步驟 = 1 步驟步驟:「1」 第二個步驟:「2;1」

url

string

測試動作結果的 URL。 在託管環境中已被取代。

TestCaseResult

表示測試結果。

名稱 類型 Description
afnStripId

integer

測試動作錄製的附件識別碼。

area

ShallowReference

測試區域路徑的參考。

associatedBugs

ShallowReference[]

連結至測試結果之 Bug 的參考。

automatedTestId

string

代表 dll 中測試方法的識別碼。

automatedTestName

string

執行之測試的完整名稱。

automatedTestStorage

string

測試所屬的容器。

automatedTestType

string

自動化測試的類型。

automatedTestTypeId

string

自動化測試的 TypeId。

build

ShallowReference

與測試結果相關聯的建置淺層參考。

buildReference

BuildReference

與測試結果相關聯的組建參考。

comment

string

在具有 maxSize= 1000 個字元的測試結果中加上批註。

completedDate

string

測試執行完成的時間 (UTC) 。 完成日期應大於 StartedDate。

computerName

string

執行測試的電腦名稱稱。

configuration

ShallowReference

測試組態的參考。 輸入 ShallowReference。

createdDate

string

(UTC) 建立測試結果時的時間戳記。

customFields

CustomTestField[]

測試結果的其他屬性。

durationInMs

number

以毫秒為單位的測試執行持續時間。 如果未提供值,則會設定為 CompletedDate - StartedDate

errorMessage

string

測試執行中的錯誤訊息。

failingSince

FailingSince

測試結果啟動失敗時的資訊。

failureType

string

測試結果失敗類型。 有效值= (已知問題、新問題、回歸、未知、無)

id

integer

測試結果的識別碼。

iterationDetails

TestIterationDetailsModel[]

測試反復專案僅用於手動測試的測試結果詳細資料。

lastUpdatedBy

IdentityRef

上次更新測試結果的身分識別參考。

lastUpdatedDate

string

上次更新的測試結果日期時間 (UTC) 。

outcome

string

測試結果的測試結果。 有效值 = (Unspecified、None、Passed、Failed、Inconclusive、Timeout、Aborted、Blocked、NotExecuted、Warning、Error、NotApplicable、Paused、InProgress、NotImpacted)

owner

IdentityRef

測試擁有者的參考。

priority

integer

執行測試的優先順序。

project

ShallowReference

Team 專案的參考。

release

ShallowReference

與測試結果相關聯的發行淺層參考。

releaseReference

ReleaseReference

與測試結果相關聯的發行參考。

resetCount

integer

ResetCount。

resolutionState

string

測試結果的解決狀態。

resolutionStateId

integer

解析狀態的識別碼。

resultGroupType

ResultGroupType

結果的階層類型,預設值為 None 表示其分葉節點。

revision

integer

測試結果的修訂編號。

runBy

IdentityRef

身分識別的參考已執行測試。

stackTrace

string

具有 maxSize= 1000 個字元的 Stacktrace。

startedDate

string

測試執行開始的時間 (UTC) 。

state

string

測試結果的狀態。 輸入 TestRunState。

subResults

TestSubResult[]

測試結果內的子結果清單,如果 ResultGroupType 不是 None,則會保留對應的類型子結果。

testCase

ShallowReference

所執行測試的參考。

testCaseReferenceId

integer

測試結果所使用的測試參考識別碼。 輸入 TestResultMetaData

testCaseRevision

integer

TestCaseRevision Number。

testCaseTitle

string

測試的名稱。

testPlan

ShallowReference

測試計劃測試案例工作專案的參考是 的一部分。

testPoint

ShallowReference

所執行測試點的參考。

testRun

ShallowReference

測試回合的參考。

testSuite

ShallowReference

測試套件測試案例 workitem 的參考是 的一部分。

url

string

測試結果的 URL。

TestCaseResultAttachmentModel

測試反復專案中的測試附件資訊。

名稱 類型 Description
actionPath

string

測試案例工作專案中的路徑識別碼測試步驟。

id

integer

附件識別碼。

iterationId

integer

反復專案識別碼。

name

string

附件的名稱。

size

integer

附件大小。

url

string

附件的 URL。

TestCaseResultIdentifier

測試結果的參考。

名稱 類型 Description
testResultId

integer

測試結果識別碼。

testRunId

integer

測試回合識別碼。

TestIterationDetailsModel

表示測試反復專案結果。

名稱 類型 Description
actionResults

TestActionResultModel[]

測試步驟會產生反復專案。

attachments

TestCaseResultAttachmentModel[]

測試反復專案結果中附件的參考。

comment

string

測試反復專案結果中的批註。

completedDate

string

執行完成的時間 (UTC) 。

durationInMs

number

執行持續時間。

errorMessage

string

測試反復專案結果執行中的錯誤訊息。

id

integer

測試反復專案結果的識別碼。

outcome

string

測試反復專案結果是否為測試結果。

parameters

TestResultParameterModel[]

反復專案中的測試參數。

startedDate

string

執行開始的時間 (UTC) 。

url

string

測試反復專案結果的 URL。

TestResultParameterModel

測試反復專案中的測試參數資訊。

名稱 類型 Description
actionPath

string

參考參數的測試步驟路徑。

iterationId

integer

反復專案識別碼。

parameterName

string

參數的名稱。

stepIdentifier

string

這是測試案例的步驟識別碼。 針對共用步驟,它是測試案例工作專案中共用步驟的步驟識別碼;共用步驟中的步驟識別碼。 範例:TestCase workitem 有兩個步驟:1) Id = 1 2) 共用步驟識別碼 = 2。 在共用步驟內:識別碼為 1 步驟的) 一般步驟 = 1 步驟步驟:「1」 第二個步驟:「2;1」

url

string

測試參數的 URL。 在託管環境中已被取代。

value

string

參數的值。

TestSubResult

表示測試結果的子結果。

名稱 類型 Description
comment

string

子結果中的批註。

completedDate

string

測試執行完成的時間 (UTC) 。

computerName

string

執行測試的電腦。

configuration

ShallowReference

測試組態的參考。

customFields

CustomTestField[]

子結果的其他屬性。

displayName

string

子結果的名稱。

durationInMs

integer

測試執行的持續時間。

errorMessage

string

子結果中的錯誤訊息。

id

integer

子結果的識別碼。

lastUpdatedDate

string

結果上次更新的時間 (UTC) 。

outcome

string

子結果的結果。

parentId

integer

子結果的立即父識別碼。

resultGroupType

ResultGroupType

結果的階層類型,預設值 None 表示其分葉節點。

sequenceId

integer

子結果的索引編號。

stackTrace

string

Stacktrace。

startedDate

string

測試執行開始的時間 (UTC) 。

subResults

TestSubResult[]

子結果內的子結果清單,如果 ResultGroupType 不是 None,則會保留對應的類型子結果。

testResult

TestCaseResultIdentifier

測試結果的參考。

url

string

子結果的 URL。