【问题标题】:JMeter number of threads (users) variable from CSV file not workingCSV文件中的JMeter线程数(用户)变量不起作用
【发布时间】:2021-09-29 14:54:08
【问题描述】:

我正在使用“CSV 数据集配置”组件从 CSV 文件中读取不同的参数。

我在 CSV 中添加了 threadCount 列。例如,它的值可能是 100。

然后我在“线程数(用户)”字段的“线程组”组件中使用变量 ${threadCount},运行报告时没有任何反应。

日志文件中有:

2021-09-29 09:34:19,704 DEBUG o.a.j.e.u.ValueReplacer: About to replace in property of type: class org.apache.jmeter.testelement.property.StringProperty: ${threadCount}
2021-09-29 09:34:19,704 DEBUG o.a.j.t.p.AbstractProperty: Not running version, return raw function string
2021-09-29 09:34:19,704 DEBUG o.a.j.e.u.ValueReplacer: Replacement result: ${threadCount}

如果我将 threadCount 变量添加到“用户定义的变量”组件中,则程序运行正常。

你能告诉我问题出在哪里吗?

【问题讨论】:

    标签: jmeter


    【解决方案1】:

    我认为您不能使用 CSV 数据集配置来配置线程组中的线程数,因为线程组是在处理 CSV 数据集配置之前初始化的。

    如果您想使线程数在外部可配置,您可以使用__P() function 来定义它

    ${__P(threadCount,)}
    

    完成后,您应该能够通过以下方式定义值:

    1. 通过 user.properties 文件,例如:

      threadCount=100
      
    2. 通过您的自定义 .properties 文件,方法相同,但您需要通过 -q 命令行参数将此文件传递给 JMeter

      jmeter -q /path/to/your/custom.properties file 
      
    3. 您可以通过-J 命令行参数覆盖该值,例如:

      jmeter -JthreadCount=100
      

    更多信息:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-13
      • 2014-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多