Results - Add

Add test results to a test run.

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

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

Test run ID into which test results to add.

api-version
query True

string

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

Request Body

Name Type Description
body

TestCaseResult[]

List of test results to add.

Responses

Name Type Description
200 OK

TestCaseResult[]

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_write Grants the ability to read, create, and update test plans, cases, results and other test management related artifacts.

Examples

Sample request

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

[
  {
    "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": ""
    }
  ]
}

Definitions

Name Description
BuildReference

Reference to a build.

CustomTestField

A custom field information.

FailingSince

Failing since information of a test result.

IdentityRef
ReferenceLinks

The class to represent a collection of REST reference links.

ReleaseReference

Reference to a release.

ResultGroupType
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.

SharedStepModel

Reference to shared step workitem.

TestActionResultModel

Represents a test step result.

TestCaseResult

Represents a test result.

TestCaseResultAttachmentModel

Test attachment information in a test iteration.

TestCaseResultIdentifier

Reference to a test result.

TestIterationDetailsModel

Represents a test iteration result.

TestResultParameterModel

Test parameter information in a test iteration.

TestSubResult

Represents a sub result of a test result.

BuildReference

Reference to a build.

Name Type Description
branchName

string

Branch name.

buildSystem

string

Build system.

definitionId

integer

Build Definition ID.

id

integer

Build ID.

number

string

Build Number.

repositoryId

string

Repository ID.

uri

string

Build URI.

CustomTestField

A custom field information.

Name Type Description
fieldName

string

Field Name.

value

object

Field value.

FailingSince

Failing since information of a test result.

Name Type Description
build

BuildReference

Build reference since failing.

date

string

Time since failing.

release

ReleaseReference

Release reference since failing.

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

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

inactive

boolean

isAadIdentity

boolean

isContainer

boolean

isDeletedInOrigin

boolean

profileUrl

string

uniqueName

string

url

string

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

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

creationDate

string

definitionId

integer

Release definition ID.

environmentCreationDate

string

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.

ResultGroupType

Name Type Description
dataDriven

string

Hierarchy type of test result.

generic

string

Unknown hierarchy type.

none

string

Leaf node of test result.

orderedTest

string

Hierarchy type of test result.

rerun

string

Hierarchy type of test result.

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

SharedStepModel

Reference to shared step workitem.

Name Type Description
id

integer

WorkItem shared step ID.

revision

integer

Shared step workitem revision.

TestActionResultModel

Represents a test step result.

Name Type Description
actionPath

string

Path identifier test step in test case workitem.

comment

string

Comment in result.

completedDate

string

Time when execution completed.

durationInMs

number

Duration of execution.

errorMessage

string

Error message in result.

iterationId

integer

Iteration ID of test action result.

outcome

string

Test outcome of result.

sharedStepModel

SharedStepModel

Reference to shared step workitem.

startedDate

string

Time when execution started.

stepIdentifier

string

This is step Id of test case. For shared step, it is step Id of shared step in test case workitem; step Id in shared step. Example: TestCase workitem has two steps: 1) Normal step with Id = 1 2) Shared Step with Id = 2. Inside shared step: a) Normal Step with Id = 1 Value for StepIdentifier for First step: "1" Second step: "2;1"

url

string

Url of test action result.

TestCaseResult

Represents a test result.

Name Type Description
afnStripId

integer

Test attachment ID of action recording.

area

ShallowReference

Reference to area path of test.

associatedBugs

ShallowReference[]

Reference to bugs linked to test result.

automatedTestId

string

ID representing test method in a dll.

automatedTestName

string

Fully qualified name of test executed.

automatedTestStorage

string

Container to which test belongs.

automatedTestType

string

Type of automated test.

automatedTestTypeId

string

build

ShallowReference

Shallow reference to build associated with test result.

buildReference

BuildReference

Reference to build associated with test result.

comment

string

Comment in a test result.

completedDate

string

Time when test execution completed.

computerName

string

Machine name where test executed.

configuration

ShallowReference

Test configuration of a test result.

createdDate

string

Timestamp when test result created.

customFields

CustomTestField[]

Additional properties of test result.

durationInMs

number

Duration of test execution in milliseconds.

errorMessage

string

Error message in test execution.

failingSince

FailingSince

Information when test results started failing.

failureType

string

Failure type of test result.

id

integer

ID of a test result.

iterationDetails

TestIterationDetailsModel[]

Test result details of test iterations.

lastUpdatedBy

IdentityRef

Reference to identity last updated test result.

lastUpdatedDate

string

Last updated datetime of test result.

outcome

string

Test outcome of test result.

owner

IdentityRef

Reference to test owner.

priority

integer

Priority of test executed.

project

ShallowReference

Reference to team project.

release

ShallowReference

Shallow reference to release associated with test result.

releaseReference

ReleaseReference

Reference to release associated with test result.

resetCount

integer

resolutionState

string

Resolution state of test result.

resolutionStateId

integer

ID of resolution state.

resultGroupType

ResultGroupType

Hierarchy type of the result, default value of None means its leaf node.

revision

integer

Revision number of test result.

runBy

IdentityRef

Reference to identity executed the test.

stackTrace

string

Stacktrace.

startedDate

string

Time when test execution started.

state

string

State of test result.

subResults

TestSubResult[]

List of sub results inside a test result, if ResultGroupType is not None, it holds corresponding type sub results.

testCase

ShallowReference

Reference to the test executed.

testCaseReferenceId

integer

Reference ID of test used by test result.

testCaseRevision

integer

Name of test.

testCaseTitle

string

Name of test.

testPlan

ShallowReference

Reference to test plan test case workitem is part of.

testPoint

ShallowReference

Reference to the test point executed.

testRun

ShallowReference

Reference to test run.

testSuite

ShallowReference

Reference to test suite test case workitem is part of.

url

string

Url of test result.

TestCaseResultAttachmentModel

Test attachment information in a test iteration.

Name Type Description
actionPath

string

Path identifier test step in test case workitem.

id

integer

Attachment ID.

iterationId

integer

Iteration ID.

name

string

Name of attachment.

size

integer

Attachment size.

url

string

Url to attachment.

TestCaseResultIdentifier

Reference to a test result.

Name Type Description
testResultId

integer

Test result ID.

testRunId

integer

Test run ID.

TestIterationDetailsModel

Represents a test iteration result.

Name Type Description
actionResults

TestActionResultModel[]

Test step results in an iteration.

attachments

TestCaseResultAttachmentModel[]

Refence to attachments in test iteration result.

comment

string

Comment in test iteration result.

completedDate

string

Time when execution completed.

durationInMs

number

Duration of execution.

errorMessage

string

Error message in test iteration result execution.

id

integer

ID of test iteration result.

outcome

string

Test outcome if test iteration result.

parameters

TestResultParameterModel[]

Test parameters in an iteration.

startedDate

string

Time when execution started.

url

string

Url to test iteration result.

TestResultParameterModel

Test parameter information in a test iteration.

Name Type Description
actionPath

string

Test step path where parameter is referenced.

iterationId

integer

Iteration ID.

parameterName

string

Name of parameter.

stepIdentifier

string

This is step Id of test case. For shared step, it is step Id of shared step in test case workitem; step Id in shared step. Example: TestCase workitem has two steps: 1) Normal step with Id = 1 2) Shared Step with Id = 2. Inside shared step: a) Normal Step with Id = 1 Value for StepIdentifier for First step: "1" Second step: "2;1"

url

string

Url of test parameter.

value

string

Value of parameter.

TestSubResult

Represents a sub result of a test result.

Name Type Description
comment

string

Comment in sub result.

completedDate

string

Time when test execution completed.

computerName

string

Machine where test executed.

configuration

ShallowReference

Reference to test configuration.

customFields

CustomTestField[]

Additional properties of sub result.

displayName

string

Name of sub result.

durationInMs

integer

Duration of test execution.

errorMessage

string

Error message in sub result.

id

integer

ID of sub result.

lastUpdatedDate

string

Time when result last updated.

outcome

string

Outcome of sub result.

parentId

integer

Immediate parent ID of sub result.

resultGroupType

ResultGroupType

Hierarchy type of the result, default value of None means its leaf node.

sequenceId

integer

Index number of sub result.

stackTrace

string

Stacktrace.

startedDate

string

Time when test execution started.

subResults

TestSubResult[]

List of sub results inside a sub result, if ResultGroupType is not None, it holds corresponding type sub results.

testResult

TestCaseResultIdentifier

Reference to test result.

url

string

Url of sub result.