Sonu Mehta Sonu Mehta - 1 year ago 403
Ruby Question

Integrating JMeter with Cucumber+Ruby+Selenium framework

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 ?

Answer Source

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

test do
  threads count: 10 do
    visit name: 'Example Domain', url: ''
  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`


%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 property which can be uncommented and set in file, overriden in file (both live under /bin folder of your JMeter installation) or provided as a command-line argument via -J key as

%x(jmeter -n -t /path/to/script.jmx -l /path/to/results.jtl)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download