我想安装一个基于steps @ https://github.com/flood-io/ruby-jmeter的jmeter脚本
它是一台装有ruby和ruby-jmeter的windows电脑。
$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)获取时出错
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 ...发布于 2020-03-09 17:09:40
假设你用的是Windows而且你是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')您需要修改这一行:
path: '/usr/share/jmeter/bin/',指向Windows上JMeter安装的"bin“文件夹,如下所示:
path: 'c:/apps/jmeter/bin',或安装了JMeter的任何位置
如果您正在寻找一种以编程方式创建JMeter测试的方法,您可能会发现Taurus工具更简单,它提供了使用简单的YAML syntax进行create JMeter tests declaratively的可能性。有关更多详细信息,请查看Taurus: A New Star in the Test Automation Tools Constellation文章。
https://stackoverflow.com/questions/60593545
复制相似问题