prouser
12 years agoContributor
Access JDBC test step response in Groovy test step
Hi All
I am trying the count the records retrieved from the JDBC test step in a groovy test step
I am facing difficulty in coming up with xpath for the xml response
Here is the sample response in my JDBC test step
<Results>
<ResultSet fetchSize="64">
<Row rowNumber="1">
<TBC_ID>29379155</TBC_ID>
<TBC_DATE>2013-01-31</TBC_DATE>
</Row>
<Row rowNumber="2">
<TBC_ID>29379576</TBC_ID>
<TBC_DATE>2013-01-31</TBC_DATE>
</Row>
Here is my Groovy script to access this JDBC response
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def db_response = context.expand( '${JDBC Request#Response#//Results/ResultSet}' )
log.info db_response
def resxml = new XmlSlurper().parseText(db_response)
allnodes = resxml.Row
log.info "Nodes Size: "+allnodes.size()
This is not printing desired output(JDBC response xml in this case) and throwing an error "Premature end of file" at the following step
def resxml = new XmlSlurper().parseText(db_response)
I am trying the count the records retrieved from the JDBC test step in a groovy test step
I am facing difficulty in coming up with xpath for the xml response
Here is the sample response in my JDBC test step
<Results>
<ResultSet fetchSize="64">
<Row rowNumber="1">
<TBC_ID>29379155</TBC_ID>
<TBC_DATE>2013-01-31</TBC_DATE>
</Row>
<Row rowNumber="2">
<TBC_ID>29379576</TBC_ID>
<TBC_DATE>2013-01-31</TBC_DATE>
</Row>
Here is my Groovy script to access this JDBC response
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def db_response = context.expand( '${JDBC Request#Response#//Results/ResultSet}' )
log.info db_response
def resxml = new XmlSlurper().parseText(db_response)
allnodes = resxml.Row
log.info "Nodes Size: "+allnodes.size()
This is not printing desired output(JDBC response xml in this case) and throwing an error "Premature end of file" at the following step
def resxml = new XmlSlurper().parseText(db_response)