Setting parameter in REST post xml mesage and checking result
Another noob question...
We have a REST xml service that uses Post. It only has one value in the request, lets call it CustomerReference and returns a few details, such as name and if they are active
<GetCustRef ns: xxxx>
<message header ns: xxxx>
some stuff
</message header>
<request>
CustomerReference
</request>
</GetCustRef>
What I need to do is set the CustomerReference as a parameter in the post message and then check some of the results. I've already found a script that will allow me to loop through different references but nothing that can help with settign the parameter and checking the results.
Hi,
Assuming you set your customerReference as a property somewhere convenient, propbably on the context variable e.g. context["customerReference"]="12345 (you could set this in a Groovy TestStep preceeding your request for example)
Then its as easy as inserting a property expansion into the request body e.g.
<GetCustRef ns: xxxx>
<message header ns: xxxx>
some stuff
</message header>
<request>
${customerReference}
</request>
</GetCustRef>
In terms of checking the results do you need any help with Assertions e.g. content, XPath or Script Assertions are obvious candidates to check XML response values? Note - you could also use property expansions in the Assertions if you have values that you wish to check for that are in properties...
Let me know if this fixes you up or you need any more help.
Cheers,
Rup