[SoapUI] 获取Cookie,并循环遍历当前Project下所有的Test Suite,Test Case,Test Step,将Cookie传递给这些Test Step
import com.eviware.soapui.support.types.StringToStringMap //Get all th cookies in the response , here the test step name is provided
def cookiesList = testRunner.testCase.getTestStepByName("Login").testRequest.response.responseHeaders["Set-Cookie"]
log.info cookiesList //Get the second cookie, only this one is must for PA API testing
String cookieNew = cookiesList.get(1)
log.info "cookie : "+cookieNew // Set the project level property : cookie , its value will updated with cookieNew
testRunner.testCase.testSuite.project.setPropertyValue( "cookie", cookieNew ) //Put cookie to a StringMap
def cookieMap = new StringToStringMap()
cookieMap.put("Cookie",cookieNew) def testSuiteList = testRunner.testCase.testSuite.project.getTestSuiteList()
def testCaseList
def testStepList
for(testSuite in testSuiteList){
log.info "Test suite number : "+testSuiteList.size()
testCaseList = testSuite.getTestCaseList()
for(testCase in testCaseList){
log.info "Test case number : "+testCaseList.size()
testStepList = testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.class)
log.info "Test step number : "+testStepList.size()
for (testStep in testStepList){
log.info "Pass cookie to test step : "+testStep.name
testStep.testRequest.setRequestHeaders(cookieMap)
}
}
}
执行结果:

[SoapUI] 获取Cookie,并循环遍历当前Project下所有的Test Suite,Test Case,Test Step,将Cookie传递给这些Test Step的更多相关文章
- shell linux 环境下循环遍历文件夹下所有文件
demofun(){ ` do if test -f $file then echo "file: $file" elif test -d $file then echo &quo ...
- DOM 元素的循环遍历
博客地址:https://ainyi.com/89 获取 DOM 元素的几种方式 get 方式: getElementById getElementsByTagName getElementsBy ...
- [SoapUI] 循环遍历某个Test Case下的所有Test Step,将Cookie传递给这些Test Step
import com.eviware.soapui.support.types.StringToStringMap //Get cookie's value from the project leve ...
- json原理和jquey循环遍历获取所有页面元素
1.json原理: javascript object notation (javascript 对象表示法) 是一种轻量级的数据交换语言,由javascript衍生而出,适用于.NET java c ...
- [SoapUI]获取Project,Test Suite,Test Case各个级别参数的值
String testResultPath = testRunner.testCase.testSuite.project.getPropertyValue( "testResultPath ...
- C#开发Unity游戏教程循环遍历做出判断及Unity游戏示例
C#开发Unity游戏教程循环遍历做出判断及Unity游戏示例 Unity中循环遍历每个数据,并做出判断 很多时候,游戏在玩家做出判断以后,游戏程序会遍历玩家身上大量的所需数据,然后做出判断,即首先判 ...
- C#开发Unity游戏教程循环遍历做出推断及Unity游戏演示样例
C#开发Unity游戏教程循环遍历做出推断及Unity游戏演示样例 Unity中循环遍历每一个数据,并做出推断 非常多时候.游戏在玩家做出推断以后.游戏程序会遍历玩家身上大量的所需数据,然后做出推断. ...
- ArrayList和LinkedList的几种循环遍历方式及性能对比分析(转)
主要介绍ArrayList和LinkedList这两种list的五种循环遍历方式,各种方式的性能测试对比,根据ArrayList和LinkedList的源码实现分析性能结果,总结结论. 通过本文你可以 ...
- ArrayList和LinkedList的几种循环遍历方式及性能对比分析
最新最准确内容建议直接访问原文:ArrayList和LinkedList的几种循环遍历方式及性能对比分析 主要介绍ArrayList和LinkedList这两种list的五种循环遍历方式,各种方式的性 ...
随机推荐
- golang里面检测对象是否实现了接口的方法
写法有点怪异,记一下吧 _, implemented := this.delegate.(IGenTcpServerDelegate) if implemented { this.delegate.G ...
- 解决win下无法ping通VM虚拟机CentOS系统的方法
事情描述:公司迁新址,电脑带过去之后,用xshell连接vm的centos系统老是连接失败,然后考虑到公司迁新址这个情况,我首先怀疑是ip的问题,然后在vm中执行ifconfig找到centos的ip ...
- python--logging库学习_自我总结---有空完善
思路: 1.把前面的都封装,然后在测试用例里面调用,每一步测试步骤下面都加一个 logging.info('这个是测试步骤')(可以 亲测) 2.尝试添加到unittest框架里面,看能不能一起使用 ...
- https 请求的端口是443 注意
注意: 这里录制https的请求 端口号一定是443 才可以抓取到!!!!!! (进坑多次)
- 1123 Is It a Complete AVL Tree
1123 Is It a Complete AVL Tree(30 分) An AVL tree is a self-balancing binary search tree. In an AVL t ...
- B. T-primes
/* PROBLEMSSUBMITSTATUSSTANDINGSCUSTOM TEST B. T-primes time limit per test2 seconds memory limit pe ...
- 安装完Apache后,配置httpd.conf来使apache来加载php模块
以apache模块的方式来安装php,在httpd.conf文件中首先使用LoadModule php5_module '.../php5apache2.dll'来动态装载Php模块,然后再用语句Ad ...
- Delphi IOS class_addMethod
class_addMethod 学习FMX.Platform.iOS.pas文件的处理办法 d:\program files (x86)\embarcadero\studio\17.0\source\ ...
- javaWeb 开发的成长路线
感觉最近技术到了一个瓶颈,好长时间没有感觉进步了,本着活到老学到老的态度,笔者就去逛了下,看看前辈们写的文章,觉得他们写的非常不错,在这里特别贴出一张特别值得收藏的图片,不是说其他总结的图片不值得收藏 ...
- Python常用的一些内建函数和math模块函数
一:Python内建函数 # abs取绝对值 num = -10 print(abs(num)) # max 求最大值 print(max(6, 9, 2, 12, 8)) # min求最小值 pri ...