您可以使用JMeter的属性而不是变量,通过jmeter functions或BeanShell的代码访问:
${__P(whileCondition,)}
${__setProperty(whileCondition,TRUE,)}
${__BeanShell(props.get("whileCondition")}
${__BeanShell(props.set("whileCondition")}
您可以尝试使用类似如下结构:
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
. . .
我想你也可以轻松使用附加到的BSF或BeanShell PostProcessor您的HTTP请求将txtFound属性设置为TRUE,而不是使用IF进行繁琐的构建。
[得到了答案?](http://stackoverflow.com/faq#howtoask) – 2012-09-08 11:02:13