Forum Discussion

karenSZ's avatar
karenSZ
Occasional Contributor
8 years ago
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>       ...
  • gilugopi's avatar
    8 years ago

     

    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