使用Gatling Performance Testing工具进行关联问题

时间:2016-07-13 07:18:35

标签: correlation gatling

我是Gatling的新手 从过去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

我应该如何捕获该密钥?

请帮忙 感谢您的时间:)

1 个答案:

答案 0 :(得分:0)

我得到了答案。

在这里,当你要使用录音机录制剧本时,有......你需要选择"保存&检查响应机构?"选项,然后去录制

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

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