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. 通过生成支付二维码来实现微信支付的解决方案 - EasyWechat版(转)

    上一篇我们讲了在微信浏览器内实现微信支付的功能,它特别适合于一些基于微信公众号的h5站点等,支付流程也相当流畅,但是... 还有一种情况,比如现在北哥兄弟连PC版,是生成了一个二维码,这个二维码是专属 ...

  2. 使用asp.net 2.0中的SqlBulkCopy类批量复制数据

    介绍:在软件开发中,把数据从一个地方复制到另一个地方是一个普遍的应用. 在很多不同的场合都会执行这个操作,包括旧系统到新系统的移植,从不同的数据库备份数据和收集数据. ASP.NET 2.0有一个Sq ...

  3. C语言 提取double的每一位

    #include<stdio.h> int main() { double x = 256.141592654; ; //整数部分 while(n) //整数部分输出 { ; n /= ; ...

  4. POJ 2337 Catenyms(有向欧拉图:输出欧拉路径)

    题目链接>>>>>> 题目大意: 给出一些字符串,问能否将这些字符串  按照 词语接龙,首尾相接  的规则 使得每个字符串出现一次 如果可以 按字典序输出这个字符串 ...

  5. Python - 经典程序示例

    列表排序 def que6(): # 6.输入三个整数x, y, z,形成一个列表,请把这n个数由小到大输出. # 程序分析:列表有sort方法,所以把他们组成列表即可. li = np.random ...

  6. 不一样的go语言-不同的语法之type

    前言   在go语言中,type用于类型定义(type definition)与类型别名(type alias).这两者的差别从名字上已经可以初见端倪.   类型定义即定义新类型,是一个全新的类型,但 ...

  7. IdentityServer4-从数据库获取User进行授权验证(五)

    本节将在第四节基础上介绍如何实现IdentityServer4从数据库获取User进行验证,并对Claim进行权限设置. 一.新建Web API资源服务,命名为ResourceAPI (1)新建API ...

  8. Java 复习

    基础: JAVA基础扎实,理解io.多线程.集合等基础框架,对JVM原理有一定的了解: 熟读Java SDK源码: 框架: 对Spring,ibatis,struts等开源框架熟悉:

  9. php插入上万条mysql数据最快的方法

    1.使用thinkphp框架 先生成包含所有数据的数组,再使用 addAll() 方法,插入1万条数据仅需3秒钟. 2.PHP原始方法: 将SQL语句进行拼接,使用 insert into table ...

  10. [BZOJ2877][NOI2012]魔幻棋盘(二维线段树)

    https://blog.sengxian.com/solutions/bzoj-2877 注意二维线段树的upd()也是一个O(log n)的函数(pushdown()应该也是但没写过). #inc ...