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 添加断言 ...
随机推荐
- TP框架设置验证码
thinkphp框架有专门的的验证码生成的模块 public function shengcheng(){ $n = new \Think\Verify(); $n->entry(); } 下面 ...
- MD5 介绍
MD5(单向散列算法)的全称是Message-Digest Algorithm 5(信息-摘要算法),经MD2.MD3和MD4发展而来.MD5算法的使用不需要支付任何版权费用. MD5功能: 输入任意 ...
- apache安装报错
libtool: install: error: cannot install `libaprutil-1.la' to a directory not ending /some_directory ...
- 【数据库-Azure SQL Database】JDBC 如何连接 SQL Azure 数据库
使用 JAVA 代码连接 Azure SQL Database 时产生了 SSL 错误,对于此问题大多数用户都是因为不知如何编写 JDBC 连接字符串而产生的,以下为相关示例代码,供您参考: pa ...
- bunzip2命令
bunzip2——解压缩.bz2格式文件 命令所在路径:/usr/bin/bunzip2 示例1: # bunzip2 yum.log.bz2 解压当前目录下的yum.log.bz2为yum.log, ...
- Linux OpenGL 实践篇-12-procedural-texturing
程序式纹理 简单的来说程序式纹理就是用数学公式描述物体表面的纹路 .而实现这个过程的着色器我们称之为程序纹理着色器,通常在这类着色器中我们能使用的输入信息也就是顶点坐标和纹理坐标. 程序式纹理的优点 ...
- 使用python模拟登陆百度
#!/usr/bin/python # -*- coding: utf- -*- """ Function: Used to demostrate how to use ...
- java 使用htmlunit模拟登录爬取新浪微博页面
mport java.io.IOException;import java.net.MalformedURLException;import com.gargoylesoftware.htmlunit ...
- SQL与脚本语言
SQL是人类与数据库沟通的语言https://zhidao.baidu.com/question/413397944.html我个人认为SQL是一种专门对数据库进行操作的特殊的脚本语言.因为SQL语句 ...
- 并查集+思维——X-Plosives
一.问题描述(题目链接) 有n种化合物,每种化合物由两种元素组成.当几种的化合物数量等于他们所含不同元素的数量时,就会发生爆炸.现在依次给出化合物的组成,当新的化合物与之前的化合物放在一起会发生爆炸时 ...