ruby-jmeter 2.13.6 → 2.13.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aba397b4e80c6a55097ab98a90b1d4349a833c9
4
- data.tar.gz: 380054d564616ec16f3f5e7c29d5c1ffb34df146
3
+ metadata.gz: 2fad51ef27a7e3737b320fbb418db4772ffe6300
4
+ data.tar.gz: 6b266bfbd9507a0b8f08259d80a110923ef74e0d
5
5
  SHA512:
6
- metadata.gz: 085d457e7c39d09c50547b218000fd8656e1753a080f76b511f603be355be1168b0822b88d876e3e6b7027ae15d8d762dc1b450377a0d839a9ba8a0e5ac66134
7
- data.tar.gz: 13e6162f551447c0806923bfb46755e6f027a04aa144099cec2265bf1b7c6e9ca85d6ba589f2d98e31cc447bb990c5e4dc132cf83b018ef6d0c8e9b1fa67504b
6
+ metadata.gz: 590dadd09d7a91119e24acb35af182950e127f4f47be0c4207c8b5b9a2af0655ad00b51ffaab2fa8035f4b034dc021c4666b96d861c941f100c141018aa3a386
7
+ data.tar.gz: 4b8110856c259925912c3b471f629656000539295ad0d6e137f79ab37419ab6a40d9798ae6144605c2d590cd429706e381c5f27c5ec454d00defa85fbad00ad8
@@ -0,0 +1,38 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'ruby-jmeter'
3
+
4
+ test do
5
+
6
+ defaults domain: 'example.com'
7
+
8
+ with_user_agent :chrome
9
+
10
+ header [
11
+ { name: 'Accept-Encoding', value: 'gzip,deflate,sdch' },
12
+ { name: 'Accept', value: 'text/javascript, text/html, application/xml, text/xml, */*' }
13
+ ]
14
+
15
+ ultimate [
16
+ {
17
+ start_threads: 200,
18
+ initial_delay: 0,
19
+ start_time: 30,
20
+ hold_time: 60,
21
+ stop_time: 5
22
+ },
23
+ {
24
+ start_threads: 200,
25
+ initial_delay: 60,
26
+ start_time: 30,
27
+ hold_time: 60,
28
+ stop_time: 5
29
+ }
30
+ ] do
31
+
32
+ random_timer 1000, 3000
33
+
34
+ get name: 'home', url: '/'
35
+
36
+ end
37
+
38
+ end.run(path: '/usr/share/jmeter-2.13/bin/', gui: true)
@@ -476,6 +476,27 @@ module RubyJmeter
476
476
 
477
477
  alias_method :step, :stepping_thread_group
478
478
 
479
+ def ultimate_thread_group(params = {}, &block)
480
+ node = RubyJmeter::Plugins::UltimateThreadGroup.new(params)
481
+
482
+ params.each_with_index do |group, index|
483
+ node.doc.at_xpath('//collectionProp') <<
484
+ Nokogiri::XML(<<-EOS.strip_heredoc).children
485
+ <collectionProp name="index">
486
+ <stringProp name="#{group[:start_threads]}">#{group[:start_threads]}</stringProp>
487
+ <stringProp name="#{group[:initial_delay]}">#{group[:initial_delay]}</stringProp>
488
+ <stringProp name="#{group[:start_time]}">#{group[:start_time]}</stringProp>
489
+ <stringProp name="#{group[:hold_time]}">#{group[:hold_time]}</stringProp>
490
+ <stringProp name="#{group[:stop_time]}">#{group[:stop_time]}</stringProp>
491
+ </collectionProp>
492
+ EOS
493
+ end
494
+
495
+ attach_node(node, &block)
496
+ end
497
+
498
+ alias_method :ultimate, :ultimate_thread_group
499
+
479
500
  def composite_graph(name, params = {}, &block)
480
501
  node = RubyJmeter::Plugins::CompositeGraph.new(name, params)
481
502
  attach_node(node, &block)
@@ -23,7 +23,7 @@ module RubyJmeter
23
23
  </elementProp>
24
24
  </kg.apc.jmeter.threads.SteppingThreadGroup>
25
25
  EOF
26
- # update params
26
+ update params
27
27
  end
28
28
  end
29
29
  end
@@ -0,0 +1,21 @@
1
+ module RubyJmeter
2
+ module Plugins
3
+ class UltimateThreadGroup
4
+ attr_accessor :doc
5
+ include Helper
6
+ def initialize(params={})
7
+ @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
+ <kg.apc.jmeter.threads.UltimateThreadGroup guiclass="kg.apc.jmeter.threads.UltimateThreadGroupGui" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="jp@gc - Stepping Thread Group" enabled="true">
9
+ <collectionProp name="ultimatethreadgroupdata">
10
+ </collectionProp>
11
+ <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
12
+ <boolProp name="LoopController.continue_forever">false</boolProp>
13
+ <intProp name="LoopController.loops">-1</intProp>
14
+ </elementProp>
15
+ <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
16
+ </kg.apc.jmeter.threads.UltimateThreadGroup>
17
+ EOF
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module RubyJmeter
2
- VERSION = '2.13.6'
2
+ VERSION = '2.13.7'
3
3
  end
data/spec/dsl_spec.rb CHANGED
@@ -216,6 +216,56 @@ describe 'DSL' do
216
216
  end
217
217
  end
218
218
 
219
+ describe 'stepping thread group' do
220
+ let(:doc) do
221
+ test do
222
+ stepping_thread_group on_sample_error: 'startnextloop', total_threads: 100, initial_delay: 1, start_threads: 2, add_threads: 3, start_every: 4, stop_threads: 5, stop_every: 6, flight_time: 7, rampup: 8
223
+ end.to_doc
224
+ end
225
+
226
+ let(:fragment) { doc.search("//kg.apc.jmeter.threads.SteppingThreadGroup").first }
227
+ it 'should match on on_sample_error' do
228
+ puts fragment
229
+ fragment.search(".//stringProp[@name='ThreadGroup.on_sample_error']").text.should == 'startnextloop'
230
+ end
231
+
232
+ it 'should match on total_threads' do
233
+ fragment.search(".//stringProp[@name='ThreadGroup.num_threads']").text.should == '100'
234
+ end
235
+
236
+ it 'should match on initial_delay' do
237
+ fragment.search(".//stringProp[@name='Threads initial delay']").text.should == '1'
238
+ end
239
+
240
+ it 'should match on start_threads' do
241
+ fragment.search(".//stringProp[@name='Start users count']").text.should == '2'
242
+ end
243
+
244
+ it 'should match on add_threads' do
245
+ fragment.search(".//stringProp[@name='Start users count burst']").text.should == '3'
246
+ end
247
+
248
+ it 'should match on start_every' do
249
+ fragment.search(".//stringProp[@name='Start users period']").text.should == '4'
250
+ end
251
+
252
+ it 'should match on stop_threads' do
253
+ fragment.search(".//stringProp[@name='Stop users count']").text.should == '5'
254
+ end
255
+
256
+ it 'should match on stop_every' do
257
+ fragment.search(".//stringProp[@name='Stop users period']").text.should == '6'
258
+ end
259
+
260
+ it 'should match on flight_time' do
261
+ fragment.search(".//stringProp[@name='flighttime']").text.should == '7'
262
+ end
263
+
264
+ it 'should match on rampup' do
265
+ fragment.search(".//stringProp[@name='rampUp']").text.should == '8'
266
+ end
267
+ end
268
+
219
269
  describe 'thread groups old syntax' do
220
270
  let(:doc) do
221
271
  test do
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: 2.13.6
4
+ version: 2.13.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Koopmans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-28 00:00:00.000000000 Z
11
+ date: 2015-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -100,6 +100,7 @@ files:
100
100
  - examples/basic_thread_groups.rb
101
101
  - examples/basic_throughput_controller.rb
102
102
  - examples/basic_throughput_shaping_timer.rb
103
+ - examples/basic_ultimate_thread_group.rb
103
104
  - examples/basic_user_defined_variables.rb
104
105
  - examples/demo.csv
105
106
  - examples/etsy_login_browse.rb
@@ -251,6 +252,7 @@ files:
251
252
  - lib/ruby-jmeter/plugins/response_times_percentiles.rb
252
253
  - lib/ruby-jmeter/plugins/stepping_thread_group.rb
253
254
  - lib/ruby-jmeter/plugins/transactions_per_second.rb
255
+ - lib/ruby-jmeter/plugins/ultimate_thread_group.rb
254
256
  - lib/ruby-jmeter/plugins/variable_throughput_timer.rb
255
257
  - lib/ruby-jmeter/version.rb
256
258
  - ruby-jmeter.gemspec