Forum Discussion

jtheuer's avatar
jtheuer
Occasional Contributor
16 years ago

iterate over elements in REST response, call another TestStep

Hi, can I iterate over elements of a response? I want to retrieve a list of people and the call a DELETE method on all of them: Here is the response:

<Response>
  <e>
      <id>416</id>
      <name>Hans</name>
  </e>
  <e>
      <id>417</id>
      <name>John</name>
  </e>
</Response>


I started with the post from my earlier post, so this is roughly what I want to do and what is still missing.


def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );

// response holder
def holder = groovyUtils.getXmlHolder( "getAllTours#ResponseAsXml" );
def items = //TODO: list of <e> nodes
for(def item: items) {
    //TODO: call TestStep "delete" with parameter id= Response/e/id
}


Can someone give me hint how to do this?

Thanks,

Jan
No RepliesBe the first to reply