In this video, We are going to learn How to upload a file in rest assured and download file in rest assured.
Rest Assured upload file is easy and can be achieved with the multipart inbuilt methods.
β
Quick Code -
.multiPart("file", new File(TestUtil.getFileURI("/examples/help.html")), "text/html")
https://stackoverflow.com/questions/39482473/how-to-use-rest-assured-to-upload-a-file
We will assume that a post method "https://the-internet.herokuapp.com/upload" uploads an image for a user. Lets take a look at the below example on how to upload the image file using POST call.
We will use the function that takes 3 parameters.
- The key that identifies the file.
- File object.
- Content type.
We Use POST request to perform this operation.
β Source Code.
β
What is REST Assured?
REST Assured is a Java library that provides a domain-specific language (DSL) for writing powerful, maintainable tests for RESTful APIs. ... I'll be using real-world code examples you can copy, run, and reuse directly in your own test automation effort
π Test Automation -
https://bit.ly/learnautomation2020
π API Testing -
https://www.learnapitesting.com
π Cypress Tutorial with LIVE Projects -
https://cypresstutorial.com
π REST API testing with Python -
https://masterapitesting.com
Top comments (0)