How to handle file upload in completed API testing?

How to handle file upload in completed API testing?

like you need to use post (/ url) and then upload the file by a specific parameter.?

+3
source share
3 answers

Hope this helps, works great for me

given().
        multiPart(KEY, new File(testfile)).
            formParam(KEY, testfile).
                contentType("multipart/form-data").
    expect().
        body("user.name", equalTo(someuserdata)).
            when().
                post(yourapihere);
+4
source

You can send Multipart data. For the Detention, its documented here: http://code.google.com/p/rest-assured/wiki/Usage#Multi-part_form_data

+1
source

All Articles