【发布时间】:2018-04-27 09:12:38
【问题描述】:
如何在每个采样器上不使用后处理器的情况下获得 JMeter 线程组的总体通过/失败结果?
我尝试使用 beanshell 侦听器,但它不适用于启用“生成父样本”的事务控制器内有多个采样器的情况。在这种情况下,每个事务控制器只会调用一次侦听器,而我只能访问事务控制器内最后一个采样器的结果。
编辑:
我希望能够将通过/失败值保存为线程组的 Jmeter 变量或属性。如果线程组的一个或多个组件失败或返回错误,那么这将是一个整体失败。然后,此变量将用于报告目的。
我当前的 beanshell 监听代码:
SampleResult sr = ctx.getPreviousResult();
log.info(Boolean.toString(sr.isSuccessful()));
if (!sr.isSuccessful()){
props.put("testPlanResult", "FAIL");
testPlanResultComment = props.get("testPlanResultComment");
if(testPlanResultComment == ""){
testPlanResultComment = sr.getSampleLabel();
}else {
testPlanResultComment = testPlanResultComment + ", " + sr.getSampleLabel();
}
props.put("testPlanResultComment", testPlanResultComment);
log.info(testPlanResultComment);
}
【问题讨论】:
-
请提供更多信息/图表/图片/代码,说明您正在尝试什么以及您希望它是什么样的。总体通过/失败不是很清楚。
标签: jmeter performance-testing