Attachments - Create Test Run Attachment
Attach a file to a test run.
POST https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/attachments?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 |
run
|
path | True |
integer (int32) |
ID of the test run against which attachment has to be uploaded. |
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. |
Request Body
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 |
Responses
Name | Type | Description |
---|---|---|
200 OK |
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/_apis/test/Runs/49/attachments?api-version=7.1
{
"stream": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABlSURBVDhP7cxBCsAgDERR739pG/CnGJI0FopQ8O2cjNP6R85QbeNQU7wT1dkijaQ3vkZoWElaoTeJojW01cYh0jwfgiFBV/lEjOZtacijN/nLkOBHhIaVDgn+Wdycp6FXzlCl9wt0Y0cAzHo/zgAAAABJRU5ErkJggg==",
"fileName": "imageAsFileAttachment.png",
"comment": "Test attachment upload",
"attachmentType": "GeneralAttachment"
}
Sample response
{
"id": 3,
"url": "https://dev.azure.com/fabrikam/Fabrikam/_apis/test/Runs/49/Attachments/3"
}
Definitions
Name | Description |
---|---|
Test |
Reference to test attachment. |
Test |
Test attachment request model |
TestAttachmentReference
Reference to test attachment.
Name | Type | Description |
---|---|---|
id |
integer (int32) |
ID of the attachment. |
url |
string |
Url to download the attachment. |
TestAttachmentRequestModel
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 |