如何在Gatling中正确关联SAML标头响应

问题描述 投票:0回答:1

我希望自动化包含SAML身份验证登录的性能测试。

我为这份工作选择的工具是加特林,但我对这个工具还不熟悉。

现在我遇到的问题是我的脚本不会从响应头获取SAML响应。

    .exec(http("request_6")
        .post("/isam/sps/AD_Europe_SAM_SP/saml20/login")
        .headers(headers_6)
        .check(headerRegex("SAMLResponse", "SAMLResponse=(.*)").saveAs("saml_response"))
        .formParam("RelayState", "uuide0a0e23c-0168-1aea-bfd3-b405d391f0ea")
        .formParam("SAMLResponse", Seq("""${saml_response}""").mkString))

我希望这可以完成工作并从标题中获取SAMLResponse。但它返回的是以下错误:

request_6:无法构建请求:未定义名为“saml_response”的属性。

我试图关联的SAML响应位于标题的表单数据部分。

如果有人可以帮我弄清楚如何捕获这个标题值,那将非常感激。

saml correlation gatling
1个回答
0
投票

我发现我在错误的请求(POST)中寻找SAML响应而不是预期的请求(GET)

当我添加提取代码行时:

.check(headerRegex("SAMLResponse", "SAMLResponse=(.*)").saveAs("saml_response"))

对于正确的响应(GET请求),问题已得到解决。

© www.soinside.com 2019 - 2024. All rights reserved.