0

I am writing a load test where in a post request i need to send a value that has unique id in the payload for each request.

We are using ruby-jmeter for performance testing. I see a lot of documents suggesting for jmeter but no mention of how to achieve the same in ruby-jmeter.

1 Answers1

0

Just use JMeter's UUID() function in the place where you need to send the unique ID, ruby-jmeter is nothing more than a wrapper hence it fully supports normal syntax for JMeter Functions and Variables

Here is an example in Ruby:

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'ruby-jmeter'

test do
  threads count: 1, loops: 5, scheduler: false do
    # Helper method to generate a single UUID per iteration
    uuid_per_iteration

    dummy_sampler name: '${__threadNum} - ${UUID}'
    dummy_sampler name: '${__threadNum} - ${UUID}'
    dummy_sampler name: '${__threadNum} - ${UUID}'

    view_results
  end
end.run(path: '/usr/local/share/jmeter-3.1/bin', gui: true)

More information on JMeter Functions concept: Apache JMeter Functions - An Introduction

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Tried this solution but getting FAILED !!! jmeter -n -t ruby-jmeter.jmx -j jmeter.log -l Reports/report-jmeter.jtl – Gowthaman Ravindran Mar 24 '21 at 11:51
  • Your `FAILED !!!` statement doesn't tell `ANYTHING !!!` to me, inspect [`JMETER.LOG!!!` file](https://jmeter.apache.org/usermanual/get-started.html#logging) and `REPORT-JMETER.JTL !!!` file to learn more about the `REASON !!!`, it might be the case you will need to install the [Dummy Sampler](https://www.blazemeter.com/blog/jmeters-dummy-sampler-the-ultimate-guide/) `PLUGIN !!!` – Dmitri T Mar 24 '21 at 12:06
  • Right on the nail ! I was missing the third party plugin for dummy_sampler. This worked like a charm. Thanks ! – Gowthaman Ravindran Mar 24 '21 at 18:19