使用加特林性能测试工具的关联问题



我是加特林的新手从过去 5 天开始,我正在尝试捕获以下请求,但我无法关联以下"sesskey",它将在整个流程中使用:

.feed(feeder)
    .exec(http("request_2")
        .post("/login/index.php")
        .headers(headers_0)
        .formParam("username", "${username}")
        .formParam("password", "${password}")
        .formParam("anchor", "")
        .resources(http("request_3")
        .get("/theme/image.php/clean/core/1468244430/t/block_to_dock"),
        http("request_4")
    .get("/lib/javascript.php/1468244430/blocks/course_overview/module.js"),
        http("request_5")
        .get("/theme/image.php/clean/core/1468244430/t/collapsed"),
        http("request_6")
        .get("/theme/image.php/clean/core/1468244430/t/expanded"),
        http("request_7")
        .get("/lib/requirejs.php/1468244430/core/first.js"),
        http("request_8")
        .get("/theme/yui_combo.php?3.17.2/anim-base/anim-base.js&3.17.2/anim-color/anim-color.js&3.17.2/anim-xy/anim-xy.js&3.17.2/anim-curve/anim-curve.js&3.17.2/anim-easing/anim-easing.js&3.17.2/anim-node-plugin/anim-node-plugin.js&3.17.2/anim-scroll/anim-scroll.js"),
        http("request_9")
        .get("/lib/javascript.php/1468244430/lib/requirejs/jquery-private.js"),
        http("request_10")
        .get("/theme/yui_combo.php?3.17.2/cssbutton/cssbutton-min.css")
        .headers(headers_10),
        http("request_11")
        .get("/lib/javascript.php/1468244430/lib/jquery/jquery-1.12.1.min.js"),
        http("request_12")
        .get("/theme/yui_combo.php?3.17.2/handlebars-base/handlebars-base.js&3.17.2/handlebars-compiler/handlebars-compiler.js&m/1468244430/core/handlebars/handlebars-debug.js&3.17.2/plugin/plugin.js&m/1468244430/core/lockscroll/lockscroll-debug.js&m/1468244430/core/notification/notification-ajaxexception-debug.js&m/1468244430/core/notification/notification-alert-debug.js&m/1468244430/core/notification/notification-exception-debug.js&m/1468244430/core_message/messenger/messenger-debug.js"),
        http("request_13")
        .get("/theme/yui_combo.php?m/1468244430/calendar/info/info.css")
        .headers(headers_10),
        http("request_14")
        .get("/theme/yui_combo.php?m/1468244430/calendar/info/info-debug.js"),
        http("request_15")
        .post("/lib/ajax/service.php?sesskey=LuyCPEUwdm")
        .headers(headers_1)
        .body(RawFileBody("MoodleViewPageV01_0015_request.txt")),
        http("request_16")
        .get("/theme/yui_combo.php?m/1468244430/core/formautosubmit/formautosubmit-debug.js"),
        http("request_17")
        .get("/theme/yui_combo.php?3.17.2/event-mousewheel/event-mousewheel.js&3.17.2/event-resize/event-resize.js&3.17.2/event-hover/event-hover.js&3.17.2/event-touch/event-touch.js&3.17.2/event-move/event-move.js&3.17.2/event-flick/event-flick.js&3.17.2/event-valuechange/event-valuechange.js&3.17.2/event-tap/event-tap.js&3.17.2/event-simulate/event-simulate.js&3.17.2/async-queue/async-queue.js&3.17.2/gesture-simulate/gesture-simulate.js&3.17.2/node-event-simulate/node-event-simulate.js&m/1468244430/core/actionmenu/actionmenu-debug.js"),
        http("request_18")
        .get("/theme/image.php/clean/core/1468244430/t/switch_minus"),
        http("request_19")
        .get("/theme/image.php/clean/core/1468244430/t/switch_plus")))

在上面的请求中,Request_15您将获得.post("/lib/ajax/service.php?sesskey=LuyCPEUwdm")的位置,我想捕获 sesskey 值LuyCPEUwdm在我的方案中将多次使用。

我应该如何捕获该密钥?

请帮忙珍惜你的时间:)

我得到了答案。

在这里,当您要使用录音机录制脚本时,那里...您需要选择"保存并检查响应正文?"选项,然后进行录制

因此,录制完成后,您的回复将存储在"..\gatling-charts-highcharts-bundle-2.2.2\user-files\body"路径

因此,您可以将脚本的场景与响应正文文件进行比较,并根据响应正文文件中捕获的值将该值关联起来

最新更新