karenSZ
8 years agoOccasional Contributor
Solved
Assert, that the Resulting Data matches with a list of given values
My resulting data of a soap ui testcase looks like this:
<Answer>
<Result>
<ID>
<name>4711-01-8000001- 091400</name>
</ID
.....
</Result>
<Result>
<ID>
<name>4812-01-8000002-092500</name>
</ID>
....
</Result>
......
What I need to do is to compare the numbers written in bold letters from the result with a given list( List 1) of numbers and make sure that in my result there are only entries which contain one af the numbers given in List 1 - and no others.
Can someone help me?
Try adding a script assertion with below code
def predefinedNameList = ['4711','4812'] // Replace with your own expected list of values def holder = new com.eviware.soapui.support.XmlHolder(messageExchange.responseContentAsXml) def names = holder.getNodeValues('//name') names.each{ name -> assert predefinedNameList.contains(name.split('-')[0]) == true }
Regards,
Gilu Gopi