您的位置:首页 > 产品设计 > UI/UE

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

2015-07-14 11:18 531 查看
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(messageExchange.getResponseContent())

String xPath = "//clients/client"
Node[] nodeArray = xmlHolder.getDomNodes(xPath)
int actualCount = nodeArray.length
int expectedCount = context.expand('${#Project#ClientCount}').toInteger()
log.info "Actual : nodeArray.length of  "+xPath+" : "+actualCount
log.info "Expected : nodeArray.length  is : "+expectedCount
assert actualCount==expectedCount


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: