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中有 ...
随机推荐
- logback文章推荐
logback 配置详解:http://www.cnblogs.com/zhuawang/p/4002975.html Logback 日志输出到 mysql:http://www.codeweblo ...
- 扩大Tomcat内存
在Eclipse里选:Window->Preference->Installed JREs->Edit(选中jre),在Default VM Arguments里输入-Xms256m ...
- 161216、使用spring的DefaultResourceLoader自定义properties文件加载工具类
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; imp ...
- sublime设置备份
Settings-user { "font_face": "Consolas", "font_size": 13, "line_p ...
- jquery之empty()与remove()区别
要用到移除指定元素的时候,发现empty()与remove([expr])都可以用来实现.可仔细观察效果的话就可以发现.empty()是只移除了 指定元素中的所有子节点,拿$("p" ...
- mina IoBuffer 常用方法
Limit(int) 如果position>limit, position = limit,如果mark>limit, 重置mark Mark() 取当前的position的快照标记mar ...
- 是否支持css3
/** * Function to check css3 support * @param {String} declaration name * @return {Boolean} */ funct ...
- Count Color(线段树+位运算 POJ2777)
Count Color Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 39917 Accepted: 12037 Descrip ...
- LaTeX常用数学符号
之前在写博客做笔记时经常会在Word或WPS里写好数学公式再截图上传,一直觉得这样很low.现在实在是不想再去截图上传了,于是决定开始学一下LaTeX.在博客园中使用数学公式的设置可以参考在博客园使用 ...
- ubunt tmux X Error of failed request
X Error of failed request: BadName (named color or font does not exist) Major opcode of failed req ...