[SoapUI] context.expand 和 groovyUtils.getXmlHolder 有什么不一样

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

[SoapUI] context.expand 和 groovyUtils.getXmlHolder 有什么不一样的相关文章

[SoapUI] 在某个测试步骤下面增加Script Assertion,运用 messageExchange 获取response content

import com.eviware.soapui.support.GroovyUtils import com.eviware.soapui.support.XmlHolder import org.w3c.dom.Node import org.apache.commons.lang.StringUtils def groovyUtils = new GroovyUtils(context) def xmlHolder =groovyUtils.getXmlHolder(messageExc

[SoapUI] 比较TP和Live环境下的XML Response,将代码按照功能进行拆分,根据代码所在目录自动获取Mapping文件所在路径,自动获取测试步骤名称

import org.custommonkey.xmlunit.* import org.custommonkey.xmlunit.examples.* import javax.xml.xpath.* import javax.xml.parsers.* import static java.lang.Math.* import com.eviware.soapui.support.GroovyUtils // The parameter allowableDeviation means th

[SoapUI] 比较两个不同环境下的XML Response, 从外部文件读取允许的偏差值,输出结果到Excel

import static java.lang.Math.* import java.text.NumberFormat import com.eviware.soapui.support.GroovyUtils import com.eviware.soapui.support.XmlHolder import org.apache.poi.ss.usermodel.Cell import org.apache.poi.ss.usermodel.Row import org.apache.po

[SoapUI] Read data from response , use it to update parameter

import com.eviware.soapui.support.GroovyUtils def groovyUtils = new GroovyUtils( context ) def holder =groovyUtils.getXmlHolder( "NormalUserLogin#Response" ) def ProductCode = holder.getNodeValue("//authen[1]/impsn[1]/pcode[1]/text()")

[SoapUI]怎样从应答报文中获取某个字段的值,然后用其改写某个变量

import com.eviware.soapui.support.GroovyUtils def groovyUtils = new GroovyUtils( context ) def holder = groovyUtils.getXmlHolder( "NormalUserLoginHealthTest#Response" ) def ProductID = holder.getNodeValue("//authen[1]/impsn[1]/pid[1]/text()

[Groovy]获取当前活动的Environment,获取response中节点的name和节点的value

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 import com.eviware.soapui.support.GroovyUtils import com.eviware.soapui.support.XmlHolder i

[Token] 从index.jsp中获取Token

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()") log.i

[SoapUI] 在SoapUI script里获取Response(Json格式)某个节点值

import com.eviware.soapui.support.GroovyUtils import com.eviware.soapui.support.JsonUtil import com.jayway.jsonpath.* import com.eviware.soapui.support.XmlHolder String responseAPI = context.expand('${GetFundSizeValueScoreFromAPI#Response}') //get re

[SoapUI] 在SoapUI Rest请求Assertion里获取Response(xml格式)某个节点值

import com.eviware.soapui.support.GroovyUtils import com.eviware.soapui.support.JsonUtil import com.jayway.jsonpath.* import java.lang.String def response = context.expand('${ResponseAsXml}') //Get Response def xmlParser = new XmlParser().parseText(r