gpt4 book ai didi

controller - JMeter Controller

转载 作者:行者123 更新时间:2023-12-04 02:13:51 29 4
gpt4 key购买 nike

我已经疯狂地在整个网络上搜索解决我的问题的方法,但目前还没有。我的问题是我必须检查是否在 HTTP 请求中获得特定文本,该请求在一个 while 循环中,如果我这样做了,那么我应该离开循环并继续线程,或者如果文本不存在则完全停止线程.我设置如下:

Thread Group
.. While controller
.. HTTP request
.. Response Assertion
Listener

我在 while Controller 中使用了 LAST,并将 HTTP 响应设置为假文本,但它不起作用。

最佳答案

希望以下对您有用:

Thread Group    HTTP Request    //set-found-condition    ${__setProperty(txtFound,FALSE,)}    While Controller    // invert value in condition - will be executed while txtFound == FALSE    Condition = ${__BeanShell(!props.get("txtFound")}    . . .    [execute your test logic here]    . . .    YOUR HTTP Request        Response Assertion        // set your text assertion here        // this will results in ${JMeterThread.last_sample_ok} = TRUE if text found    IF Controller    --FOUND    // if text found set separate variable or property - e.g. ${txtFound} - into TRUE    Condition = ${JMeterThread.last_sample_ok}        HTTP Request         //set-found-condition        ${__setProperty(txtFound,TRUE,)}  // this will be inverted to FALSE in the next WHILE cycle's condition, WHILE cycle will be exited    . . .

我想您也可以轻松使用 JSR / BSF / BeanShell PostProcessor附加到 YOUR HTTP Request 以将 txtFound 属性设置为 TRUE,而不是使用 IF 进行繁琐的构造。

关于controller - JMeter Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7886132/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com