Delen via


Runs - Query

Query Test Runs based on filters. Mandatory fields are minLastUpdatedDate and maxLastUpdatedDate.

GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?minLastUpdatedDate={minLastUpdatedDate}&maxLastUpdatedDate={maxLastUpdatedDate}&api-version=7.1
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?minLastUpdatedDate={minLastUpdatedDate}&maxLastUpdatedDate={maxLastUpdatedDate}&state={state}&planIds={planIds}&isAutomated={isAutomated}&publishContext={publishContext}&buildIds={buildIds}&buildDefIds={buildDefIds}&branchName={branchName}&releaseIds={releaseIds}&releaseDefIds={releaseDefIds}&releaseEnvIds={releaseEnvIds}&releaseEnvDefIds={releaseEnvDefIds}&runTitle={runTitle}&$top={$top}&continuationToken={continuationToken}&api-version=7.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

api-version
query True

string

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

maxLastUpdatedDate
query True

string

date-time

Maximum Last Modified Date of run to be queried (Mandatory, difference between min and max date can be atmost 7 days).

minLastUpdatedDate
query True

string

date-time

Minimum Last Modified Date of run to be queried (Mandatory).

$top
query

integer

int32

Number of runs to be queried. Limit is 100

branchName
query

string

Source Branch name of the Runs to be queried.

buildDefIds
query

string

array (int32)

Build Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).

buildIds
query

string

array (int32)

Build Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).

continuationToken
query

string

continuationToken received from previous batch or null for first batch. It is not supposed to be created (or altered, if received from last batch) by user.

isAutomated
query

boolean

Automation type of the Runs to be queried.

planIds
query

string

array (int32)

Plan Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).

publishContext
query

TestRunPublishContext

PublishContext of the Runs to be queried.

releaseDefIds
query

string

array (int32)

Release Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).

releaseEnvDefIds
query

string

array (int32)

Release Environment Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).

releaseEnvIds
query

string

array (int32)

Release Environment Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).

releaseIds
query

string

array (int32)

Release Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10).

runTitle
query

string

Run Title of the Runs to be queried.

state
query

TestRunState

Current state of the Runs to be queried.

Responses

Name Type Description
200 OK

TestRun[]

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.

Definitions

Name Description
BuildConfiguration

BuildConfiguration Details.

CustomTestField

A custom field information. Allowed Key : Value pairs - ( AttemptId: int value, IsTestResultFlaky: bool)

DtlEnvironmentDetails

This is a temporary class to provide the details for the test run environment.

IdentityRef
JobReference

Job in pipeline. This is related to matrixing in YAML.

PhaseReference

Phase in pipeline

PipelineReference

Pipeline reference

ReferenceLinks

The class to represent a collection of REST reference links.

ReleaseReference

Reference to a release.

ResultMetadata

ResultMetadata for the given outcome/count.

RunFilter

This class is used to provide the filters used for discovery

RunStatistic

Test run statistics per outcome.

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

StageReference

Stage in pipeline

TestEnvironment

Test environment Detail.

TestResolutionState

Test Resolution State Details.

TestRun

Test run details.

TestRunPublishContext

PublishContext of the Runs to be queried.

TestRunState
TestRunSubstate

The types of sub states for test run.

TestTag

Tag attached to a run or result.

BuildConfiguration

BuildConfiguration Details.

Name Type Description
branchName

string

Branch name for which build is generated.

buildDefinitionId

integer

BuildDefinitionId for build.

buildSystem

string

Build system.

creationDate

string

Build Creation Date.

flavor

string

Build flavor (eg Build/Release).

id

integer

BuildConfiguration Id.

number

string

Build Number.

platform

string

BuildConfiguration Platform.

project

ShallowReference

Project associated with this BuildConfiguration.

repositoryGuid

string

Repository Guid for the Build.

repositoryType

string

Repository Type (eg. TFSGit).

sourceVersion

string

Source Version(/first commit) for the build was triggered.

targetBranchName

string

Target BranchName.

uri

string

Build Uri.

CustomTestField

A custom field information. Allowed Key : Value pairs - ( AttemptId: int value, IsTestResultFlaky: bool)

Name Type Description
fieldName

string

Field Name.

value

object

Field value.

DtlEnvironmentDetails

This is a temporary class to provide the details for the test run environment.

Name Type Description
csmContent

string

csmParameters

string

subscriptionName

string

IdentityRef

Name Type Description
_links

ReferenceLinks

This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject.

descriptor

string

The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations.

directoryAlias

string

Deprecated - Can be retrieved by querying the Graph user referenced in the "self" entry of the IdentityRef "_links" dictionary

displayName

string

This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider.

id

string

imageUrl

string

Deprecated - Available in the "avatar" entry of the IdentityRef "_links" dictionary

inactive

boolean

Deprecated - Can be retrieved by querying the Graph membership state referenced in the "membershipState" entry of the GraphUser "_links" dictionary

isAadIdentity

boolean

Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsAadUserType/Descriptor.IsAadGroupType)

isContainer

boolean

Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsGroupType)

isDeletedInOrigin

boolean

profileUrl

string

Deprecated - not in use in most preexisting implementations of ToIdentityRef

uniqueName

string

Deprecated - use Domain+PrincipalName instead

url

string

This url is the full route to the source resource of this graph subject.

JobReference

Job in pipeline. This is related to matrixing in YAML.

Name Type Description
attempt

integer

Attempt number of the job

jobName

string

Matrixing in YAML generates copies of a job with different inputs in matrix. JobName is the name of those input. Maximum supported length for name is 256 character.

PhaseReference

Phase in pipeline

Name Type Description
attempt

integer

Attempt number of the phase

phaseName

string

Name of the phase. Maximum supported length for name is 256 character.

PipelineReference

Pipeline reference

Name Type Description
jobReference

JobReference

Reference of the job

phaseReference

PhaseReference

Reference of the phase.

pipelineId

integer

Reference of the pipeline with which this pipeline instance is related.

stageReference

StageReference

Reference of the stage.

The class to represent a collection of REST reference links.

Name Type Description
links

object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.

ReleaseReference

Reference to a release.

Name Type Description
attempt

integer

Number of Release Attempt.

creationDate

string

Release Creation Date(UTC).

definitionId

integer

Release definition ID.

environmentCreationDate

string

Environment creation Date(UTC).

environmentDefinitionId

integer

Release environment definition ID.

environmentDefinitionName

string

Release environment definition name.

environmentId

integer

Release environment ID.

environmentName

string

Release environment name.

id

integer

Release ID.

name

string

Release name.

ResultMetadata

ResultMetadata for the given outcome/count.

Name Type Description
flaky

string

Flaky metadata

rerun

string

Rerun metadata

RunFilter

This class is used to provide the filters used for discovery

Name Type Description
sourceFilter

string

filter for the test case sources (test containers)

testCaseFilter

string

filter for the test cases

RunStatistic

Test run statistics per outcome.

Name Type Description
count

integer

Test result count fo the given outcome.

outcome

string

Test result outcome

resolutionState

TestResolutionState

Test run Resolution State.

resultMetadata

ResultMetadata

ResultMetadata for the given outcome/count.

state

string

State of the test run

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

Name Type Description
id

string

ID of the resource

name

string

Name of the linked resource (definition name, controller name, etc.)

url

string

Full http link to the resource

StageReference

Stage in pipeline

Name Type Description
attempt

integer

Attempt number of stage

stageName

string

Name of the stage. Maximum supported length for name is 256 character.

TestEnvironment

Test environment Detail.

Name Type Description
environmentId

string

Test Environment Id.

environmentName

string

Test Environment Name.

TestResolutionState

Test Resolution State Details.

Name Type Description
id

integer

Test Resolution state Id.

name

string

Test Resolution State Name.

project

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

TestRun

Test run details.

Name Type Description
build

ShallowReference

Build associated with this test run.

buildConfiguration

BuildConfiguration

Build configuration details associated with this test run.

comment

string

Comments entered by those analyzing the run.

completedDate

string

Completed date time of the run.

controller

string

Test Run Controller.

createdDate

string

Test Run CreatedDate.

customFields

CustomTestField[]

List of Custom Fields for TestRun.

dropLocation

string

Drop Location for the test Run.

dtlAutEnvironment

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

dtlEnvironment

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

dtlEnvironmentCreationDetails

DtlEnvironmentDetails

This is a temporary class to provide the details for the test run environment.

dueDate

string

Due date and time for test run.

errorMessage

string

Error message associated with the run.

filter

RunFilter

This class is used to provide the filters used for discovery

id

integer

ID of the test run.

incompleteTests

integer

Number of Incomplete Tests.

isAutomated

boolean

true if test run is automated, false otherwise.

iteration

string

The iteration to which the run belongs.

lastUpdatedBy

IdentityRef

Team foundation ID of the last updated the test run.

lastUpdatedDate

string

Last updated date and time

name

string

Name of the test run.

notApplicableTests

integer

Number of Not Applicable Tests.

owner

IdentityRef

Team Foundation ID of the owner of the runs.

passedTests

integer

Number of passed tests in the run

phase

string

Phase/State for the testRun.

pipelineReference

PipelineReference

Reference of the pipeline to which this test run belongs.

plan

ShallowReference

Test plan associated with this test run.

postProcessState

string

Post Process State.

project

ShallowReference

Project associated with this run.

release

ReleaseReference

Release Reference for the Test Run.

releaseEnvironmentUri

string

Release Environment Uri for TestRun.

releaseUri

string

Release Uri for TestRun.

revision

integer

runStatistics

RunStatistic[]

RunSummary by outcome.

startedDate

string

Start date time of the run.

state

string

The state of the run. Type TestRunState Valid states - Unspecified ,NotStarted, InProgress, Completed, Waiting, Aborted, NeedsInvestigation

substate

TestRunSubstate

TestRun Substate.

tags

TestTag[]

Tags attached with this test run.

testEnvironment

TestEnvironment

Test environment associated with the run.

testMessageLogId

integer

testSettings

ShallowReference

An abstracted reference to some other resource. This class is used to provide the build data contracts with a uniform way to reference other resources in a way that provides easy traversal through links.

totalTests

integer

Total tests in the run

unanalyzedTests

integer

Number of failed tests in the run.

url

string

Url of the test run

webAccessUrl

string

Web Access Url for TestRun.

TestRunPublishContext

PublishContext of the Runs to be queried.

Name Type Description
all

string

Run is published for any Context.

build

string

Run is published for Build Context.

release

string

Run is published for Release Context.

TestRunState

Name Type Description
aborted

string

Run is stopped and remaining tests have been aborted

completed

string

All tests have completed or been skipped.

inProgress

string

Tests are running.

needsInvestigation

string

Run requires investigation because of a test point failure This is a legacy state and should not be used any more

notStarted

string

The run is still being created. No tests have started yet.

unspecified

string

Only used during an update to preserve the existing value.

waiting

string

Run is currently initializing This is a legacy state and should not be used any more

TestRunSubstate

The types of sub states for test run.

Name Type Description
abortedBySystem

string

Run state when it is Aborted By the System.

analyzed

string

Run state after being Analysed.

canceledByUser

string

Run state while Creating Environment.

cancellationInProgress

string

Run state when cancellation is in Progress.

creatingEnvironment

string

Run state while Creating Environment.

none

string

Run with noState.

pendingAnalysis

string

Run state while Pending Analysis.

runningTests

string

Run state while Running Tests.

timedOut

string

Run state when run has timedOut.

TestTag

Tag attached to a run or result.

Name Type Description
name

string

Name of the tag, alphanumeric value less than 30 chars