Jmeter XMPP消息信息

问题描述 投票:0回答:1

我使用Jmeter和XMPP插件以及openfire(作为我的服务器)设置了测试计划。当我为每个测试运行我的测试(使用Jmeter GUI)时:XMPP收集包示例我得到一个响应数据作为收到的数据包以及数据包本身,我需要获得subSample结果。

在BeanShell采样器我有

import org.apache.jmeter.samplers.SampleResult;

System.out.println( "myData-->"+SampleResult subResult : 
SampleResult.getSubResults());

我一直收到这个错误:

 Typed variable declaration : Cannot reach instance method: getSubResults() from static context: org.apache.jmeter.samplers.SampleResult

从GUI点击来自collectPackage采样器本身的消息后,我看到:

<message id='Q93Ww-102' to='user0@n-dev-xyz' from='user0@n-dev-xyz/jmeter'><body>Hello, it&apos;s user1</body></message>

enter image description here

jmeter xmpp
1个回答
0
投票
  1. 您无法从Beanshell Sampler本身执行此操作,以便能够使用您需要的XMPP Sampler子结果: 添加Beanshell后处理器作为XMPP采样器的子级。您将能够使用prev简写访问父采样器结果,如: SampleResult [] subResults = prev.getSubResults(); 如果您仍想使用Beanshell Sampler,则需要将其放在XMPP Sampler之后,并使用ctx速记来访问以前的采样器结果,如: SampleResult [] subResults = ctx.getPreviousResult().getSubResults();
  2. 请注意starting from JMeter 3.1 it is strongly recommended to use JSR223 Test Elements and Groovy language用于任何形式的脚本主要是因为Groovy performance is much better comparing to Beanshell所以我建议在下一个可用机会上迁移到JSR223 Post-Processor和Groovy。
© www.soinside.com 2019 - 2024. All rights reserved.