jmeter二次開發準備
阿新 • • 發佈:2019-02-11
無意中看到了一直想開始的二開,苦於無法開始.
部落格上無意看到api參考文件,我才能接觸到.
apache jmeter api: sort by classname
包含所有jmeter中執行所有類 api介紹-->方法 屬性 方法 依賴
參考的網站:
資源:http://download.csdn.net/download/t694728793/10031728
Bean Shell常用內建變數
JMeter在它的BeanShell中內建了變數,使用者可以通過這些變數與JMeter進行互動,其中主要的變數及其使用方法如下:
-
log:寫入資訊到jmeber.log檔案,使用方法:log.info(“This is log info!”);
-
vars - (JMeterVariables):操作jmeter變數,這個變數實際引用了JMeter執行緒中的區域性變數容器(本質上是Map),它是測試用例與BeanShell互動的橋樑,常用方法:
a) vars.get(String key):從jmeter中獲得變數值
b) vars.put(String key,String value):資料存到jmeter變數中
-
props - (JMeterProperties - class java.util.Properties):操作jmeter屬性,該變數引用了JMeter的配置資訊,可以獲取Jmeter的屬性,它的使用方法與vars類似,但是隻能put進去String型別的值,而不能是一個物件。對應於java.util.Properties。
a) props.get("START.HMS"); 注:START.HMS為屬性名,在檔案jmeter.properties中定義
b) props.put("PROP1","1234");
-
prev - (SampleResult):獲取前面的sample返回的資訊,常用方法:
a) getResponseDataAsString():獲取響應資訊
b) getResponseCode() :獲取響應code
- sampler - (Sampler):gives access to the current sampler
檢視jmeter控制元件的類名 api 檢視具體可用資訊 |
需知 日誌級別 (圖片被吞了 檢視我的資源) http://download.csdn.net/download/t694728793/10031728 檢視實時執行 日誌 |
jmeter的可程式設計控制元件
|