ruby-jmeter 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/ruby-jmeter/dsl.rb +9 -1
- data/lib/ruby-jmeter/dsl/constant_throughput_timer.rb +1 -5
- data/lib/ruby-jmeter/extend/misc/flood.rb +1 -1
- data/lib/ruby-jmeter/extend/timers/constant_throughput_timer.rb +1 -2
- data/lib/ruby-jmeter/idl.xml +1 -5
- data/lib/ruby-jmeter/version.rb +1 -1
- data/spec/constant_throughput_timer_spec.rb +3 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f7e301f7230400fc1209e14de0cab9a9c598870
|
4
|
+
data.tar.gz: 2c2dd6207bc2ef9109b94dbaef2bc7dbedcaa10c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 979db78c9a2b2dde3d6286f31f6af42b8bad9a29b219d9ec50007f25ebcb580fb653add14979edb2a13cf9f37649ecb4970c8c8f74a75fc2446501fe51e11f3a
|
7
|
+
data.tar.gz: 117c2a81ebb929b0ebb72e236d40091e8fdebf26090c6a281fae341a10c4341aac7d9cf7109d4b8ce0fc336d8d1eb5c9cb7906e1931572e76425441010c1a0bb
|
data/README.md
CHANGED
@@ -86,7 +86,7 @@ test do
|
|
86
86
|
end.run
|
87
87
|
```
|
88
88
|
|
89
|
-
This will launch JMeter in headless (non-GUI mode) and execute the test plan. This is useful for shaking out the script before you push it to the Grid. There are a few parameters that you can set such as the `path` to the JMeter binary, the `file` path/name for the JMX file, the `log` path/name to output JMeter logs
|
89
|
+
This will launch JMeter in headless (non-GUI mode) and execute the test plan. This is useful for shaking out the script before you push it to the Grid. There are a few parameters that you can set such as the `path` to the JMeter binary, the `file` path/name for the JMX file, the `log` path/name to output JMeter logs, the `jtl` path/name for JMeter results like this, and the `properties` path/name for the additional JMeter property file.
|
90
90
|
|
91
91
|
```ruby
|
92
92
|
test do
|
@@ -97,7 +97,8 @@ end.run(
|
|
97
97
|
path: '/usr/share/jmeter/bin/',
|
98
98
|
file: 'jmeter.jmx',
|
99
99
|
log: 'jmeter.log',
|
100
|
-
jtl: 'results.jtl'
|
100
|
+
jtl: 'results.jtl',
|
101
|
+
properties: 'jmeter.properties')
|
101
102
|
```
|
102
103
|
|
103
104
|
### Running a JMeter Test Plan on Flood IO
|
data/lib/ruby-jmeter/dsl.rb
CHANGED
@@ -38,7 +38,7 @@ module RubyJmeter
|
|
38
38
|
file(params)
|
39
39
|
logger.warn 'Test executing locally ...'
|
40
40
|
|
41
|
-
cmd = "#{params[:path]
|
41
|
+
cmd = "#{params[:path] ? File.join(params[:path], 'jmeter') : 'jmeter'} #{"-n" unless params[:gui] } -t #{params[:file]} -j #{params[:log] ? params[:log] : 'jmeter.log' } -l #{params[:jtl] ? params[:jtl] : 'jmeter.jtl' } #{build_properties(params[:properties]) if params[:properties]}"
|
42
42
|
logger.debug cmd if params[:debug]
|
43
43
|
Open3.popen2e("#{cmd}") do |stdin, stdout_err, wait_thr|
|
44
44
|
while line = stdout_err.gets
|
@@ -81,6 +81,14 @@ module RubyJmeter
|
|
81
81
|
Nokogiri::XML(@root.to_s, &:noblanks)
|
82
82
|
end
|
83
83
|
|
84
|
+
def build_properties(properties)
|
85
|
+
if properties.kind_of?(String)
|
86
|
+
"-q #{properties}"
|
87
|
+
elsif properties.kind_of?(Hash)
|
88
|
+
properties.map{ |k,v| "-J#{k}=#{v}" }.join(" ")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
84
92
|
def logger
|
85
93
|
@log ||= Logger.new(STDOUT)
|
86
94
|
@log.level = Logger::DEBUG
|
@@ -15,11 +15,7 @@ module RubyJmeter
|
|
15
15
|
@doc = Nokogiri::XML(<<-EOS.strip_heredoc)
|
16
16
|
<ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="#{testname}" enabled="true">
|
17
17
|
<intProp name="calcMode">0</intProp>
|
18
|
-
<
|
19
|
-
<name>throughput</name>
|
20
|
-
<value>0.0</value>
|
21
|
-
<savedValue>0.0</savedValue>
|
22
|
-
</doubleProp>
|
18
|
+
<stringProp name="throughput">0.0</stringProp>
|
23
19
|
</ConstantThroughputTimer>)
|
24
20
|
EOS
|
25
21
|
update params
|
@@ -43,7 +43,7 @@ module RubyJmeter
|
|
43
43
|
logger.fatal "Sorry there was an error: #{JSON.parse(response)["error"]}"
|
44
44
|
end
|
45
45
|
rescue => e
|
46
|
-
logger.fatal "Sorry there was an error: #{
|
46
|
+
logger.fatal "Sorry there was an error: #{e}"
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -4,8 +4,7 @@ module RubyJmeter
|
|
4
4
|
params[:value] ||= params[:throughput] || 0.0
|
5
5
|
|
6
6
|
node = RubyJmeter::ConstantThroughputTimer.new(params)
|
7
|
-
node.doc.xpath('
|
8
|
-
|
7
|
+
node.doc.xpath('//stringProp[@name="throughput"]').first.content = params[:value]
|
9
8
|
attach_node(node, &block)
|
10
9
|
end
|
11
10
|
end
|
data/lib/ruby-jmeter/idl.xml
CHANGED
@@ -340,11 +340,7 @@
|
|
340
340
|
<hashTree/>
|
341
341
|
<ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="Constant Throughput Timer" enabled="true">
|
342
342
|
<intProp name="calcMode">0</intProp>
|
343
|
-
<
|
344
|
-
<name>throughput</name>
|
345
|
-
<value>0.0</value>
|
346
|
-
<savedValue>0.0</savedValue>
|
347
|
-
</doubleProp>
|
343
|
+
<stringProp name="throughput">0.0</stringProp>
|
348
344
|
</ConstantThroughputTimer>
|
349
345
|
<hashTree/>
|
350
346
|
<ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true">
|
data/lib/ruby-jmeter/version.rb
CHANGED
@@ -10,13 +10,11 @@ describe 'constant_throughput_timer' do
|
|
10
10
|
end.to_doc
|
11
11
|
end
|
12
12
|
|
13
|
-
let(:fragment) { doc.search("//ConstantThroughputTimer").first }
|
14
|
-
|
15
13
|
it 'should match on throughput using value' do
|
16
|
-
expect(
|
14
|
+
expect(doc.search('//ConstantThroughputTimer[1]/stringProp[@name="throughput"]').first.content).to eq '60.0'
|
17
15
|
end
|
18
|
-
|
16
|
+
|
19
17
|
it 'should match on throughput using throughput' do
|
20
|
-
expect(
|
18
|
+
expect(doc.search('//ConstantThroughputTimer[2]/stringProp[@name="throughput"]').first.content).to eq '70.0'
|
21
19
|
end
|
22
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-jmeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Koopmans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|