in soapui the XML object used here is from  org.w3c.dom package

so you need to read this article carefully before we can use xml object very well.

http://www.w3schools.com/dom/

http://www.w3schools.com/dom/dom_nodetype.asp

Node Types - Return Values
The following table lists what the nodeName and the nodeValue properties will return for each node type: Node Type nodeName returns nodeValue returns
Document #document null
DocumentFragment #document fragment null
DocumentType doctype name null
EntityReference entity reference name null
Element element name null
Attr attribute name attribute value
ProcessingInstruction target content of node
Comment #comment comment text
Text #text content of node
CDATASection #cdata-section content of node
Entity entity name null
Notation notation name null
NodeType    Named Constant
1 ELEMENT_NODE
2 ATTRIBUTE_NODE
3 TEXT_NODE
4 CDATA_SECTION_NODE
5 ENTITY_REFERENCE_NODE
6 ENTITY_NODE
7 PROCESSING_INSTRUCTION_NODE
8 COMMENT_NODE
9 DOCUMENT_NODE
10 DOCUMENT_TYPE_NODE
11 DOCUMENT_FRAGMENT_NODE
12 NOTATION_NODE

from the soapui you can assert your response xml from the below way:

the default provide script as below:

import com.eviware.soapui.support.XmlHolder

def holder = new XmlHolder( messageExchange.responseContentAsXml )
holder.namespaces["ns1"] = "http://ws.cdyne.com/WeatherWS/"
def node = holder.getDomNode( "//ns1:GetCityForecastByZIPResponse[1]" ) assert node != null

in the instance ,it provide these objects we can use:

XmlHolder holder=new XmlHolder("");

        Node[] nodes=holder.getDomNodes("xpath");

        for(int k=0;k<nodes.length;k++){
NodeList nodelist=nodes[k].getChildNodes();
for(int j=0;j<nodelist.getLength();j++){ Node node=nodelist.item(j);
Log.info("node type :"+node.getNodeType());
Short type=node.getNodeType();
if(type==Node.ELEMENT_NODE){
String nodename=node.getNodeName();
int csize=node.getChildNodes().getLength();
String nodevalue=null;
if(csize>0){
nodevalue=node.getFirstChild().getNodeValue();
}
} }
}

use the above groovy script to assert the response xml content as you want .hope this save your time .

SoapUI Pro Project Solution Collection-XML assert的更多相关文章

  1. SoapUI Pro Project Solution Collection –Easy develop Groovy Script to improve SoapUI ability

    As you know the groovy script and java script language is the soapui supported .but unfortunately So ...

  2. SoapUI Pro Project Solution Collection-Custom project and setup

    import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import com.eviware.soap ...

  3. SoapUI Pro Project Solution Collection-access the soapui object

    Technorati 标签: Soapui pro,web service,apI Testing

  4. SoapUI Pro Project Solution Collection-Test Step Object

    Package com.eviware.soapui.model.testsuite used for access the current testsuite object, like test c ...

  5. SoapUI Pro Project Solution Collection-DataSource(jdbc,excel)

    here give a solution for excel file change the excel configuration these: Set Excel file path in cur ...

  6. SoapUI Pro Project Solution Collection-change the JDBC Request behavior

    change the jdbc request : 1.change the driver name,connection string,query string or assert. the obj ...

  7. SoapUI Pro 最新版本和最新功能

    专为整个后端的端到端测试而构建 创建全面的端到端测试,以从API定义或实时端点验证API的整个工作流程.只需单击几下即可传递响应数据并添加断言-无需编码. 综合生成或配置数据 通过简单的数据驱动测试来 ...

  8. soapUI pro :INFO:Error getting response for []; javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

    need to configure two for the https address: Step 1 export the certificate from the IE settings opti ...

  9. idea报错。Error:Failed to load project configuration: cannot parse xml file E:\project\.idea\workspace.xml: Error on line 1: 前言中不允许有内容。

    因为电脑卡死强制重启电脑后打开idea,进行junit单元测试报错: idea报错.Error:Failed to load project configuration: cannot parse x ...

随机推荐

  1. java根据word模板导出word文件

    1.word模板文件处理,如下图所示在word 文档中填值的地方写入占位变量 2.将word文档另存为xml文件.编辑如下图,找到填写的占位,修改为${bcrxm}格式 3.将文件后缀名改为.ftl文 ...

  2. icomet研究

    官方文档https://github.com/ideawu/icomet/wiki 如何实现的长连接:noop: 心跳消息+HTTP endless chunk 以班级ID为主键,进行班级通道的创建: ...

  3. python爬取京东价格

    昨天准备爬取一个京东商品的价格,正则写好了一直是空的 后来我去页面里面看了下,价格标签里果然是空的 百度了下,大家都说是js来控制显示价格的 于是去抓包试试,找到了一条mgets的请求 中间很多参数不 ...

  4. 【Java】 剑指offer(20) 表示数值的字符串

    本文参考自<剑指offer>一书,代码采用Java语言. 更多:<剑指Offer>Java实现合集   题目 请实现一个函数用来判断字符串是否表示数值(包括整数和小数).例如, ...

  5. 091实战 Nginx配置(日志服务器中关于日志的产生)

    一:概括 1.需要配置的概括 定义日志格式 日志的分割字段:^A 日志格式:IP地址^A服务器时间^A请求参数 配置location,记录请求日志到本地磁盘 将数据按照给定的日志格式存储到本地磁盘 二 ...

  6. python魔法方法-属性转换和类的表示

    类型转换魔法 类型转换魔法其实就是实现了str.int等工厂函数的结果,通常这些函数还有类型转换的功能,下面是一些相关的魔法方法: __int__(self) 转换成整型,对应int函数. __lon ...

  7. 关于Oracle游标out参数多层调用的BUG,ORA-06504

    数据库版本 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit 测试代码 declare p_cur sys_refcu ...

  8. C#基础_循环

    1,三元运算符 表达式1?表达式2:表达式3 栗子1:bool result=5>3?true:false; 栗子2: int num=5>3?1:0; 注意事项以及相应规则: 2, 3, ...

  9. Filebeat 快速开始

    Filebeat可以做什么 条目 filebeat 编写语言 GO 是否支持多输出 支持 是否支持多输入 支持 是否支持修改日志内容 支持 是否会丢数据 不会 对多行文件的合并 支持 对多层目录的模糊 ...

  10. 预编译头文件来自编译器的早期版本,或者预编译头为 C++ 而在 C 中使用它(或相反)(转)

    用VC++ 2008 编写C语言程序,编译出现错误: 预编译头文件来自编译器的早期版本,或者预编译头为 C++ 而在 C 中使用它(或相反) 解决方法: 建工程时 建立空项目 或者在项目设置里关闭预编 ...