Link:http://testautomationnoob.blogspot.com/2012/10/soapui-properties-and-property-related.html

soapUI: Properties

 
I wanted to jump into a survey of the various test steps in this post, but quickly realized that an explanation of properties was necessary first.  Properties are a key concept in soapUI that can make test suites more flexible and modular.  You can define and reference your own custom properties (which you can think of as being akin to variables in soapUI) or use "built-in" properties to reference bits of information between test steps and test cases-- for example, referencing part of one request test step's response XML to use as an input parameter in another request test step.

Properties are available at multiple levels in soapUI, including the
environment, system, global, project, test suite, test case, and test
step levels.  System properties are visible in the Help - System
Properties window.  Global properties can be viewed or set in the File -
Preferences window.  Properties for other levels are visible in the
Navigator panel when you click on the relevant node.



Project properties panel

In some cases, properties can also be loaded from or saved to external
files (see the screenshot below of a test suite Custom Properties tab;
the two rightmost icons at the top of the dialog are for loading and
saving from external files).  Properties are saved in the file in propertyname=propertyvalue pairs; e.g.:

  1. ElName=Mercury
  2. ExpectedVal=80

Properties can be referenced (soapUI documentation calls this property expansion) from
almost anywhere in soapUI-- in Contains assertions as the string to
match, within a request, etc.  To reference a property, the general
syntax is "${[#PropertyScope#]PropertyName[#XPathExpression]}".  PropertyScope can
be "Env", "System", "Global", "Project", "TestSuite", and "TestCase"
(in the screenshot above, the Hermes Config property references the
user.home System property).  To reference properties from a preceding
test step, the syntax is "${TestStepName#PropertyName[#XPathExpression]}--
note that the leading hash mark (#) before the scope is omitted when
referencing a test step.  The test step where you're putting your
reference and the test step being referenced must be within the same
test case.  XPath expressions are optional and only valid where the
property being referenced is valid XML (for test requests, the request
and response are both made available as properties).

Let's go back to the test suite created in the last post for
our Periodic Table web service.  Note that three of the four operations
provided by the web service take an element name as their input
parameter: GetAtomicNumber, GetAtomicWeight, GetElementSymbol.  Suppose
we wanted to use the same element to test all three.  Instead of
hard-coding an element into our requests, we can define a test suite
level property and then use that property in all three of our test
requests.

Let's try that now.  In the Navigator panel, click on the test suite
node.  In the Properties panel (click the Properties button at the
bottom of the Navigator panel if you don't see it), click on the "Custom
Properties" tab, and add a new property called ElNameProp (via the
left-most button at the top), giving it "Silver" as its value.



ElNameProp created at the test suite level

Now go into the GetAtomicNumber, GetAtomicWeight, and GetElementSymbol
test requests and modify each to use our test suite's ElNameProp where
an element name is required. Our reference expression is
"${#TestSuite#ElNameProp}". Here's the reference in the GetAtomicNumber
test request:



ElNameProp used in the GetAtomicNumber test request

Now try running each of the modified test requests-- the value "Silver"
is plugged into each of the requests where we reference our ElNameProp
property (you can see some of the appropriate response data for the
GetAtomicNumber request in the screenshot above).

 
 
 

SoapUI Properties的使用的更多相关文章

  1. soapUI参数中文乱码问题解决方法 (groovy脚本中文乱码)

    soapUI参数中文乱码问题解决方法 可能方案1: 字体不支持中文,将字体修改即可: file-preferences-editor settings-select font 修改字体,改成能显示中文 ...

  2. 使用 soapUI 测试 REST 服务

    REST 服务介绍 REST(Representational State Transfer)是 Roy Fielding 博士在 2000 年提出的一种新的软件架构风格,它以资源(resource) ...

  3. soapUI参数中文乱码问题解决方法&soap UI工具进行web接口测试

    soapUI参数中文乱码问题解决方法 可能方案1: 字体不支持中文,将字体修改即可: file-preferences-editor settings-select font 修改字体,改成能显示中文 ...

  4. How To Fix soapUI JVM Maximum Heap Size (-Xmx) Error [Solution]

    http://quicksoftwaretesting.com/soapui-jvm-heap-size-xmx-error/ -Xms128m -Xmx1000m -Dsoapui.properti ...

  5. SoapUI乱码问题处理方法

    前言 每个工具都会有一些意想不到的“坑”,SoapUI也不例外.无论是参数或者响应报文,大家可能都遇到过乱码问题,这里记录一下几种解决乱码的方法. 一.修改显示字体 在File>>> ...

  6. [SoapUI] 配置默认环境的properties

    <Envs> <Env id="Live,Default environment"> <Project> <CusProperty nam ...

  7. SOAPUI使用教程-MockService脚本概述

    虽然静态MockOperation和MockResponse模型可以给你一定的灵活性,更多的动态行为添加到您的服务让您更模拟复杂的服务功能是很有用的.例如,你可能想: 从请求到响应传输值,修改它们的值 ...

  8. 接口测试SoapUI参数化

    上次和大家一起完成了soapui的参数之一properties,今天我们一起交流另外一种参数化的方法,跟着一起练习,不懂不要紧,练习多了就会慢慢懂的: 1.准备excle(目前soapui只支持xls ...

  9. Groovy解析xml并且注入Project,TestSuite,TestCase级别的custom properties

    import com.eviware.soapui.support.GroovyUtils import groovy.util.XmlParser def groovyUtils = new Gro ...

随机推荐

  1. Struts2+Hibernate+Spring 整合示例

    转自:https://blog.csdn.net/tkd03072010/article/details/7468769 Struts2+Hibernate+Spring 整合示例 Spring整合S ...

  2. 反向索引(Inverted Index)

    转自:http://zhangyu8374.iteye.com/blog/86307 反向索引是一种索引结构,它存储了单词与单词自身在一个或多个文档中所在位置之间的映射.反向索引通常利用关联数组实现. ...

  3. C语言学习笔记--递归函数

    1. 递归函数的思想 (1)递归是一种数学上分而自治的思想,是将大型复杂问题转化为与原问题相同但规模较小的问题进行处理的一种方法 (2)递归需要有边界条件 ①当边界条件不满足时,递归继续进行 ②当边界 ...

  4. JAVA中的垃圾回收机制以及其在android开发中的作用

    http://blog.csdn.net/xieqibao/article/details/6707519 这篇文章概述了JAVA中运行时数据的结构,以及垃圾回收机制的作用.在后半部分,描述了如何检测 ...

  5. oracle创建完实例删除的时候报ORA-01031:insufficient privileges错误,解决办法

    创建了一个数据库,想删除确报了一个ORA-01031:insufficient privileges错误 查了好久,总算解决了,原因是我的电脑登录账户不在ORA_DBA系统群组中,添加进去完美删除! ...

  6. POJ 3714 分治/求平面最近点对

    第一次见这种问题直接懵圈...没想到分治法这么强大,借鉴了lyd的代码: 代码如下 #include<cstdio> #include<algorithm> #include& ...

  7. explode()与相反函数 implode() 和join()

    explode()的函数原型: array explode(string separator,string input [,int limit]); //[,int limit]是表示可选的意思 参数 ...

  8. 关联映射、关联查询【重点掌握一条SQL语句的那种方法】

    1 什么叫关联映射 通过数据库对象之间的关联关系(一对一.一对多.多对多),反映到实体对象上之间的引用. 举例 用户实体类(User):user_id user_name user_token 笔记本 ...

  9. 3D模型浏览器的实现思路

    前段时间正好浏览了数据结构中关于图的部分,突然就意识到一个问题,3D模型就是用无向图来存储的.仔细想一想是不是这样呢? 一个3D模型去掉材质之后剩下的部分就是点以及点和点之间的连线了,点我们用三维坐标 ...

  10. p2444 病毒

    传送门 分析 先用AC自动机将所有字符串存起来,之后我们从根节点跑一遍dfs 判断时我们只需要判断这个环有没有任意一个字符串的结尾就可以判断是否安全了 注意一个节点的信息需要累加上它fail指针所指位 ...