robotframework / OldSeleniumLibrary

Deprecated Selenium library for Robot Framework
Apache License 2.0
13 stars 3 forks source link

Facing issue while verifying upload API in robot framework using python #275

Open SuperSonic-creator opened 4 years ago

SuperSonic-creator commented 4 years ago

I am very new to testing / developing. I am currently testing a REST API. In Postman I send a POST request by specifying parameters and uploading a file using form-data in the body. My request always succeeds. However, when I try to translate this into Robot Framework (using the Requests Library), I I am posting my code below. I have been trying to resolve this issue for a while now. Any help in the right direction would be much appreciated!

Create Session alias ${uri} ${file_name}= Get Binary File Test.png ${headers}= Create Dictionary Accept=plain/text Content-Type=multipart/form-data ${data}= create dictionary asset=${file_name} ${resp}= post request alias /api/insertFile data=${file_name} headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 log to console ${resp.content} log to console ${resp.headers}

It is giving me 200 always in server log also expected response is true but getting false every time. Although the same API is working perfectly in the Postman tool.

Attached server log

ServerLog