简体   繁体   English

具有动态信息内容的Jmeter JMS点对点

[英]Jmeter JMS point-to-point with dynamic messgae content

I am new to jmeter. 我是jmeter的新手。 I am trying to setup JMS point-to-point load test script. 我正在尝试设置JMS点对点负载测试脚本。 The request message is a fixed-length format. 请求消息是固定长度格式。 I need a way to read fields from csv and arrange them in fixed-length format. 我需要一种从csv读取字段并将它们以固定长度格式排列的方法。 I tried using javascript slice function by using csv data config variables and slicing to required length, concating them all in one line. 我尝试通过使用csv数据配置变量并切片为所需的长度,将它们全部隐藏在一行中来使用javascript slice函数。 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. 其中Var1,Var2..Var4来自CSV。

Jmeter version:3.3 Jmeter版本:3.3

MQ: IBM Websphere MQ 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. 我需要从csv和/或日期/时间函数动态填充值,并以固定长度格式排列它们。

  1. You have a typo in your code, the function should be __javaScript (mind the capital S 您的代码中有错字,该函数应为__javaScript (注意大写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. 您的方法应该可行,但是使用JavaScript的效率极低,因为每次调用__javaScript()函数时, JMeter都会调用Rhino或Nashorn解释器,这可能会在高负载的情况下破坏测试。 Since JMeter 3.1 users are encouraged to use __groovy() function for scripting. 从JMeter 3.1开始,鼓励用户使用__groovy()函数进行脚本编写。
  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. 最后但并非最不重要的一点,为了获得最佳性能,我建议使用__substring()函数而不是slice()函数。 You can install __substring() and other Custom JMeter Functions using JMeter Plugins Manager 您可以使用JMeter Plugins Manager安装__substring()和其他自定义JMeter函数

    JMeter自定义功能插件管理器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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