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 Answers
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)