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的更多相关文章

  1. shell linux 环境下循环遍历文件夹下所有文件

    demofun(){ ` do if test -f $file then echo "file: $file" elif test -d $file then echo &quo ...

  2. DOM 元素的循环遍历

    ​博客地址:https://ainyi.com/89​ 获取 DOM 元素的几种方式 get 方式: getElementById getElementsByTagName getElementsBy ...

  3. [SoapUI] 循环遍历某个Test Case下的所有Test Step,将Cookie传递给这些Test Step

    import com.eviware.soapui.support.types.StringToStringMap //Get cookie's value from the project leve ...

  4. json原理和jquey循环遍历获取所有页面元素

    1.json原理: javascript object notation (javascript 对象表示法) 是一种轻量级的数据交换语言,由javascript衍生而出,适用于.NET java c ...

  5. [SoapUI]获取Project,Test Suite,Test Case各个级别参数的值

    String testResultPath = testRunner.testCase.testSuite.project.getPropertyValue( "testResultPath ...

  6. C#开发Unity游戏教程循环遍历做出判断及Unity游戏示例

    C#开发Unity游戏教程循环遍历做出判断及Unity游戏示例 Unity中循环遍历每个数据,并做出判断 很多时候,游戏在玩家做出判断以后,游戏程序会遍历玩家身上大量的所需数据,然后做出判断,即首先判 ...

  7. C#开发Unity游戏教程循环遍历做出推断及Unity游戏演示样例

    C#开发Unity游戏教程循环遍历做出推断及Unity游戏演示样例 Unity中循环遍历每一个数据,并做出推断 非常多时候.游戏在玩家做出推断以后.游戏程序会遍历玩家身上大量的所需数据,然后做出推断. ...

  8. ArrayList和LinkedList的几种循环遍历方式及性能对比分析(转)

    主要介绍ArrayList和LinkedList这两种list的五种循环遍历方式,各种方式的性能测试对比,根据ArrayList和LinkedList的源码实现分析性能结果,总结结论. 通过本文你可以 ...

  9. ArrayList和LinkedList的几种循环遍历方式及性能对比分析

    最新最准确内容建议直接访问原文:ArrayList和LinkedList的几种循环遍历方式及性能对比分析 主要介绍ArrayList和LinkedList这两种list的五种循环遍历方式,各种方式的性 ...

随机推荐

  1. Mysql无法创建外键的原因 !!!

    在MySQL中创建外键时,经常会遇到问题而失败,这是因为Mysql中还有很多细节需要我们去留意,我自己总结并查阅资料后列出了以下几种常见原因. 1.  两个字段的类型或者大小不严格匹配.例如,如果一个 ...

  2. 安装配置limesurvey

    下载limesurvey地址:http://www.limesurvey.org/en/stable-release 选择下载 limesurvey200plus-build131122.zip 解压 ...

  3. 文档主题生成模型(LDA)

    一.问题描述 1.1文本建模相关 统计文本建模的目的其实很简单:就是估算一组参数,这组参数使得整个语料库出现的概率最大.这是很简单的极大似然的思想了,就是认为观测到的样本的概率是最大的.建模的目标也是 ...

  4. python+selenium+Firefox+pycharm版本匹配

    window(2018-05-29)最新 python:3.6.1    地址https://www.python.org/downloads/release/python-361/ selenium ...

  5. C++获取本机的ip地址程序

    #include <WinSock2.h> #pragma comment(lib,"ws2_32") //链接到ws2_32动态链接库 class CInitSock ...

  6. ce

    一,什么是epel 如果既想获得 RHEL 的高质量.高性能.高可靠性,又需要方便易用(关键是免费)的软件包更新功能,那么 Fedora Project 推出的 EPEL(Extra Packages ...

  7. C# 鼠标穿透窗体与恢复

    转自原文 C# 鼠标穿透窗体与恢复 引入user32.dll [DllImport("user32.dll")] public static extern uint SetWind ...

  8. 跟着太白老师学python day10 函数嵌套, global , nonlocal

    函数嵌套: 第一种嵌套方法 def func(): count = 123 def inner(): print(count) inner() func() 第二种嵌套方法 count = 123 d ...

  9. 在Spring中使用Redis Lua脚本批量删除缓存

    背景 之前分享了一篇利用lua脚本批量删除redis的key的文章.现在项目中我打算使用spring的缓存,而Spring缓存以前我是用ehcache来做实现的.没发现什么问题..这次我换成redis ...

  10. iOS常用动画 类封装

    //这是一个很好的动画封装类 很容易明白很详细 和大家分享 // CoreAnimationEffect.h // CoreAnimationEffect // // Created by Vince ...