【问题标题】:SoapUI to manage cookiesSoapUI 来管理 cookie
【发布时间】:2018-10-13 20:28:42
【问题描述】:

我使用下面的代码从SoapUI 的请求中获取JSESSIONID 的值。

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 作为响应。所以我失去了会话,因为打开了一个新会话。

【问题讨论】:

    标签: http soapui session-cookies jsessionid


    【解决方案1】:

    您可能已经在Sending cookie as request header in SOAP UI request for rest web service 遇到过类似问题的描述。

    除此之外,您还需要在测试用例的选项中设置Maintain HTTP session

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-05
      • 2011-11-04
      相关资源
      最近更新 更多