jmeter升級(實戰)

1,取查詢結果最後一頁。注意:查詢最後一頁在併發的時候會有問題。 可能是倒數第一頁,也可能是倒數第二頁,這樣這個功能就不好用了。 

image.png

Integer recordCounts = Integer.valueOf( vars.get("recordCount"));

if(recordCounts%5 == 0 ){

vars.put("newrecordCounts",recordCounts.toString());

}else{

recordCounts=recordCounts/5+1;

          vars.put("newrecordCounts",recordCounts.toString());

     }


2,根據唯一值取在數組中的位置,然後根據這個位置取其他數組的值。 

image.png

int i=1;

String strtemplateId = vars.get("templateId");

int counttm = Integer.parseInt(vars.get("templateIds_matchNr"));

for(i=counttm;i<=counttm;i--){

String strtemplateIds = vars.get("templateIds_" + i.toString());

if(strtemplateIds.equals(strtemplateId)){

String newmainId = vars.get("mainIds_" + i.toString());

vars.put("newmainIds",newmainId);

          break; 

}

}

























發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章