码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-07-14 13:14:21      阅读:313      评论:0      收藏:0      [点我收藏+]

标签:

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

  

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

标签:

原文地址:http://www.cnblogs.com/MasterMonkInTemple/p/4644950.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!