Subscribe Join 180,000+ subscribers and receive articles from our blog about software quality, testing, QA and security. Subscribe

Adding Attachments to a Test Result via the Web API

I’m trying to attach log files to tests that fail. I am able to create the result via Invoke-RestMethod using -Method “Post” (powershell call), but when I try to use the same way to attach the log file, I get the error: “No file attached or upload size was exceeded.”

For adding a result via add_result/<test_id>, I use the following body:
{
“status_id”: “5”,
“comment”: “The test has failed”,
“assignedto_id”: “User”
}

For adding an attachment via add_attachment_to_result/<result_id>, I’m using the following body:
{
“attachment”: “C:/TestFolder/TestOutput.txt”
}

Is there something I am missing? Thanks!

Not sure if it is the problem but on Windows the path is generally a backslash () and not a front slash (/)

I’ve tried that unfortunately, and it doesn’t seem to make a difference with either forward or back slash.