Share via


Testlog - Get Test Run Logs

Get list of test run attachments reference

GET https://vstmr.dev.azure.com/{organization}/{project}/_apis/testresults/runs/{runId}/testlog?type=generalAttachment&api-version=7.1-preview.1
GET https://vstmr.dev.azure.com/{organization}/{project}/_apis/testresults/runs/{runId}/testlog?type=generalAttachment&directoryPath={directoryPath}&fileNamePrefix={fileNamePrefix}&fetchMetaData={fetchMetaData}&top={top}&api-version=7.1-preview.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

project
path True

string

Project ID or project name

runId
path True

integer (int32)

Id of the test run

api-version
query True

string

Version of the API to use. This should be set to '7.1-preview.1' to use this version of the api.

type
query True

TestLogType

type of the attachments to get

directoryPath
query

string

directory path for which attachments are needed

fetchMetaData
query

boolean

Default is false, set if metadata is needed

fileNamePrefix
query

string

file name prefix to filter the list of attachment

top
query

integer (int32)

Number of attachments reference to return

Request Header

Name Required Type Description
continuationToken

string

Header to pass the continuationToken

Responses

Name Type Description
200 OK

TestLog[]

successful operation

Security

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

Name Description
vso.test Grants the ability to read test plans, cases, results and other test management related artifacts.

Examples

Get test logs for run

Sample request

GET https://vstmr.dev.azure.com/fabrikam/Fabrikam/_apis/testresults/runs/1/testlog?type=generalAttachment&api-version=7.1-preview.1

Sample response

{
  "logReference": {
    "scope": 0,
    "buildId": 0,
    "releaseId": 0,
    "releaseEnvId": 0,
    "runId": 1,
    "resultId": 0,
    "subResultId": 0,
    "type": 1,
    "filePath": "textAsFileAttachment.txt"
  },
  "modifiedOn": "/Date(1561363645000)/",
  "size": 65826,
  "metaData": {}
}

Definitions

Name Description
TestLog

Represents Test Log Result object.

TestLogReference

Test Log Reference object

TestLogScope

Test Log Scope

TestLogType

Log Type

TestLog

Represents Test Log Result object.

Name Type Description
logReference

TestLogReference

Test Log Context run, build

metaData

object

Meta data for Log file

modifiedOn

string (date-time)

LastUpdatedDate for Log file

size

integer (int64)

Size in Bytes for Log file

TestLogReference

Test Log Reference object

Name Type Description
buildId

integer (int32)

BuildId for test log, if context is build

filePath

string

FileName for log file

releaseEnvId

integer (int32)

ReleaseEnvId for test log, if context is Release

releaseId

integer (int32)

ReleaseId for test log, if context is Release

resultId

integer (int32)

Resultid for test log, if context is run and log is related to result

runId

integer (int32)

runid for test log, if context is run

scope

TestLogScope

Test Log Scope

subResultId

integer (int32)

SubResultid for test log, if context is run and log is related to subresult

type

TestLogType

Log Type

TestLogScope

Test Log Scope

Value Description
run

Log file is associated with Run, result, subresult

TestLogType

Log Type

Value Description
generalAttachment

Any gereric attachment.