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 添加断言 ...
随机推荐
- leetcode128 Longest Consecutive Sequence
思路: 维护一个unordered_map,key是每个连续区间的端点,value是该区间的长度. 实现: class Solution { public: int longestConsecutiv ...
- 显示大图Activity(支持手势放大)
xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:andro ...
- MD5 介绍
MD5(单向散列算法)的全称是Message-Digest Algorithm 5(信息-摘要算法),经MD2.MD3和MD4发展而来.MD5算法的使用不需要支付任何版权费用. MD5功能: 输入任意 ...
- Java、Node.js、PHP还是.Net? 无论你选谁,我都能教你一招!
七夕如期而至,不该来的终究还是来了.再傲娇的单身贵族恐怕也难免在今天会感觉一丝丝的空虚.还好你关注了我,因为接下来我准备了三大招教你一个人…..也可以优雅地过七夕. 招式一:移形幻影,无中生有 七夕当 ...
- jenkins+phantomjs环境搭建及使用
#jenkins+phantomjs 前端性能自动化测试的安装和使用#gcc GNU编译器套件 https://gcc.gnu.org/ #nginx 高性能的HTTP和反向代理服务器 http:// ...
- explian使用介绍
1).id列数字越大越先执行,如果说数字一样大,那么就从上往下依次执行,id列为null的就表是这是一个结果集,不需要使用它来进行查询. 2).select_type列常见的有:A:simple:表示 ...
- ABC3D创客项目:小风扇
风扇是我们纳凉的好帮手,然而大多的风扇都体积庞大不易携带.利用电池进行供电能让风扇变得更加便捷,下面我们利用电池供电的原理制作出一个风扇. 工作原理: 这个OK风扇的主要能源来自于后面的7号电池,风扇 ...
- rhythmbox插件开发笔记2:背景知识学习 D-Bus&VFS&Gio& Python GTK+ 3
这次主要简单介绍下相关的背景知识 D-Bus&VFS&Gio& Python GTK+ 3 D-Bus D-Bus是开源的进程通信(IPC)系统,它允许多个进程进行实时通信. ...
- iPhone Tutorials
http://www.raywenderlich.com/tutorials This site contains a ton of fun written tutorials – so many t ...
- 判断一个链表是否为回文结构 【题目】 给定一个链表的头节点head,请判断该链表是否为回 文结构。 例如: 1->2->1,返回true。 1->2->2->1,返回true。 15->6->15,返回true。 1->2->3,返回false。 进阶: 如果链表长度为N,时间复杂度达到O(N),额外空间复杂 度达到O(1)。
方式1:借助栈 空间辅助度是O(N) 方式2: 借助栈 空间复杂度是 O(n/2).只存后半个链表 方式3: 反转后半个链表 最后再反转回来 package my_basic.class_3; im ...