如何从 JSR223/Beanshell 读取 JMeter 测试命令行参数

How to read JMeter Test Cmd Line Parameters from JSR223/Beanshell

我写了一个 JMeter 测试,我想在命令行中 运行 它带有一些参数,比方说 ThreadNumber。

如何在 JSR223/BeanShell 中阅读它?

使用 -J 在命令行中发送 属性,这会添加新的 属性

 -JthreadNum=100

Thread Group use the value using __P function 内用户数(线程)字段

 ${__P(threadNum)}

simplified property function which is intended for use with properties defined on the command line.

使用props获得JSR223/BeanShell

中的财产
  props.get("threadNum")
  • 请注意,您可以将 ramp up 设置为与线程数相同 属性

Start with Ramp-up = number of threads and adjust up or down as needed.