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

淺唱寂寞╮ 提交于 2021-02-08 07:29:33

问题


I have wrote a JMeter test and I want to run it in Command Line with some parameters, let's say ThreadNumber.

How do I read it in JSR223/BeanShell?


回答1:


Send property in command line using -J which adds new property

 -JthreadNum=100

Inside Thread Group use the value using __P function in Number of Users(threads) field

 ${__P(threadNum)}

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

Use props to get properry in JSR223/BeanShell

  props.get("threadNum")
  • Note you may set ramp up same as thread number property

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



来源:https://stackoverflow.com/questions/50222816/how-to-read-jmeter-test-cmd-line-parameters-from-jsr223-beanshell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!