我正在尝试计算Jmeter中响应的出现次数,如果计数不等于4,则测试应该失败。
我该怎么做?
我在beanshell断言中使用了这个:
Import org.apache.commons.lang3.StringUtils;
int matches = StringUtils.countMatches(new String(data), "itemname");
vars.put("ItemNameVar_matchNr", String.valueOf(matches));
assert matches == 5;
它。不管用。它显示错误:
类型变量声明:未定义的参数:data
答案 0 :(得分:1)
sqlite> select s61.station,
...> (select count()+1 from (select station,avg(dayobs.ave_temp)/10 as t61,sum(dayobs.rain)/10 as r61 from dayobs where month=5 and year>=2015 and days>=1 and days<=15 group by station,year) as r where r.t61 > s61.t61 and s61.station==r.station) as rantk_t
...> from (select station,avg(dayobs.ave_temp)/10 as t61,sum(dayobs.rain)/10 as r61 from dayobs where month=5 and year>=2015 and days>=1 and days<=15 group by station,year) as s61;
Error: misuse of aggregate: avg()
,有一个预定义的变量select s61.station,s61.year,
(select count()+1 from tt as r group by year having r.t61 > s61.t61 and s61.station==r.station) as rantk_t
from (select station,year,avg(dayobs.ave_temp)/10 as t61,sum(dayobs.rain)/10 as r61 from dayobs where month=5 and year>=2015 and days>=1 and days<=15 group by station,year) as s61;
,它是字节数组。 您在Beanshell中没有data
,您有ResponseData
预先定义的布尔值,表示范围内的采样器是否应该成功。
完整代码:
assert
参考文献: