Banjo
Banjo

Reputation: 91

Error while installing ruby jmeter script

Im tying to install a jmeter script bases on steps @ https://github.com/flood-io/ruby-jmeter

Its a windows PC with ruby and ruby-jmeter installed

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

test do
  threads count: 1 do
    visit name: 'Home Page', url: 'http://altentee.com/' do
      duration_assertion duration: 10
    end

    # write to an assertion results listener, errors only
    assertion_results filename: '/var/log/flood/custom/assertion.log',
      error_logging: true,
      update_at_xpath: [
        { '//xml' => 'true' },
        { '//assertions' => 'true' }
      ]
  end
end.run(path: '/usr/share/jmeter/bin/', gui: true)

Error Im getting

C:/momento/momento_performance_test/lib/ruby-jmeter/extend/threads/thread_group.rb:5: warning: constant ::Fixnum is deprecated
C:/Ruby25-x64/lib/ruby/2.5.0/open3.rb:199:in `spawn': No such file or directory - /usr/share/jmeter/bin/jmeter  -t ruby-jmeter.jmx -j jmeter.log -l jmeter.jtl  (Errno::ENOENT)
        from C:/Ruby25-x64/lib/ruby/2.5.0/open3.rb:199:in `popen_run'
        from C:/Ruby25-x64/lib/ruby/2.5.0/open3.rb:190:in `popen2e'
        from C:/momento/momento_performance_test/lib/ruby-jmeter/dsl.rb:43:in `run'
        from assertion_results.rb:18:in `<main>'
W, [2020-03-09T11:59:45.175528 #13404]  WARN -- : Test executing locally ...

Upvotes: 0

Views: 146

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

Given you're on Windows and you're copying and pasting the instructions from the aforementioned page:

test do
threads count: 10 do
visit name: 'Google Search', url: 'http://google.com'
end
end.run(
        path: '/usr/share/jmeter/bin/',
        file: 'jmeter.jmx',
        log: 'jmeter.log',
        jtl: 'results.jtl',
        properties: 'jmeter.properties')

You need to amend this line:

path: '/usr/share/jmeter/bin/',

to point to the "bin" folder of your JMeter installation on Windows like:

path: 'c:/apps/jmeter/bin',

or wherever you have JMeter installed


If you're looking for a way of programmatically creating JMeter tests you might find Taurus tool easier, it provides possibility to create JMeter tests declaratively using simple YAML syntax. Check out Taurus: A New Star in the Test Automation Tools Constellation article for more details.

Upvotes: 0

Related Questions