[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的五种循环遍历方式,各种方式的性 ...
随机推荐
- Renesas 符号地址空间对齐
对齐方式定义头文件:bsp_compiler_support.h #define BSP_SECTION_STACK ".stack" #define BSP_SECTION_HE ...
- javascript基础-js对象
一.js对象的创建 1.普通最简单的方式 var teacher = new Object( ); teacher.name = "zhangsan"; teacher.age = ...
- Oracle合并某一列
本文转载自:https://www.cnblogs.com/LeiYang5237/p/6761183.html 一.oracle11g使用listagg() within group()函数 如图一 ...
- Juicer自定义函数
首先,先写自定义的方法: function (sex) { ; ; var Range = Max - Min; var Rand = Math.random(); var res = (Min + ...
- 全局获取Context
1.定制一个Application类,管理全局的状态信息 public class MyApplication extends Application{ private static Context ...
- MyBatis的适用场景和生命周期
MyBatis使用场景 对比Hibernate和MyBatis是我们常见的话题,Hibernate作为常用的ORM框架,它使用起来简单易懂,对于SQL语言的封装,让对于SQL并不是很熟练的程序员也可以 ...
- 新学一招,使用热门的Git
1.安装Git 1.本文所用版本为Git-1.8.0-preview20121022.exe , http://msysgit.googlecode.com/files/Git-1.8.0-prev ...
- [linux] ping服务器脚本
#!/bin/bash IP=1.2.3.4 while true; do echo "**********************************************" ...
- OD 实验(十五) - 对一个程序的逆向
程序: 打开程序 出现一个 NAG 窗口 这是主界面 点击 Exit 程序出现 NAG 窗口,然后退出 用 PEiD 看一下 是用 VC++ 6.0 写的程序 逆向: 用 OD 载入程序 跑一下程序 ...
- 解析 Ceph: FileJournal 的作用
很多的用户在提到 Ceph 性能的时候都会提到“写放大”这点,实际上就是 FileJournal 在起作用.只要使用默认的 FileStore,所有数据包括 metadata 都会在 FileJo ...