vendredi 29 juin 2018

Restito and RestAssured - compare REQUEST body to xml file

I have a file request.xml and an application that is sending request to another API. I would like to compare the XML that is generated to request.xml to make sure the request body is correct.

So far I have mocked API:

server = new StubServer(7071).run();
RestAssured.port = server.getPort();

whenHttp(server).match(post("/endpoint"), withPostBodyContaining("100"))
                .then(ok(), resourceContent("response.xml"), contentType("text/xml"));

This rule just sends a response depending on request body containing 100 but I would like to actually compare request body to request.xml file.

What is the best way to do this using RestAssured or not using RestAssured? Thank you.

Aucun commentaire:

Enregistrer un commentaire