Forum Discussion
Dheepha
13 years agoContributor
I have read from some other post and updated my groovy script with the namespace and it got worked.
My final Groovy script to fetch the value from tag and verify the format of date:
import com.eviware.soapui.support.GroovyUtils;
import org.joda.time.DateTime
import org.joda.time.format.ISODateTimeFormat
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def response = context.expand( '${Request#Response}' )
def holderResponse = groovyUtils.getXmlHolder( response )
holderResponse.namespaces["ns"] = "http://www.ifxforum.org/IFX_150"
def dateString = holderResponse.getNodeValue(["//ns:ServerDt"])
log.info (dateString);
try {
ISODateTimeFormat.dateTimeParser().parseDateTime(dateString)
} catch (java.lang.IllegalArgumentException iae) {
assert false
log.info("invalid date");
}
assert true
Thanks.
My final Groovy script to fetch the value from tag and verify the format of date:
import com.eviware.soapui.support.GroovyUtils;
import org.joda.time.DateTime
import org.joda.time.format.ISODateTimeFormat
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def response = context.expand( '${Request#Response}' )
def holderResponse = groovyUtils.getXmlHolder( response )
holderResponse.namespaces["ns"] = "http://www.ifxforum.org/IFX_150"
def dateString = holderResponse.getNodeValue(["//ns:ServerDt"])
log.info (dateString);
try {
ISODateTimeFormat.dateTimeParser().parseDateTime(dateString)
} catch (java.lang.IllegalArgumentException iae) {
assert false
log.info("invalid date");
}
assert true
Thanks.