http - SoapUI 来管理 cookie
问题描述
JSESSIONID
我使用下面的代码从请求中获取值SoapUI
。
def setCookie = testRunner.testCase.testSteps["Request1"].testRequest.response.responseHeaders["Set-Cookie"]
re = /(JSESSIONID=[A-Za-z0-9]+)/
matcher = ( setCookie =~ re )
def jsesid = matcher[0][0]
log.info "$jsessid"
props = testRunner.testCase.getTestStepByName("Properties");
props.setPropertyValue('cookie',"$jsessid");
我将此变量放在其他请求的标头中,但得到一个新的 JSESSIONID 作为响应。所以我失去了会话,因为打开了一个新会话。
解决方案
您可能已经在Sending cookie as request header in SOAP UI request for rest web service 中遇到过类似问题的描述。
除此之外,您还需要Maintain HTTP session
为您的测试用例设置选项。
推荐阅读
- jquery - 球衣后端 jquery AJAX API 调用中的 Cors 策略阻塞
- c# - 转换后的WPF像素化黑白图像
- docker - 使用 docker 使用 Chromedriver 时出错
- json - 使用 Powershell 部署 Azure Policy
- php - php mailer根据动态生成的表格发送多封电子邮件
- sql - 如何在 Postgis 上更快地进行选择查询
- c++ - DirectX 不正确的纹理
- c# - Ubuntu 18 中 .NetCore 上的 process.StandartInput() 出现 BrokenPipe 错误
- c# - C# 表单应用程序 - 通过单击另一个按钮停止正在进行的进程
- json - 如何使用 beanshell 预处理器更新 jmeter 中的 JSON 节点值