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 ...
随机推荐
- PHP函数比较变量
作为一个PHPer,一定要多看PHP手册,每过一遍手册,你总会发现一些以前被你忽略的一些东西:我们可以从各个不同的地方/渠道学习到PHP的相关知识,但也不要忘记我们的手册,PHP手册永远是学习和提升P ...
- 笔记:FastAdmin 上传设置
笔记:FastAdmin 上传设置 FastAdmin 的上传设置为统一配置,在 application/extra/upload.php 中文件中. <?php //上传配置 return [ ...
- 优化 --cache
注意:配置成cache的地址段就不能再放入data and code,因为链接的时候,是不包含cache地址段的,如果想使用L1DSRAM或L1P SRAM,则应该相应减小cache段大小. 1:Ke ...
- postcss那些事儿
一.sass和postcsssass.less.stylus,三者是css预处理器,使用预编码来处理css,然后编译成线上需要的css.postcss是处理你写好的css,让你的css更健康,对浏览器 ...
- Python3 里面的线程池
from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor import time def task(i): print ...
- 利用django信号实现计数功能
本文主要知识点: 1.使用Django的signals来获取Model的新建/删除操作更新 2.使用数据库的select for update来正确处理并发的数据库操作 3.使用redis的sorte ...
- Python中应用SQL及SQLAlchemy(一)
以SQLit3为例: import sqlite3 conn = sqlite3.connect('db.sqlite3') #获取游标对象 cur = conn.cursor() #执行一系列SQL ...
- R1题解
估分 大佬们都去写题解了,我不写可能会被老师训诶.... 预计分数:100 + 100 + 5 + 100 + 25 + 100 = 430 实际 :80 + 100 + 0 + 100 + 25 + ...
- 潭州课堂25班:Ph201805201 MySQL第一课 (课堂笔记)
一般说来,关系形在磁盘中,非关系表在内存中, 进入 MySQL: mysql -u用户名 -p密码 mysql -uroot -pqwe123 mysql -h127.0.1 -P3306 -uroo ...
- extend与append的区别
''' list 的两个方法extend 和 append 看起来类似,但实际上完全不同. extend接受一个参数,这个参数,总是一个list,并把list中的每个元素添加到原list中 appen ...