Forum Discussion
CXin
13 years agoFrequent Contributor
Hi RJanecek,
I tried to add the script below in Script Assertion, but seems like i cant get each date value via the loop. And can get the could of date-time.
I have 3 ads so with 3 different creation-date-time.
-
import com.eviware.soapui.support.XmlHolder
def date = []
def holder = new XmlHolder( messageExchange.responseContentAsXml )
holder.namespaces["ad"] = myNameSpace
int datecount = Integer.parseInt (holder.getNodeValue( "count(//ad:ads/ad:ad/ad:creation-date-time)") )
for(int i = 0; i < datecount; i++){
date.add( holder.getNodeValue( "//ad:ads/ad:ad/ad:creation-date-time") )
}
-
And below is the assertion I added for date-time content
//ad:ads[1]/ad:ad[3]/ad:creation-date-time[1]/text()
So am wondering if I need to add an index in that loop, like this date.add( holder.getNodeValue( "//ad:ads[1]/ad:ad/ad:creation-date-time[1]/text()") )
??
Thanks,
Sophie
I tried to add the script below in Script Assertion, but seems like i cant get each date value via the loop. And can get the could of date-time.
I have 3 ads so with 3 different creation-date-time.
-
import com.eviware.soapui.support.XmlHolder
def date = []
def holder = new XmlHolder( messageExchange.responseContentAsXml )
holder.namespaces["ad"] = myNameSpace
int datecount = Integer.parseInt (holder.getNodeValue( "count(//ad:ads/ad:ad/ad:creation-date-time)") )
for(int i = 0; i < datecount; i++){
date.add( holder.getNodeValue( "//ad:ads/ad:ad/ad:creation-date-time") )
}
-
And below is the assertion I added for date-time content
//ad:ads[1]/ad:ad[3]/ad:creation-date-time[1]/text()
So am wondering if I need to add an index in that loop, like this date.add( holder.getNodeValue( "//ad:ads[1]/ad:ad/ad:creation-date-time[1]/text()") )
??
Thanks,
Sophie