如何获取包含三个请求的事务控制器的名称和其他属性?

How can I get name and other properties of transaction controller which consist of three requests?

我的脚本结构如下所示:

交易控制器正在搜索报价交易

Beanshell 后处理器

哪个 BeanShell 命令可以让我获取整个事务的名称、响应代码、响应时间、测试结果和测试时间?

我应该在哪里附加 BeanShell 后处理器? 我应该使用哪个代码,但在我看来

字符串名称=sampler.getName();

对我来说工作不正常。

IMO 你应该使用 BeanShell Listener 而不是 Beanshell PostProcessor。 Listener 可以位于当前 Beanshell PostProcessor 所在的同一位置。该对象可以访问 sampleResult,其中包含响应代码/响应时间等,例如:

sampleResult.getSampleLabel(); // the name, e.g. 'SEARCHING OFFERS Transaction'

SampleResult 函数的完整列表是 here 如果您只想在此侦听器中处理交易,您可以过滤它们(例如按名称)。