We had a little discussion on SoapUI test cases and one question was could we extract an url from the response and use load the content from the page it is pointing to. This was important as we were testing a RESTful framework. Task is trivial when using a programming/scripting language (I was planning to develop the test framework using Perl and it would have been just couple of lines) but could not think of a reliable way of doing it in soapUI. The biggest problem was when a test step is defined as a REST request, you can't arbitrarily change the endpoint (You can, but found sometimes it does not actually use the updated link).
The trick is to have a test step as a HTTP request instead of REST. Then the endpoint is kind of free form. In a property transfer step, XQuery nicely extracted the url and set as the endpoint of HTTP request. Bingo! it's done!
This is how I did it. Say you have the following XML content in a response and wanted to create a request for the url in tag <myweb>
<Everybody>
<me>
<myweb>http://www.myweb.local</myweb>
<...>... </...>
<...>... </...>
</me>
<...>
<...>
</Everybody>
I used a property transfer with following settings. Note that you have to declare the namespaces if exist in the response.
No comments:
Post a Comment