我想完成使用JMeter的JMeter的循環,直到響應值變化
- 獲取從URL調用的結果下面的工作流程(例如:http://somewhere.com/getResults)
- 如果響應消息中包含「someVar =成功的「JMeter測試將通過
- 否則如果響應消息包含‘someVar = FAIL’JMeter的測試將失敗
- 否則,如果所述響應消息不同的是,等待x秒,並再次嘗試的代碼塊。嘗試最多重試y次的代碼塊。
在JMeter中是這樣的可能嗎?如果是這樣,有沒有人有一個例子?
我想完成使用JMeter的JMeter的循環,直到響應值變化
在JMeter中是這樣的可能嗎?如果是這樣,有沒有人有一個例子?
最簡單的方法是使用JMeter Assertions。
其中最強大的是Beanshell Assertion。
在問候以下代碼示例用例可以幫助:
if new String(data).contains("someVar=SUCCESS")
Failure = false;
else
Failure = true;
同樣爲FAIL
重試,你可以使用一些變量像被設置爲true
continue
條件使用While Controller。根據需要重試多次,當你沒問題時 - 只需將continue
變量設置爲false
即可。
是的,這是很有可能的。
我沒有示例,但下面是您需要的組件。 邏輯應該是直截了當:
HTTP取樣
http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request
斷言(這將提高用戶定義的錯誤)
http://jmeter.apache.org/usermanual/component_reference.html#assertions
雖然控制器
http://jmeter.apache.org/usermanual/component_reference.html#While_Controller
正則表達式中JMeter(物品)
http://community.blazemeter.com/knowledgebase/articles/65150-using-regex-regular-expression-extractor-with-jm
用戶定義Vaiables(文章)
http://blazemeter.com/blog/afternoon-delightuser-defined-variablesavoid-code-duplication
在鏈接的情況下使用WHILE循環腐蝕提供的鏈接詳細信息。在循環外部設置用戶定義的變量,在WHILE條件中使用該變量,然後使用beanshell取樣器根據響應設置變量。 – ScottJShea
是。並添加錯誤消息以通知問題是什麼以及在哪裏是這樣的:FailureMessage =「Thread:」+ ctx.getThreadGroup()。getName()+「someVar:」+ data; –