JMeter虽然控制器 [英] JMeter While Controller
问题描述
我已经搜索了疯狂的解决方案,我的问题在整个网络,但还没有存在。我的问题是,我必须检查,如果我获得特定的文本在HTTP请求,这是在一个while循环,如果我做,然后我应该离开循环,继续线程或停止线程完全如果文本不存在。我设置如下:
I have searched as crazy for the solution to my problem throughout the web, but none exist yet. My problem is that I have to check if I get specific text in HTTP request, which is in a while loop and if I do, then I should leave the loop and continue with the thread or stop the thread completely if text doesn't exist. I have set it up as follows:
Thread Group
.. While controller
.. HTTP request
.. Response Assertion
Listener
我在while控制器中使用LAST,
I used LAST in the while controller and set HTTP response to false text and it doesn't work.
推荐答案
希望下面的一个能为你工作:
Hope the following one will work for you:
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
. . .
我想你也可以很容易地使用附加到您的HTTP请求的JSR / BSF / BeanShell PostProcessor ,将 txtFound
属性设置为TRUE的繁琐施工与IF。
I think you may also easily use JSR / BSF / BeanShell PostProcessor attached to YOUR HTTP Request to set txtFound
property into TRUE instead of cumbersome construction with IF.
这篇关于JMeter虽然控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!