简体   繁体   中英

Jmeter JMS point-to-point with dynamic messgae content

I am new to jmeter. I am trying to setup JMS point-to-point load test script. The request message is a fixed-length format. I need a way to read fields from csv and arrange them in fixed-length format. I tried using javascript slice function by using csv data config variables and slicing to required length, concating them all in one line. But it is not working. May be my approach is wrong. Any pointers on how to make it work with fixed length format will help. This is what I tried:

${__javascript(("      ".slice(-6))+(("0000000000000000"+${Var2}).slice(-16)) + (("                   " + ${Var3}).slice(-19))+(("   "+${Var4}).slice(-3))}

where Var1,Var2..Var4 are from csv.

Jmeter version:3.3

MQ: IBM Websphere MQ

With a single input message I am able to execute the test. I need to dynamically populate values from csv and/or date/time functions and arrange them in fixed-length format.

  1. You have a typo in your code, the function should be __javaScript (mind the capital S
  2. Your approach should work, however using JavaScript is extremely inefficient as each time you call __javaScript() function JMeter invokes Rhino or Nashorn interpreter and this may ruin your test in case of high loads. Since JMeter 3.1 users are encouraged to use __groovy() function for scripting.
  3. And last but not the least, in order to get the most performance I would recommend using __substring() function instead of your slice() function. You can install __substring() and other Custom JMeter Functions using JMeter Plugins Manager

    JMeter自定义功能插件管理器

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM