Attachments - Create Test Result Attachment
Attach a file to a test result.
POST https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/Results/{testCaseResultId}/attachments?api-version=5.0-preview.1
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 |
run
|
path | True |
integer int32 |
ID of the test run that contains the result. |
test
|
path | True |
integer int32 |
ID of the test result against which attachment has to be uploaded. |
api-version
|
query | True |
string |
Version of the API to use. This should be set to '5.0-preview.1' to use this version of the api. |
Name | Type | Description |
---|---|---|
attachmentType |
string |
Attachment type By Default it will be GeneralAttachment. It can be one of the following type. { GeneralAttachment, AfnStrip, BugFilingData, CodeCoverage, IntermediateCollectorData, RunConfig, TestImpactDetails, TmiTestRunDeploymentFiles, TmiTestRunReverseDeploymentFiles, TmiTestResultDetail, TmiTestRunSummary } |
comment |
string |
Comment associated with attachment |
fileName |
string |
Attachment filename |
stream |
string |
Base64 encoded file stream |
Name | Type | Description |
---|---|---|
200 OK |
successful operation |
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
Name | Description |
---|---|
vso.test_write | Grants the ability to read, create, and update test plans, cases, results and other test management related artifacts. |
Sample request
POST https://dev.azure.com/fabrikam/Fabrikam/_apis/test/Runs/49/Results/100000/attachments?api-version=5.0-preview.1
{
"stream": "VXNlciB0ZXh0IGNvbnRlbnQgdG8gdXBsb2FkLg==",
"fileName": "textAsFileAttachment.txt",
"comment": "Test attachment upload",
"attachmentType": "GeneralAttachment"
}
Sample response
{
"id": 4,
"url": "https://dev.azure.com/fabrikam/Fabrikam/_apis/test/Runs/49/Results/100000/Attachments/4"
}
Name | Description |
---|---|
Test |
Reference to test attachment. |
Test |
Test attachment request model |
Reference to test attachment.
Name | Type | Description |
---|---|---|
id |
integer |
ID of the attachment. |
url |
string |
Url to download the attachment. |
Test attachment request model
Name | Type | Description |
---|---|---|
attachmentType |
string |
Attachment type By Default it will be GeneralAttachment. It can be one of the following type. { GeneralAttachment, AfnStrip, BugFilingData, CodeCoverage, IntermediateCollectorData, RunConfig, TestImpactDetails, TmiTestRunDeploymentFiles, TmiTestRunReverseDeploymentFiles, TmiTestResultDetail, TmiTestRunSummary } |
comment |
string |
Comment associated with attachment |
fileName |
string |
Attachment filename |
stream |
string |
Base64 encoded file stream |