SoapUI Pro Project Solution Collection-XML assert
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/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的更多相关文章
- 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 ...
- 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 ...
- SoapUI Pro Project Solution Collection-access the soapui object
Technorati 标签: Soapui pro,web service,apI Testing
- SoapUI Pro Project Solution Collection-Test Step Object
Package com.eviware.soapui.model.testsuite used for access the current testsuite object, like test c ...
- 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 ...
- 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 ...
- SoapUI Pro 最新版本和最新功能
专为整个后端的端到端测试而构建 创建全面的端到端测试,以从API定义或实时端点验证API的整个工作流程.只需单击几下即可传递响应数据并添加断言-无需编码. 综合生成或配置数据 通过简单的数据驱动测试来 ...
- 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 ...
- 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 ...
随机推荐
- python 全栈开发,Day16(函数第一次考试)
考试题 Python11 期第二次考试(基础数据类型与函数部分) 考试时长:3个小时 满分:105分 一,选择题(每题2分,共24分) 1.python不支持的数据类型有 A.char B.int C ...
- websocket+Django+python+paramiko实现web页面执行命令并实时输出
一.概述 WebSocket WebSocket的工作流程:浏览器通过JavaScript向服务端发出建立WebSocket连接的请求,在WebSocket连接建立成功后,客户端和服务端就可以通过 T ...
- js在字符串中提取数字
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- javafx点击鼠标出现弹窗,demo
在学习javafx的过程中,不知道怎么出现一个弹窗,如,点击一个按钮出现一个修改信息的列表选项 终于在javafx文档示例中发现了类似的东西,记录一下,备忘package demo9_button; ...
- C#连接oracle连接字符串
/// <summary> /// Oracle 的数据库连接字符串. /// </summary> private const String connString = @&q ...
- 【Java】 剑指offer(36) 二叉搜索树与双向链表
本文参考自<剑指offer>一书,代码采用Java语言. 更多:<剑指Offer>Java实现合集 题目 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表.要求不 ...
- Linux学习之用户配置文件详解(十四)
Linux学习之用户配置文件详解 目录 用户信息文件/etc/password 影子文件/etc/shadow 组信息文件/etc/group 组密码文件/etc/gshadow 用户信息文件/etc ...
- EF连接字符串小问题记录
1.EFDbContext”不包含必需的 providerName 特性: <connectionStrings> <add name="EFDbContext" ...
- 用js来实现那些数据结构02(数组篇02-数组方法)
上一篇文章简单的介绍了一下js的类型,以及数组的增删方法.这一篇文章,我们一起来看看数组还有哪些用法,以及在实际工作中我们可以用这些方法来做些什么.由于其中有部分内容并不常用,所以我尽量缩小篇幅.在这 ...
- Playmaker全面实践教程之简单的使用Playmaker示例
Playmaker全面实践教程之简单的使用Playmaker示例 简单的使用Playmaker示例 通过本章前面部分的学习,相信读者已经对Playmaker有了一个整体的认识和印象了.在本章的最后,我 ...