博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SoapUI Pro Project Solution Collection-XML assert
阅读量:5859 次
发布时间:2019-06-19

本文共 1988 字,大约阅读时间需要 6 分钟。

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.

Node Types - Return ValuesThe following table lists what the nodeName and the nodeValue properties will return for each node type:Node Type    nodeName returns    nodeValue returnsDocument    #document    nullDocumentFragment    #document fragment    nullDocumentType    doctype name    nullEntityReference    entity reference name    nullElement    element name    nullAttr    attribute name    attribute valueProcessingInstruction    target    content of nodeComment    #comment    comment textText    #text    content of nodeCDATASection    #cdata-section    content of nodeEntity    entity name    nullNotation    notation name    null
NodeType    Named Constant1           ELEMENT_NODE2           ATTRIBUTE_NODE3           TEXT_NODE4           CDATA_SECTION_NODE5           ENTITY_REFERENCE_NODE6           ENTITY_NODE7           PROCESSING_INSTRUCTION_NODE8           COMMENT_NODE9           DOCUMENT_NODE10          DOCUMENT_TYPE_NODE11          DOCUMENT_FRAGMENT_NODE12          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.XmlHolderdef 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
0){ nodevalue=node.getFirstChild().getNodeValue(); } } } }

use the above groovy script to assert the response xml content as you want .hope this save your time .

转载地址:http://zirjx.baihongyu.com/

你可能感兴趣的文章
【转】TabError:inconsistent use of tabs and spaces
查看>>
多系统盘挂载
查看>>
MySQL函数怎么加锁_MYSQL 函数调用导致自动生成共享锁问题
查看>>
python httpstr find_Python string.rfind方法代碼示例
查看>>
php 发布拼多多,拼多多补贴换增长的故事还能讲多久?
查看>>
[na]office 2010 2013卸载工具
查看>>
Dynamic Performance Tables not accessible Automatic Statistics Disabled for this session
查看>>
Linux中使用vim乱码
查看>>
MR1和MR2的工作原理
查看>>
Eclipse中修改代码格式
查看>>
关于Keytool创建服务器自签名证书
查看>>
GRUB Legacy
查看>>
iOS开发之常用的那些工具类和方法
查看>>
关于 error: LINK1123: failure during conversion to COFF: file invalid or corrupt 错误的解决方案...
查看>>
linix下用keepalived搭建高可用myqsl-ha
查看>>
我的友情链接
查看>>
hexo博客解决不蒜子统计无法显示问题
查看>>
python实现链表
查看>>
java查找string1和string2是不是含有相同的字母种类和数量(string1是否是string2的重新组合)...
查看>>
Android TabActivity使用方法
查看>>