context.expand 和 groovyUtils.getXmlHolder 有什么不一样?互相之间怎么转换
import com.eviware.soapui.support.GroovyUtils def groovyUtils = new GroovyUtils( context ) def responseLive=context.expand( ‘${Intraday Table_Live#Response}‘ ) def xmlHolderLive = groovyUtils.getXmlHolder(responseLive) def xmlLive = xmlHolderLive.getXml() log.info "responseLive : "+responseLive log.info xmlHolderLive log.info "xmlLive : "+xmlLive
截图:
通过groovyUtils.getXmlHolder也可以直接获取response, 还可以通过XPath获取节点的值
import com.eviware.soapui.support.GroovyUtils def groovyUtils = new GroovyUtils( context ) def holder = groovyUtils.getXmlHolder( "Get Token#Response" ) String tokenTemp = holder.getNodeValue("//html[1]/body[1]/script[1]/text()")
时间: 2024-10-31 17:07:16