[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的五种循环遍历方式,各种方式的性 ...
随机推荐
- ubuntu下面搭建SolrCloud集群
首先要先把ubuntu环境搭建好,配置好静态IP,我这边配置的是3台机子,solr搭建集群至少是2台. 192.168.0.15 主机 192.168.0.16 从机 192.168.0.17 ...
- 003:MySQL账号创建授权以及Workbench
目录 一. 权限管理 1."用户 + IP"的概念 2. 用户权限管理 3. 基本操作 4. 撤销权限 5.授权和创建用户 二. MySQL模拟角色 三. Workbench与Ut ...
- C语言经典面试题 与 C语言面试宝典
1 预处理 问题1:什么是预编译?何时需要预编译? 答: 预编译又称预处理,是整个编译过程最先做的工作,即程序执行前的一些预处理工作.主要处理#开头的指令.如拷贝#include包含的文件代码.替换# ...
- JS-用法
JavaScript 用法 HTML 中的脚本必须位于 <script> 与 </script> 标签之间. 脚本可被放置在 HTML 页面的 <body> 和 & ...
- 10g RAC常用开启关闭命令 – SRVCTL用法
10G RAC: srvctl 1. Grammar: srvctl <command> <object> [<options]] available <comma ...
- Python curses getch()
window.getch([y, x]) Get a character. Note that the integer returned does not have to be in ASCII ra ...
- pycharm多行代码同时注释、去除注释
pycharm中同时注释多行代码快捷键: 代码选中的条件下,同时按住 Ctrl+/,被选中行被注释,再次按下Ctrl+/,注释被取消
- HTTP头的Expires与Cache-control区别
2010年3月24日 a18ccms 发表评论 阅读评论 今天在群里聊天.说道了Expires.这里来说明下这两个的区别吧. 1.概念 Cache-control 用于控制HTTP缓存(在HTTP/1 ...
- array,vector对象 数组越界检测
- vector array and normal stanard array
array 数组的长度固定 vector 自由存储区(栈),动态长度 普通标准数组相对较不安全,不方便; array,vector对象成员函数支持数组越界检测,同时代价是效率问题: array,普通标 ...