1
votes

We have a BDD framework built in Selenium + Cucumber + Ruby which we use for functional testing. Is it possible to integrate JMeter with these scripts ?

1
What do you mean by integrating? Are you referring to calling the '.jmx' file from Ruby?Bala
no we don't want to create.jmx files, By integrating I mean we want to use our existing selenium functional testcases for load test.Sonu Mehta
I don't think this is a valid use of cucumber/ruby/selenium. This whole setup is meant to imitate a real user and so should wait for the page to load etc etc. With load testing you can end up blatting huge amounts of information through which would be unrealistic for a real user to achieve.yesiamtom

1 Answers

1
votes

Have you tried ruby-jmeter gem? It should be as simple as follows:

test do
  threads count: 10 do
    visit name: 'Example Domain', url: 'http://example.com'
  end
end.run(
  path: 'c:/JMeter/bin/',
  file: 'test.jmx',
  log: 'jmeter.log',
  jtl: 'test.jtl')

If you don't have possibility to install/use jmeter-ruby gem JMeter is Java-based application so Cucumber full integration isn't something you can easily get (unless you're using Cucumber-JVM but it is still possible

JMeter can be launched as a command-line non-GUI application just like any other external command from Ruby as follows:

`jmeter -n -t /path/to/script.jmx -l /path/to/results.jtl`

or

%x(jmeter -n -t /path/to/script.jmx -l /path/to/results.jtl)

You can switch JMeter results format to xml (it defaults to CSV) and parse XML results to define pass/fail criteria. Results output format is controlled via jmeter.save.saveservice.output_format property which can be uncommented and set in jmeter.properties file, overriden in user.properties file (both live under /bin folder of your JMeter installation) or provided as a command-line argument via -J key as

%x(jmeter -Jjmeter.save.saveservice.output_format=xml -n -t /path/to/script.jmx -l /path/to/results.jtl)