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. 2018-2019-2 网络对抗技术 20165333 Exp2 后门原理与实践

    实验内容 1.使用netcat获取主机操作Shell,cron启动 2.使用socat获取主机操作Shell, 任务计划启动 3.使用MSF meterpreter(或其他软件)生成可执行文件,利用n ...

  2. 深度优先搜索(DFS)和广度优先搜索(BFS)

    深度优先搜索(DFS) 广度优先搜索(BFS) 1.介绍 广度优先搜索(BFS)是图的另一种遍历方式,与DFS相对,是以广度优先进行搜索.简言之就是先访问图的顶点,然后广度优先访问其邻接点,然后再依次 ...

  3. 怎么用pr(Premiere)给视频添加水印

    自己辛辛苦苦剪切的视频,不添加水印,别人肯定会搬走的,作为对视频付出时间的你肯定不想看见这样的事情,下面一起来看看怎么用pr给视频添加水印吧   工具/原料   水印 pr 方法/步骤     首先打 ...

  4. hdu 4463 有一条边必须加上 (2012杭州区域赛K题)

    耐克店 和 苹果店必须相连 Sample Input42 30 01 00 -1 1 -10 Sample Output3.41 # include <iostream> # includ ...

  5. AOJ 0525 Osenbei【穷竭搜索】

    AOJ 0525 题意: 有一个烤饼器可以烤r行c列的煎饼,煎饼可以正面朝上(用1表示)也可以背面朝上(用0表示).一次可将同一行或同一列的煎饼全部翻转.现在需要把尽可能多的煎饼翻成正面朝上,问最多能 ...

  6. java集合进行排序的两种方式

    java集合的工具类Collections中提供了两种排序的方法,分别是: Collections.sort(List list) Collections.sort(List list,Compara ...

  7. poj 3415

    对拍没错..莫名wa了 利用容斥求每个串的重复子串 其实就是找到每个元素能扩展到的最大元素 即(rr-i)*(i-lr)*(w[i]-kk) 就可以了 然后处理这个先离散化再搞 另外是x y要清空 # ...

  8. Python 2维数组90度旋转

    一.二维列表 a = [[col for col in range(4)] for row in range(4)] [[0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3] ...

  9. Kettle学习之Spoon简单使用

    kettle学习之Spoon使用 2018-08-04 10:40:01 首先介绍两个博客入门: https://blog.csdn.net/zzq900503/article/details/785 ...

  10. 【Java】 剑指offer(46) 把数字翻译成字符串

    本文参考自<剑指offer>一书,代码采用Java语言. 更多:<剑指Offer>Java实现合集   题目 给定一个数字,我们按照如下规则把它翻译为字符串:0翻译成" ...