SoapUI Pro 使用整理

1. Property Expansion:
1> Property Expansion in soapUI: ${Search Request#Response#//ns1:Item[1]/n1:Author[1]/text()}   
  Examples: 
  response = context.expand('${GetDataPoints#Response) ---Json format
  response = context.expand('${GetDataPoints#Response#$.params[2].options[0].id}')     ---Json format
'.'表示当前json对象
  
  /**
  *<Results>
  * <ResultSet fetchSize="128">
  * <Row rowNumber="1">
  * <ID>0Axxxxx</ID>
  * <aaaY>4</aaaY>
  * </Row>
  * </ResultSet>
  *</Results>
  */
  responseAsXml = context.expand( '${JDBC Request#ResponseAsXml') ---Xml format
  responseAsXml = context.expand('${JDBC Request#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]/ID[1]}')  --Xml format




2> Where scope can be one of the following literal values: 
#Project# - references a Project property(Reference properties across a particular SoapUI project) 
#TestSuite# - references a TestSuite property in the containing TestSuite 
#TestCase# - references a TestCase property in the containing TestCase
Example:  context.expand("${#Project#FilePath}")
 context.expand("${#TestSuite#FilePath}")
 context.expand("${#TestCase#FilePath}")

#MockService# - references a MockService property in the containing MockService 

#Global# - references a global property. Found in File>Preferences>Global Properties tab. Reference properties across all projects 
Example: Preferences -> Global Properties:    test = global variables
assert context.expand("${test}") == "global variables"

#System# - references a system property. Found in Help>System properties. 
Example: assert context.expand('${#System#file.encoding}') == 'GBK'

#Env# - references an environment variable 
Example: context.expand('${#Env#JAVA_HOME}')

#[TestStep name]# - references a TestStep property 
Example: 
Property step:   context.expand('${Properties#variable}')
Groovy Step: context.expand('${getSql2#result}')
Request Step:   context.expand('${Request 1#Response}')


3> Dynamic Properties:
${=(int)(Math.random()*1000)}
${=request.name}
${=request.operation.interface.project.name}
${=import java.text.SimpleDateFormat ; new SimpleDateFormat("YYYY-MM-DDT00:00:00").format(new Date())}

context.expand('${=request.name}')
Test library: http://www.soapui.org/apidocs/com/eviware/soapui/impl/rest/RestRequest.html


4> Nested Properties: 
testxml = "hello" 
testxpath = "//value[@id=${id}]/text()" 
id = "123" 
-> "${#testxml#${testxpath}}" evaluates to "hello" 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值