JMeter中多个线程组之间的依赖关系 [英] Dependency among multiple thread groups in JMeter

查看:829
本文介绍了JMeter中多个线程组之间的依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了具有多个线程组的负载测试计划,即-

I have set up a load test plan with multiple thread group, i.e. -

  • 注册(线程的50%)
  • 下订单(线程的10%)
  • 更多操作(其余线程)

在这里,如果注册线程未成功执行,而不是我不想执行其余线程组.对于单线程组,我可以使用if controller并在一个样本失败的情况下丢弃样本,但是当我使用多个线程组时如何实现呢?

Herein if Registration thread does not succeeds than I don't want to execute remaining thread groups. In case of a single thread group I can use if controller and discard samples if one sample fails but how do I achieve it when I am using multiple thread groups.

推荐答案

如果要基于其他线程组中设置的条件使用If Controller,则JMeter变量范围仅限于当前线程组.而是使用JMeter属性(JMeter属性范围对于整个JVM是全局的).请参见如何在有关不同的线程组的文章,详细介绍了将JMeter变量转换为JMeter属性的方法.

JMeter Variables scope is limited to current Thread Group only, if you want to use If Controller basing on the condition which is set in another Thread Group - you should be using JMeter Properties instead (JMeter Properties scope is global for the whole JVM). See How to Use Variables in Different Thread Groups article for details on converting JMeter Variables into JMeter Properties.

您可能还会发现 InterThread Communication 插件在使用时很有用涉及在线程组之间传递数据和建立依赖关系.

You may also find InterThread Communication plugins useful when it comes to passing data between thread groups and setting up dependencies.

但是,鉴于您的情况,您要么需要传递整个线程上下文(cookie,缓存等),否则可能会比较棘手,因此将所有采样器置于同一线程组下并使用加权开关控制器,无论哪种方式都最适合您的情况.请参阅运行具有已定义百分比概率的JMeter采样器指南更多信息.

However, given your scenario you either need to pass the whole thread context (cookies, cache, whatever) which might be tricky so it would be much better putting all the samplers under the same Thread Group and use Throughput Controller, Switch Controller or Weighted Switch Controller, whatever matches your scenario the closest way. See Running JMeter Samplers with Defined Percentage Probability guide for more information.

这篇关于JMeter中多个线程组之间的依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆