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 全栈开发,Day12(函数的有用信息,带参数的装饰器,多个装饰器装饰一个函数)
函数的执行时,*打散.函数的定义时,*聚合. from functools import wraps def wrapper(f): # f = func1 @wraps(f) def inner(* ...
- 遍历DOM树
遍历DOM在jQuery中是非常重要的技术. 遍历DOM之前,需要对DOM有清晰的认识,了解文档节点.元素节点.属性节点.文本节点等相关概念.不清楚可以温习下<JavaScript教程.DOM树 ...
- 开始写博客,学习Linq(2)
linq的功能是什么? 它将极大地改变应用程序或组件处理数据的方式.这是第一个功能. LINQ to Objects.LINQ to SQL和LINQ to XML,是LINQ三大主要功能,当然LIN ...
- POJ 2229 Sumsets【DP】
题意:把n拆分为2的幂相加的形式,问有多少种拆分方法. 分析:dp,任何dp一定要注意各个状态来源不能有重复情况.根据奇偶分两种情况,如果n是奇数则与n-1的情况相同.如果n是偶数则还可以分为两种情况 ...
- Spring3.X jdk8 java.lang.IllegalArgumentException
异常提示: javax.servlet.ServletException: Servlet.init() for servlet springMVC threw exception org.apach ...
- HDU Tody HDU2112
不想用floyd了 也不一定适合 floyd只能处理小数据 dijkstra算法 wa了很久 一个是dijkstra里面的u 导致RE了无数次 下标溢出 还有就是注意细节 当起点和终点 ...
- 【Java】 剑指offer(55-2) 平衡二叉树
本文参考自<剑指offer>一书,代码采用Java语言. 更多:<剑指Offer>Java实现合集 题目 输入一棵二叉树的根结点,判断该树是不是平衡二叉树.如果某二叉树 ...
- 利用IntelliJ IDEA 创建第一个项目
1.创建项目 打开后点击第一个按钮
- POJ 3414 Pot (输出路径)【BFS】
<题目链接> 题目大意: 有两个容量的空杯子,能够对这两个空杯子进行三种操作: 分别是fill(a),装满a杯子: drop(a),倒空a杯子: pour(a,b),将a杯子中的水倒入b杯 ...
- MySQL 5.7.14 net start mysql 服务无法启动
解决方法: 1.mysqld --initialize 初始化data目录 2.重新输入net start mysql命令 补充,服务停止的方法:net stop mysql