ruby-jmeter 3.0.11 → 3.0.12
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/examples/flood.rb +1 -1
- data/examples/json_path_assertions.rb +2 -1
- data/lib/ruby-jmeter/extend/plugins/jmeter_plugins.rb +5 -0
- data/lib/ruby-jmeter/plugins/jmx_collector.rb +73 -0
- data/lib/ruby-jmeter/version.rb +1 -1
- data/spec/http_request_spec.rb +3 -3
- data/spec/jmeter_plugins_spec.rb +90 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d085f1b33ee976a6909d689a02e750894eeac44a
|
4
|
+
data.tar.gz: b2091b746d06be3eca4d45e40654370cf77fba40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10426d29a88b670f80e85cba4617db1fe5ae340650eecc2fd35c0ef265cd638e8cdef537bf4de523ac6cacfc925497f7c097be6cab574fa5ff5b1e0af8d7ac85
|
7
|
+
data.tar.gz: 2d83cdd235f8d9fd24be3b9f76374a28350d2474e25f02988031c8cc3393124b08aa6e2fd4f95026660b9be55fd730eddc683863cd3550b096e49b073e644f25
|
data/examples/flood.rb
CHANGED
@@ -4,7 +4,8 @@ require 'ruby-jmeter'
|
|
4
4
|
test do
|
5
5
|
threads count: 1, loop: 1 do
|
6
6
|
visit 'https://api.github.com/orgs/flood-io/repos' do
|
7
|
-
assert json: '.name', value: '
|
7
|
+
assert json: '.name', value: '.*'
|
8
|
+
assert json: '.id', value: '\d+'
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end.run(path: '/usr/share/jmeter/bin/', gui: true)
|
@@ -111,5 +111,10 @@ module RubyJmeter
|
|
111
111
|
node = RubyJmeter::Plugins::RedisDataSet.new(params)
|
112
112
|
attach_node(node, &block)
|
113
113
|
end
|
114
|
+
|
115
|
+
def jmx_collector(params = {}, &block)
|
116
|
+
node = RubyJmeter::Plugins::JMXCollector.new(params)
|
117
|
+
attach_node(node, &block)
|
118
|
+
end
|
114
119
|
end
|
115
120
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module RubyJmeter
|
2
|
+
module Plugins
|
3
|
+
class JMXCollector
|
4
|
+
attr_accessor :doc
|
5
|
+
include Helper
|
6
|
+
def initialize(params={})
|
7
|
+
|
8
|
+
params[:name] ||= 'JMX Collector'
|
9
|
+
params[:jtl] ||= ''
|
10
|
+
params[:attribute_key] ||= ''
|
11
|
+
|
12
|
+
@doc = Nokogiri::XML(<<-XML.strip_heredoc)
|
13
|
+
<kg.apc.jmeter.jmxmon.JMXMonCollector guiclass="kg.apc.jmeter.vizualizers.JMXMonGui" testclass="kg.apc.jmeter.jmxmon.JMXMonCollector" testname="#{params[:name]}" enabled="true">
|
14
|
+
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
15
|
+
<objProp>
|
16
|
+
<name>saveConfig</name>
|
17
|
+
<value class="SampleSaveConfiguration">
|
18
|
+
<time>true</time>
|
19
|
+
<latency>true</latency>
|
20
|
+
<timestamp>true</timestamp>
|
21
|
+
<success>true</success>
|
22
|
+
<label>true</label>
|
23
|
+
<code>true</code>
|
24
|
+
<message>true</message>
|
25
|
+
<threadName>true</threadName>
|
26
|
+
<dataType>true</dataType>
|
27
|
+
<encoding>false</encoding>
|
28
|
+
<assertions>true</assertions>
|
29
|
+
<subresults>true</subresults>
|
30
|
+
<responseData>false</responseData>
|
31
|
+
<samplerData>false</samplerData>
|
32
|
+
<xml>false</xml>
|
33
|
+
<fieldNames>true</fieldNames>
|
34
|
+
<responseHeaders>false</responseHeaders>
|
35
|
+
<requestHeaders>false</requestHeaders>
|
36
|
+
<responseDataOnError>false</responseDataOnError>
|
37
|
+
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
|
38
|
+
<assertionsResultsToSave>0</assertionsResultsToSave>
|
39
|
+
<bytes>true</bytes>
|
40
|
+
<threadCounts>true</threadCounts>
|
41
|
+
<idleTime>true</idleTime>
|
42
|
+
</value>
|
43
|
+
</objProp>
|
44
|
+
<stringProp name="filename">#{params[:jtl]}</stringProp>
|
45
|
+
<longProp name="interval_grouping">1000</longProp
|
46
|
+
<boolProp name="graph_aggregated">false</boolProp>
|
47
|
+
<stringProp name="include_sample_labels"></stringProp>
|
48
|
+
<stringProp name="exclude_sample_labels"></stringProp>
|
49
|
+
<stringProp name="start_offset"></stringProp>
|
50
|
+
<stringProp name="end_offset"></stringProp>
|
51
|
+
<boolProp name="include_checkbox_state">false</boolProp>
|
52
|
+
<boolProp name="exclude_checkbox_state">false</boolProp>
|
53
|
+
<collectionProp name="samplers">
|
54
|
+
<collectionProp name="311458936">
|
55
|
+
<stringProp name="label"></stringProp>
|
56
|
+
<stringProp name="service_endpoint">service:jmx:rmi:///jndi/rmi://#{params[:host]}:#{params[:port]}/jmxrmi</stringProp>
|
57
|
+
<stringProp name="username"></stringProp>
|
58
|
+
<stringProp name="password"></stringProp>
|
59
|
+
<stringProp name="object_name">#{params[:object_name]}</stringProp>
|
60
|
+
<stringProp name="attribute_name">#{params[:attribute_name]}</stringProp>
|
61
|
+
<stringProp name="attribute_key">#{params[:attribute_key]}</stringProp>
|
62
|
+
<stringProp name="delta">false</stringProp>
|
63
|
+
<stringProp name="retry">true</stringProp>
|
64
|
+
</collectionProp>
|
65
|
+
</collectionProp>
|
66
|
+
</kg.apc.jmeter.jmxmon.JMXMonCollector>
|
67
|
+
XML
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
data/lib/ruby-jmeter/version.rb
CHANGED
data/spec/http_request_spec.rb
CHANGED
@@ -17,15 +17,15 @@ describe 'http_request' do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'matches on domain' do
|
20
|
-
expect(fragment.search(".//stringProp[@name='HTTPSampler.domain']").text).to eq '
|
20
|
+
expect(fragment.search(".//stringProp[@name='HTTPSampler.domain']").text).to eq 'flooded.io'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'matches on port' do
|
24
|
-
expect(fragment.search(".//stringProp[@name='HTTPSampler.port']").text).to eq '
|
24
|
+
expect(fragment.search(".//stringProp[@name='HTTPSampler.port']").text).to eq '443'
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'matches on protocol' do
|
28
|
-
expect(fragment.search(".//stringProp[@name='HTTPSampler.protocol']").text).to eq '
|
28
|
+
expect(fragment.search(".//stringProp[@name='HTTPSampler.protocol']").text).to eq 'https'
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'matches on path' do
|
data/spec/jmeter_plugins_spec.rb
CHANGED
@@ -153,3 +153,93 @@ describe 'redis data set' do
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
end
|
156
|
+
|
157
|
+
describe 'jmx collector' do
|
158
|
+
|
159
|
+
describe 'passing all optionals' do
|
160
|
+
let(:doc) do
|
161
|
+
test do
|
162
|
+
jmx_collector(
|
163
|
+
name: 'some jmx collector name',
|
164
|
+
host: 'localhost',
|
165
|
+
port: 12345,
|
166
|
+
object_name: 'java.lang:type=Memory',
|
167
|
+
attribute_name: 'HeapMemoryUsage',
|
168
|
+
attribute_key: 'committed',
|
169
|
+
jtl: 'path/to/some/dir/file.jtl'
|
170
|
+
)
|
171
|
+
end.to_doc
|
172
|
+
end
|
173
|
+
|
174
|
+
let(:fragment) {
|
175
|
+
doc.search('//kg.apc.jmeter.jmxmon.JMXMonCollector').first }
|
176
|
+
|
177
|
+
it 'should have a name' do
|
178
|
+
expect(fragment.attributes['testname'].value).to eq 'some jmx collector name'
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'should point to the service endpoint' do
|
182
|
+
expect(fragment.search("//stringProp[@name='service_endpoint']").text).to eq 'service:jmx:rmi:///jndi/rmi://localhost:12345/jmxrmi'
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'should use the object name' do
|
186
|
+
expect(fragment.search("//stringProp[@name='object_name']").text).to eq 'java.lang:type=Memory'
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'should use the attribute name' do
|
190
|
+
expect(fragment.search("//stringProp[@name='attribute_name']").text).to eq 'HeapMemoryUsage'
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'should use the attribute key' do
|
194
|
+
expect(fragment.search("//stringProp[@name='attribute_key']").text).to eq 'committed'
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'should use the jtl path' do
|
198
|
+
expect(fragment.search("//stringProp[@name='filename']").text).to eq 'path/to/some/dir/file.jtl'
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
describe 'passing no optionals' do
|
204
|
+
let(:doc) do
|
205
|
+
test do
|
206
|
+
jmx_collector(
|
207
|
+
host: '127.0.0.1',
|
208
|
+
port: 54321,
|
209
|
+
object_name: 'java.lang:type=Threading',
|
210
|
+
attribute_name: 'ThreadCount',
|
211
|
+
)
|
212
|
+
end.to_doc
|
213
|
+
end
|
214
|
+
|
215
|
+
let(:fragment) {
|
216
|
+
doc.search('//kg.apc.jmeter.jmxmon.JMXMonCollector').first }
|
217
|
+
|
218
|
+
it 'should have a default name' do
|
219
|
+
expect(fragment.attributes['testname'].value).to eq 'JMX Collector'
|
220
|
+
end
|
221
|
+
|
222
|
+
it 'should point to the service endpoint' do
|
223
|
+
expect(fragment.search("//stringProp[@name='service_endpoint']").text).to eq 'service:jmx:rmi:///jndi/rmi://127.0.0.1:54321/jmxrmi'
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'should use the object name' do
|
227
|
+
expect(fragment.search("//stringProp[@name='object_name']").text).to eq 'java.lang:type=Threading'
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'should use the attribute name' do
|
231
|
+
expect(fragment.search("//stringProp[@name='attribute_name']").text).to eq 'ThreadCount'
|
232
|
+
end
|
233
|
+
|
234
|
+
it 'should use an empty attribute key' do
|
235
|
+
expect(fragment.search("//stringProp[@name='attribute_key']").text).to eq ''
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'should use an empty jtl path' do
|
239
|
+
expect(fragment.search("//stringProp[@name='filename']").text).to eq ''
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
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.12
|
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-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -265,6 +265,7 @@ files:
|
|
265
265
|
- lib/ruby-jmeter/plugins/composite_graph.rb
|
266
266
|
- lib/ruby-jmeter/plugins/console_status_logger.rb
|
267
267
|
- lib/ruby-jmeter/plugins/dummy_sampler.rb
|
268
|
+
- lib/ruby-jmeter/plugins/jmx_collector.rb
|
268
269
|
- lib/ruby-jmeter/plugins/json_path_assertion.rb
|
269
270
|
- lib/ruby-jmeter/plugins/json_path_extractor.rb
|
270
271
|
- lib/ruby-jmeter/plugins/latencies_over_time.rb
|