Reputation: 21
Here's the scenario... I perform a GET to retrieve an XML. I want to extract a value from the XML to use in a subsequent test. For example, I do a GET to retrieve an Order XML. I then want to extract the text of the ProposalNumber element and assign it to a variable using LET so that I may use it later in the test. I downloaded a RestFixtureTest that does this exact scenario which works as expected and returns the text (using text()). But when I try it with the system under test, the response is empty. The only obvious difference I see is the Content-Type header. The RestFixtureTest uses text/xml where my test uses application/xml.
Upvotes: 2
Views: 629
Reputation: 31
According to your web service, the Content-Type has to be updated before launching the web service using RestFixture of FITNESSE
For example, if your web service uses application/xml Using SetHeaders and define Content-Type as application/xml
Then use let for parsing the XML response using below format,
|let |proposalnumber|body|//proposalnumber/text()|$proposalnumber=|
The value of proposalnumber tag will be stored in proposalnumber variable
Upvotes: 0