Forum Discussion

toks122's avatar
toks122
New Contributor
13 years ago

Newbie - Urgent Help

i am using the free version of soapUI

I copied xml(By creating REST test request) for a request and sent it to a service which i got the below response back:
Response Message looks like this:

<Messages xmlns:fo="http://www.w3.org/1999/XSL/Format">
<Message>
<Type>randomdata</Type>
<SubType>Unknown</SubType>
<Qualifier>randomdata</Qualifier>
<Text>randomdata</Text>
<ID1>randomdata</ID1>
</Message>
<Message>
<Type>randomdata</Type>
<SubType>Unknown</SubType>
<Qualifier>randomdata capsules</Qualifier>
<Text>Breast randomdata</Text>
<ID1>randomdata</ID1>
</Message>

The only assertion i was able to do was to count the number of <Method> node returned in the response i.e. count(//Method)

Now, i am trying to use Groovy script to run a request and assert the response i got back but i am having issues and i am not sure where to start from.

i dont have any previous knowlegde on Groovy. i am just going by what i saw online. below are the code i wrote:

import com.eviware.soapui.support.XmlHolder

def holder = new XmlHolder(messageExchange.responseContentAsXml);
def node = holder.getNodeValue("//Message[1]");
log.info(node);

How can i do more assertion on the response please? e.g. check the text within the nodes of 50(more sometimes depending on the response) possible <Method> node returned in the response?

Also, what further check can i do on the response.

Looking forward to you guys helping me out
No RepliesBe the first to reply