cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing the SOAP UI and database response values stored in arraylist and storing the result

Highlighted
New Contributor

Comparing the SOAP UI and database response values stored in arraylist and storing the result

File fr = new File("C:\\ViewBANTestData.xls")
Workbook wk = Workbook.getWorkbook(fr);
WritableWorkbook workbook1 = Workbook.createWorkbook(fr,wk)
WritableSheet sheet= workbook1.getSheet("Sheet1");

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "SOAP Request#Response" )
def GPSRequest = context.expand('${SOAP Request#Request}')
def GPSResponse = context.expand('${SOAP Request#Response}')
def slurper1 = new XmlSlurper()

def DBholder = groovyUtils.getXmlHolder( "JDBC Request#ResponseAsXml" )

def xmlUtil = new com.eviware.soapui.support.xml.XmlUtils();
def nodes = holder.getDomNodes( "//*" );
def DBnodes = DBholder.getDomNodes( "//*" );


def list = []
def XMLlist = []
def DBXMLlist = []
for( node in nodes )
{
if(!(node.getNodeName().toString().contains("m:serviceCodeEnglishDescription") || node.getNodeName().contains("m:serviceCodeFrenchDescription") || node.getNodeName().contains("m:transpromoStatus")) )
{
def value = com.eviware.soapui.support.xml.XmlUtils.getNodeValue( node )
if((value!=null))
{
if( !(value.isAllWhitespace()))
XMLlist.add(value)
}
}
}
def Slist = XMLlist.size()

log.info "SOAP UI RESPONSE" + XMLlist

for( node in DBnodes )
{
def DBvalue = com.eviware.soapui.support.xml.XmlUtils.getNodeValue( node )
if((DBvalue!=null))
{
if(!(DBvalue.isAllWhitespace()))
{
DBXMLlist.add(DBvalue.trim())
}
}
}
log.info "DB RESPONSE =" + DBXMLlist
def DBSlist=DBXMLlist.size()

 

I have above code in that  my SOAP UI Response is getting stored in XMLlist

"SOAP UI RESPONSE" + XMLlist

and my Database response is stored in DBXMLlist 

DB RESPONSE =" + DBXMLlist

like below

SOAP UI RESPONSE[5275495390, 1219 CHRISTIE CIR, MILTON, ON, Sterling Insurance Brokers, L9T6V4, 527749, NM1, B, Y, NM1IPBB]
DB RESPONSE =[5275495390, 1219 CHRISTIE CIR, MILTON, ON, Sterling Insurance Brokers, L9T6V4, 527749, NM1, B, Y, NM1IPBB]

 

So till here my script is working fine

but after this i want to compare each value of SOAP UI Response and Database Response for multiple iterations and store the result for each iteration in Excel.

1 REPLY 1
Highlighted
New Contributor

Can someone please help me on this?
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors