共用方式為


Results - Get

取得測試回合的測試結果。

GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results/{testCaseResultId}?api-version=7.1
GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results/{testCaseResultId}?detailsToInclude={detailsToInclude}&api-version=7.1

URI 參數

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

string

Azure DevOps 組織的名稱。

project
path True

string

項目識別碼或項目名稱

runId
path True

integer (int32)

要擷取之測試結果的測試回合標識碼。

testCaseResultId
path True

integer (int32)

測試結果標識碼。

api-version
query True

string

要使用的 API 版本。 這應該設定為 『7.1』 以使用此版本的 API。

detailsToInclude
query

ResultDetails

要包含在測試結果中的詳細數據。 預設值為 None。 其他值為反覆專案、WorkItems 和 SubResults。

回應

名稱 類型 Description
200 OK

TestCaseResult

成功作業

安全性

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

範例

範例要求

GET https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16/results/100000?api-version=7.1

範例回覆

{
  "id": 100000,
  "project": {
    "id": "5c3d39df-a0cb-49da-be01-42e53792c0e1",
    "name": "Fabrikam-Fiber-TFVC",
    "url": "https://dev.azure.com/fabrikam/_apis/projects/Fabrikam-Fiber-TFVC"
  },
  "startedDate": "2016-07-13T11:12:48.487Z",
  "completedDate": "2016-07-13T11:12:48.493Z",
  "durationInMs": 4,
  "outcome": "Passed",
  "revision": 1,
  "runBy": {
    "id": "a5cbf24d-799f-452e-82be-f049a85b5895",
    "displayName": "Fabrikam",
    "uniqueName": "fabrikamfiber.vsin@hotmail.com",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/a5cbf24d-799f-452e-82be-f049a85b5895",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=a5cbf24d-799f-452e-82be-f049a85b5895"
  },
  "state": "Completed",
  "testCase": {
    "name": "Pass1"
  },
  "testRun": {
    "id": "16",
    "name": "VSTest Test Run release any cpu",
    "url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16"
  },
  "lastUpdatedDate": "2016-07-13T11:12:49.123Z",
  "lastUpdatedBy": {
    "id": "375baa5b-5148-4e89-a549-ec202b722d89",
    "displayName": "Project Collection Build Service (fabrikam)",
    "uniqueName": "Build\\78b5727d-4a24-4ec8-9caf-704685572174",
    "url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/375baa5b-5148-4e89-a549-ec202b722d89",
    "imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=375baa5b-5148-4e89-a549-ec202b722d89"
  },
  "priority": 0,
  "computerName": "TASKAGENT5-0055",
  "build": {
    "id": "5",
    "name": "20160713.2",
    "url": "https://dev.azure.com/fabrikam/_apis/build/Builds/5"
  },
  "createdDate": "2016-07-13T11:12:49.123Z",
  "url": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-TFVC/_apis/test/Runs/16/Results/100000",
  "failureType": "None",
  "automatedTestStorage": "unittestproject1.dll",
  "automatedTestType": "UnitTest",
  "automatedTestTypeId": "13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b",
  "automatedTestId": "aefba017-ab06-be36-6b92-de4e29836f72",
  "area": {
    "id": "37528",
    "name": "Fabrikam-Fiber-TFVC",
    "url": "vstfs:///Classification/Node/ebe8ac79-8d9f-4a5b-8d0a-c3095c81e70e"
  },
  "testCaseTitle": "Pass1",
  "customFields": [],
  "automatedTestName": "UnitTestProject1.UnitTest1.Pass1"
}

定義

名稱 Description
BuildReference

組建的參考。

CustomTestField

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

FailingSince

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

IdentityRef
ReferenceLinks

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

ReleaseReference

版本的參考。

ResultDetails

要包含在測試結果中的詳細數據。 預設值為 None。 其他值為反覆專案、WorkItems 和 SubResults。

ResultGroupType
ShallowReference

一些其他資源的抽象參考。 這個類別可用來提供建置數據合約,以統一的方式參考其他資源,以提供簡單的透過連結周遊的方式。

SharedStepModel

共用步驟工作項目的參考。

TestActionResultModel

表示測試步驟結果。

TestCaseResult

表示測試結果。

TestCaseResultAttachmentModel

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

TestCaseResultIdentifier

測試結果的參考。

TestIterationDetailsModel

表示測試反覆項目結果。

TestResultParameterModel

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

TestSubResult

表示測試結果的子結果。

BuildReference

組建的參考。

名稱 類型 Description
branchName

string

分支名稱。

buildSystem

string

建置系統。

definitionId

integer (int32)

組建定義標識碼。

id

integer (int32)

組建標識碼。

number

string

組建編號。

repositoryId

string

存放庫標識碼。

uri

string

建置 URI。

CustomTestField

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

名稱 類型 Description
fieldName

string

功能變數名稱。

value

object

域值。

FailingSince

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

名稱 類型 Description
build

BuildReference

建置參考失敗后。

date

string (date-time)

失敗後的時間(UTC)。

release

ReleaseReference

發行參考失敗后。

IdentityRef

名稱 類型 Description
_links

ReferenceLinks

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

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 是此圖表主體來源資源的完整路由。

表示 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

版本名稱。

ResultDetails

要包含在測試結果中的詳細數據。 預設值為 None。 其他值為反覆專案、WorkItems 和 SubResults。

Description
iterations

測試結果中的測試反覆專案詳細數據。

none

測試結果的核心欄位。 核心欄位包括 State、Result、Priority、AutomatedTestName、AutomatedTestStorage、Comments、ErrorMessage 等。

point

測試結果中的點和計劃詳細數據。

subResults

測試結果中的子參數。

workItems

與測試結果相關聯的 Workitems。

ResultGroupType

Description
dataDriven

測試結果的階層類型。

generic

未知的階層類型。

none

測試結果的分葉節點。

orderedTest

測試結果的階層類型。

rerun

測試結果的階層類型。

ShallowReference

一些其他資源的抽象參考。 這個類別可用來提供建置數據合約,以統一的方式參考其他資源,以提供簡單的透過連結周遊的方式。

名稱 類型 Description
id

string

資源的標識碼

name

string

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

url

string

資源的完整 HTTP 連結

SharedStepModel

共用步驟工作項目的參考。

名稱 類型 Description
id

integer (int32)

WorkItem 共用步驟標識碼。

revision

integer (int32)

共用步驟工作專案修訂。

TestActionResultModel

表示測試步驟結果。

名稱 類型 Description
actionPath

string

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

comment

string

結果中的批注。

completedDate

string (date-time)

執行完成的時間(UTC)。

durationInMs

number (double)

執行持續時間。

errorMessage

string

結果的錯誤訊息。

iterationId

integer (int32)

測試動作結果的反覆項目標識碼。

outcome

string

結果的測試結果。

sharedStepModel

SharedStepModel

共用步驟工作項目的參考。

startedDate

string (date-time)

開始執行的時間(UTC)。

stepIdentifier

string

這是測試案例的步驟標識碼。 針對共用步驟,它是測試案例工作專案中共用步驟的步驟標識符;共用步驟中的步驟標識碼。 範例:TestCase workitem 有兩個步驟:1) 標識元 = 1 2) 共用步驟,標識符 = 2。 在共用步驟內:a) 標識符為 1 步驟的一般步驟 = 第一個步驟的 StepIdentifier 值:“1” 第二個步驟:“2;1"

url

string

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

TestCaseResult

表示測試結果。

名稱 類型 Description
afnStripId

integer (int32)

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

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 (date-time)

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

computerName

string

執行測試的計算機名稱。

configuration

ShallowReference

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

createdDate

string (date-time)

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

customFields

CustomTestField[]

測試結果的其他屬性。

durationInMs

number (double)

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

errorMessage

string

測試執行中的錯誤訊息。

failingSince

FailingSince

測試結果開始失敗時的資訊。

failureType

string

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

id

integer (int32)

測試結果的標識碼。

iterationDetails

TestIterationDetailsModel[]

測試反覆專案僅用於手動測試的測試結果詳細數據。

lastUpdatedBy

IdentityRef

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

lastUpdatedDate

string (date-time)

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

outcome

string

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

owner

IdentityRef

測試擁有者的參考。

priority

integer (int32)

執行測試的優先順序。

project

ShallowReference

Team 項目的參考。

release

ShallowReference

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

releaseReference

ReleaseReference

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

resetCount

integer (int32)

ResetCount。

resolutionState

string

測試結果的解析狀態。

resolutionStateId

integer (int32)

解析狀態的標識碼。

resultGroupType

ResultGroupType

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

revision

integer (int32)

測試結果的修訂編號。

runBy

IdentityRef

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

stackTrace

string

具有 maxSize= 1000 個字元的 Stacktrace。

startedDate

string (date-time)

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

state

string

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

subResults

TestSubResult[]

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

testCase

ShallowReference

執行測試的參考。

testCaseReferenceId

integer (int32)

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

testCaseRevision

integer (int32)

TestCaseRevision Number。

testCaseTitle

string

測試的名稱。

testPlan

ShallowReference

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

testPoint

ShallowReference

執行測試點的參考。

testRun

ShallowReference

測試回合的參考。

testSuite

ShallowReference

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

url

string

測試結果的 URL。

TestCaseResultAttachmentModel

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

名稱 類型 Description
actionPath

string

測試案例工作中的路徑標識子測試步驟。

id

integer (int32)

附件標識碼。

iterationId

integer (int32)

反覆項目標識碼。

name

string

附件的名稱。

size

integer (int64)

附件大小。

url

string

附件的 URL。

TestCaseResultIdentifier

測試結果的參考。

名稱 類型 Description
testResultId

integer (int32)

測試結果標識碼。

testRunId

integer (int32)

測試回合識別碼。

TestIterationDetailsModel

表示測試反覆項目結果。

名稱 類型 Description
actionResults

TestActionResultModel[]

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

attachments

TestCaseResultAttachmentModel[]

測試反覆項目結果中附件的參考。

comment

string

測試反覆項目結果中的批注。

completedDate

string (date-time)

執行完成的時間(UTC)。

durationInMs

number (double)

執行持續時間。

errorMessage

string

測試反覆項目結果執行中的錯誤訊息。

id

integer (int32)

測試反覆項目結果的標識碼。

outcome

string

如果測試反覆項目結果,則為測試結果。

parameters

TestResultParameterModel[]

在反覆項目中測試參數。

startedDate

string (date-time)

開始執行的時間(UTC)。

url

string

測試反覆項目結果的 URL。

TestResultParameterModel

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

名稱 類型 Description
actionPath

string

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

iterationId

integer (int32)

反覆項目標識碼。

parameterName

string

參數的名稱。

stepIdentifier

string

這是測試案例的步驟標識碼。 針對共用步驟,它是測試案例工作專案中共用步驟的步驟標識符;共用步驟中的步驟標識碼。 範例:TestCase workitem 有兩個步驟:1) 標識元 = 1 2) 共用步驟,標識符 = 2。 在共用步驟內:a) 標識符為 1 步驟的一般步驟 = 第一個步驟的 StepIdentifier 值:“1” 第二個步驟:“2;1"

url

string

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

value

string

參數的值。

TestSubResult

表示測試結果的子結果。

名稱 類型 Description
comment

string

子結果中的批注。

completedDate

string (date-time)

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

computerName

string

執行測試的計算機。

configuration

ShallowReference

測試組態的參考。

customFields

CustomTestField[]

子結果的其他屬性。

displayName

string

子結果的名稱。

durationInMs

integer (int64)

測試執行的持續時間。

errorMessage

string

子結果中的錯誤訊息。

id

integer (int32)

子結果的標識碼。

lastUpdatedDate

string (date-time)

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

outcome

string

子結果的結果。

parentId

integer (int32)

子結果的即時父標識碼。

resultGroupType

ResultGroupType

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

sequenceId

integer (int32)

子結果的索引編號。

stackTrace

string

Stacktrace。

startedDate

string (date-time)

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

subResults

TestSubResult[]

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

testResult

TestCaseResultIdentifier

測試結果的參考。

url

string

子結果的 URL。