lundi 16 décembre 2019

How to get each response data in a separate list using groovy script in SoapUI?

I'm running the test step using groovy script which passes a DocID dynamically to the respective request XML tag and collect some address info (i.e. addrline, city, state, zipcode, country) from the response. The flow is running perfectly with the below Script Assertion.

import groovy.lang.*;
import com.eviware.soapui.model.testsuite.*;

def groovyutils = new com.eviware.soapui.support.GroovyUtils(context);
def responseHolder = groovyUtils.getXmlHolder(messageExchange.responseContent)

def addrLine = responseHolder.getNodeValue("//*:address/*:line")
def city = responseHolder.getNodeValue("//*:address/*:city")
def state = responseHolder.getNodeValue("//*:address/*:state")
def zipcode = responseHolder.getNodeValue("//*:address/*:postalCode")
def country = responseHolder.getNodeValue("//*:address/*:country")

//Then assigning these values to the Custom Properties for further process
messageExchange.modelItem.testStep.testCase.testSuite.project.setPropertyValue("ADDR_LINE",addrLine)
[similarly storing other fields]

But, my requirement is changed to pass 100 DocIDs and collect those addresses in a separate list.

How can I do this? Can anyone guide me on this?

Thanks
Karunagara Pandi G

Aucun commentaire:

Enregistrer un commentaire