SoapUI中如何传递cookie
import com.eviware.soapui.support.types.StringToStringMap //Get all the cookies in the response
def cookiesList = testRunner.testCase.getTestStepByName("Login").testRequest.response.responseHeaders["Set-Cookie"]
def cookieNew= cookiesList.get(2).split(";")[0];
log.info "cookie : "+cookieNew // Set the project level property : cookie , its value will be updated with cookieNew
testRunner.testCase.testSuite.project.setPropertyValue("cookie", cookieNew) cookieNew = '${#Project#cookie}' //Put cookie to a StringMap
def cookieMap = new StringToStringMap()
cookieMap.put("Cookie",cookieNew) //Pass cookie to all testSteps of the project
def testSuiteList = testRunner.testCase.testSuite.project.getTestSuiteList()
def testCaseList
def testStepList
for(testSuite in testSuiteList){
testCaseList = testSuite.getTestCaseList()
for(testCase in testCaseList){
testStepList = testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.class)
for (testStep in testStepList){
testStep.testRequest.setRequestHeaders(cookieMap)
}
}
} //Pass cookie to testStep "AA_BB" of testSuite "AA"
def testSuiteList = testRunner.testCase.testSuite.project.getTestSuiteList()
def testCaseList
def testStepList
for(testSuite in testSuiteList){
if(testSuite.name == "AA"){
testCaseList = testSuite.getTestCaseList()
for(testCase in testCaseList){
testStepList = testCase.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.class)
for(testStep in testStepList){
if(testStep.name == "AA_BB"){
testStep.testRequest.setRequestHeaders(cookieMap)
}
}
}
}
}
SoapUI中如何传递cookie的更多相关文章
- 跨域cors中如何传递cookie(前端为什么无法向后端传递cookie?)
没有跨域 后端server只要在回应头部‘set-cookie’,那么就会有cookie产生并保存在客户端client. 等到client再次向后端server发送请求时浏览器的机制就会自动携带coo ...
- Jmeter中传递cookie值
场景:用户登陆后会本地会保存cookie,cookie是用来跟服务端验证此用户已经登陆过的重要信息,但是如何获取并在其他请求时将此cookie传递给服务器呢? 在线程组下面之直接添加HTTP Cook ...
- 使用curl传递cookie错误的问题
工作中发现一个问题, 通过curl调用接口传递cookie操作用户的数据, 接口的程序解析不了cookie中的数据. 经过排查发现curl发送的cookie数据为 TZ+Gn+rEk+6G4d 而接口 ...
- 【ASP.NET Web API教程】5.5 ASP.NET Web API中的HTTP Cookie
原文:[ASP.NET Web API教程]5.5 ASP.NET Web API中的HTTP Cookie 5.5 HTTP Cookies in ASP.NET Web API 5.5 ASP.N ...
- 关于PHP中浏览器禁止Cookie后,Session能使用吗?
sessionid是存储在cookie中的,解决方案如下: Session URL重写,保证在客户端禁用或不支持COOKIE时,仍然可以使用Session session机制.session机制是一种 ...
- ASP.NET Core2.1 中如何使用 Cookie和Session
https://blog.csdn.net/canduecho/article/details/80651853 ASP.NET Core2.1的官方项目模板在创建的Razor Pages和MVC项目 ...
- Jmeter跨线程组传递cookie,以禅道系统为例;BeanShell的存取数据的使用
先看下脚本结构: 思路:将登陆请求放在setUp Thread Group中:把登陆后的cookie通过正则提取出来,然后存为全局变量,传递到下一个线程组中: 第一步:添加setUp Thread G ...
- php中如何传递Session ID
一般通过在各个页面之间传递的唯一的 Session ID,并通过 Session ID 提取这个用户在服务器中保存的 Session 变量,来跟踪一个用户.常见的 Session ID 传送方法主要有 ...
- vertx使用过程中浏览器端Cookie重复问题
[问题描述] 背景: 使用vertx提供的服务,使用Dispatcher做路由转发,内部通过routingcontext做请求传递及响应. 现象: 在谷歌浏览器的Network中,看到Cookie中有 ...
随机推荐
- js计时器方法 setInterval(),setTimeout()
window.setInterval() 周期性地调用一个函数(function)或者执行一段代码. var intervalID = window.setInterval(func, delay[, ...
- [已解决] windows 下 git 免输密码
在 .git/config 里面加上这句话即 [credential] helper = store 原文地址:http://www.cnblogs.com/gifisan/p/5829578.htm ...
- 【原创】js中利用cookie实现记住密码功能
在登录界面添加记住密码功能,我首先想到的是在java后台中调用cookie存放账号密码,大致如下: HttpServletRequest request HttpServletResponse res ...
- 【转】VS2010中 C++创建DLL图解
转载地址:http://blog.csdn.net/g710710/article/details/7255744 一.DLL的创建 创建项目: Win32->Win32项目,名称:MyDLL ...
- mac 安装phpredis扩展
curl -O https://nodeload.github.com/nicolasff/phpredis/zip/master tar -zxf master cd phpredis-master ...
- apache 一域名下多个二级域名如何做设置?
域名最新配置说明官网:http://apache.chinahtml.com/ 目的是在根目录,不同子域名可以访问不同目录下的网站: 第一步:打开 C:\Windows\System32\driver ...
- 学DIV+CSS技术,如何入门?(2)
http://www.zhangbin.in/a/jishuziliao/CSSjishu/2014/0730/13267_2.html
- 红字差评系列3.abcd
[题目分析] 首先,这个e[i]是在a[i]~b[i]的,而且要{c[i]*e[i]}为0,{d[i]*e[i]}最大. 我们把a[i]~b[i]这个区间向左平移a[i]个单位,于是这个区间就变成了0 ...
- Giving Data Backup Option in Oracle Forms 6i
Suppose you want to give the data backup option in Oracle Forms application to some client users, wh ...
- (转) C/C++中const关键字详解
文章转自 http://www.cnblogs.com/yc_sunniwell/archive/2010/07/14/1777416.html 为什么使用const?采用符号常量写出的代码更容易维 ...