SoapUI offen used scripts
【 Groovy Step 】 //get properties from testCase, testSuite and project in groovy step
def testCaseProperty = testRunner.testCase.getPropertyValue( "MyProp" ) // testCase property
def testSuiteProperty = testRunner.testCase.testSuite.getPropertyValue( "MyProp" ) // testSuite property
def projectProperty = testRunner.testCase.testSuite.project.getPropertyValue( "MyProp" )//project property // set properties to testCase,testSuite and project in groovy step
testRunner.testCase.getProperty("MyProp").setValue("MyValue"); // set testCase property
testRunner.testCase.setPropertyValue("MyProp","MyValue"); testRunner.testCase.testSuite.getPropertyValue( "MyProp" ).setValue("MyValue"); // set testSuite property
testRunner.testCase.testSuite.setPropertyValue("MyProp","MyValue"); testRunner.testCase.testSuite.project.getPropertyValue( "MyProp" ).setValue("MyValue"); // set project property
testRunner.testCase.testSuite.project.setPropertyValue("MyProp","MyValue"); // get the response content
String responseStr = testRunner.testCase.testSteps["MyStep"].testRequest.response.contentAsString;
// convert the response content to JSON format
import groovy.json.JsonSlurper;
JsonSlurper slurper = new JsonSlurper();
Object responseObj = slurper.parseText(responseStr); // run another test step under current test case
testRunner.runTestStepByName("MyStep"); // run another test step under another test case
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner;
def testcase = testRunner.testCase.testSuite.project.testSuites["MyTestSuite"].getTestCaseByName("MyTestCase");
WsdlTestCaseRunner runner = new WsdlTestCaseRunner( testcase,null );
runner.runTestStepByName("AnotherStep"); 【 Script Assertion 】
def number = messageExchange.modelItem.testCase.testSteps["Properties"].getPropertyValue("userId")
def testCaseProperty = messageExchange.modelItem.testCase.getPropertyValue("MyProp");
def testSuiteProperty = messageExchange.modelItem.testCase.testSuite.getPropertyValue("MyProp");
def projectProperty = messageExchange.modelItem.testCase.testSuite.project.getPropertyValue("MyProp");
// project property can be also like:
def projectProperty = messageExchange.modelItem.project.getPropertyValue("MyProp"); def projectProperty = context.expand('${#Project#MyProp}'); // 注意,用双引号貌似会出错
def testSuiteProperty = context.expand('${#TestSuite#MyProp}'); // get the response content
def responseContent = messageExchange.responseContent;
// get the response content and convert to JSON format
def jsonObj = net.sf.json.JSONSerialize.JSONSerializer.toJSON(messageExchange.responseContent);
SoapUI offen used scripts的更多相关文章
- SoapUI--the use of Script Library
SoapUI--the use of Script Library 有两种方法在soapUI中引用自己的groovy脚本库. 方法一:把自己的script folder放到soapUI install ...
- [SoapUI] Global Scripts For Reusability
- SoapUI命令行方式运行
http://stackoverflow.com/questions/9220132/soapui-groovy-script-calls-to-command-line SoapUI支持用命令行方式 ...
- SoapUI中XML解析
From http://www.robert-nemet.com/2011/11/groovy-xml-parsing-in-soapui.html Introduction Since soapUI ...
- SoapUI接口测试-验签值处理-调用java的加密jar包
转载自:https://www.jianshu.com/p/7c672426a165 一. 背景: 调用接口时有个请求参数是对请求入参按一定规则进行加密生成的验签值,每次不同参数的请求生成唯一的验签值 ...
- [SoapUI] Property Expansion in soapUI
1. Property Expansion in soapUI SoapUI provides a common syntax to dynamically insert ("expand& ...
- C# 用SoapUI调试WCF服务接口(WCF中包含用户名密码的验证)
问题描述: 一般调试wcf程序可以直接建一个单元测试,直接调接口. 但是,这次,我还要测试在接口内的代码中看接收到的用户名密码是否正确,所以,单一的直接调用接口方法行不通, 然后就想办法通过soapU ...
- SQLMap Tamper Scripts Update 04/July/2016
SQLMap Tamper Scripts Update apostrophemask.py Replaces apostrophe character with its UTF-8 full wid ...
- SOAPUI使用教程-REST功能测试
当创造了SoapUI功能测试用例,常见的情况是,你调用一些REST资源和验证其响应检查返回正确的结果.这可以容易地实现: 添加一个REST请求到新的test step或现有的TestCase 添加断言 ...
随机推荐
- 带有res资源文件的项目 需要导成jar包 供别人使用的解决方法
比如说自己的成品项目,名字是MyObject,需要导出成jar包,让别人的项目调用,但是自己的项目还包含有图片.layout布局.libs里面的依赖包等等: 步骤: 1.MyObject项目需要“is ...
- andorid 向上滑动控制标题栏显示
要实现这样的功能,原理不难,监听滑动距离再设置标题栏的透明度 下面是监听一个带头view的list实现核心代码: mbar是标题栏 mListView.setOnScrollListener(new ...
- idea npm 调试报错解决办法
1.用egg框架的开发时候,egg 提供本地开发和调试.点击idea 的debug 按钮时候报如下错误: Please specify npm or yarn package: cannot find ...
- Android笔记--Bitmap(三) 针对不用Android版本的位图管理
Bitmap(三) | Android不同版本的相应操作 在不同的Android版本中.位图的存储方式是不同的. 1.小于等于 Android 2.2 (API level 8) 垃圾收集器回收内存时 ...
- awk累加
{a+=substr($14,1,1)}END{a=(a=="")?0:a;print a}' 对a进行累加,如果最后a=0的话,结果为0,否则为a,最后输出a
- get和post请求及进程和线程及cookie和session的区别
get和post请求及进程和线程及cookie和session的区别 1.get和post请求的区别 get请求是指向服务器进行获取查询数据的请求,post请求指向服务器提交数据的请求. get请求如 ...
- SQL server 数据库基础语句 子查询 基础函数
上一章 说了下 子查询的意义是 把一条查询语句当做值来使用 select *from car //查询汽车的信息 假设我知道一个汽车的编号是 c021 但是我要查询 比这个汽车价格高的汽车信息 ...
- 洛谷 P1311 选择客栈
题目描述 丽江河边有n 家很有特色的客栈,客栈按照其位置顺序从 1 到n 编号.每家客栈都按照某一种色调进行装饰(总共 k 种,用整数 0 ~ k-1 表示),且每家客栈都设有一家咖啡店,每家咖啡店均 ...
- 洛谷 P1330 封锁阳光大学
题目描述 曹是一只爱刷街的老曹,暑假期间,他每天都欢快地在阳光大学的校园里刷街.河蟹看到欢快的曹,感到不爽.河蟹决定封锁阳光大学,不让曹刷街. 阳光大学的校园是一张由N个点构成的无向图,N个点之间由M ...
- 关于在filter中获取WebApplicationContext的实践
网上很多说法,诸如: <param-name>contextConfigLocation</param-name> <param-value> classpath: ...