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 formatimport 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 caseimport 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);
转载于:https://www.cnblogs.com/tomweng/p/5567697.html
SoapUI offen used scripts相关推荐
- soapui + groovy 接口自动化测试 第八章
一波小团战! 1.操作excel的groovy脚本 package pubimport jxl.* import jxl.write.Label import jxl.write.WritableW ...
- executequery方法_【接口测试】soapui中数字、字符串、日期时间、数据库连接参数化的设置方法...
先回顾下前几篇soapui工具操作文章: 在soapui里面使用groovy脚本生成测试报告的方法 在soapui里面用groovy传递cookie身份信息的方法 soapui中进行接口响应数据的关联 ...
- SOAPUI请求及mockservice 使用
1.新建soap Project,输入wsdl的地址,运行request 2.邮 ...
- 初始化Mysql系统报错,begin failesd--conpilation aborted at scripts........
在编译安装Mysql之后进行初始化,但是出现了报错 初始化mysql scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/us ...
- SoapUi测试,测试相关问答知识
2019独角兽企业重金招聘Python工程师标准>>> SoapUi测试 http://www.csdn123.com/html/topnews201408/39/14939.htm ...
- Composer scripts脚本:事件列表与脚本触发
脚本 什么是脚本? 一个脚本,在 Composer 中,可以是一个 PHP 回调(定义为静态方法)或任何命令行可执行的命令.脚本对于在 Composer 运行过程中,执行一个资源包的自定义代码或包专用 ...
- npm scripts的生命周期管理
2019独角兽企业重金招聘Python工程师标准>>> 我们平时阅读一些开源项目,可能会发现有些项目的package.json里的scripts区域定义的脚本很复杂,令人眼花缭乱. ...
- soapUi 接口测试
SoapUI是一个开源测试工具,通过soap/http来检查.调用.实现Web Service的功能/负载/符合性测试. SoapUI下载地址:https://www.soapui.org/,下载开源 ...
- SoapUI实践:自动化测试、压力测试、持续集成
因为项目的原因,前段时间研究并使用了 SoapUI 测试工具进行自测开发的 api.下面将研究的成果展示给大家,希望对需要的人有所帮助. SoapUI 是什么? SoapUI 是一个开源测试工具,通过 ...
最新文章
- device.cpp
- 日事清【员工绩效】功能活动上线!
- 学习EF4的一些基础参考资料
- 【CSS3】好玩的动画线框
- html加载出来图片乱掉,HTML基础 img alt 图片加载失败时,出现替代文本
- Vue中watch的简单应用
- c++从字符串中提取数字求和_【函数应用】单元格文本内提取数字并求和
- 在PhotoShop中改像素m*n
- 浅谈项目管理中的四要素
- 提示tun虚拟网卡没有安装_Win10家庭版通过Hyper-V安装Centos7+Python3.7过程总结
- 扫雷打开的初始区域递归_Python:游戏:写一个和 XP 上一模一样的“扫雷”!
- 用jdbc连接hive server需要用到的 几个jar包
- 【工具使用系列】一小时学会使用MATLAB OPC 工具箱(OPC Toolbox)
- DDL DML DCL 简介
- 数据库系统异常排查之思路
- 检测到非法调试,F12被管理员禁用解决方法
- 硬石-专题04 步进电机控制(第1节)_步进电机基本知识介绍1
- ffmpeg 用 -ss指定起始时间
- 墨羽卿画第二章第5节:另一个世界,腊月廿四
- 微信小程序:上传的图片显示旋转问题