gridinit-jmeter 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -11,6 +11,11 @@ platforms :jruby do
11
11
  gem 'json-jruby'
12
12
  end
13
13
 
14
+ group :development do
15
+ gem 'pry'
16
+ gem 'pry-nav'
17
+ end
18
+
14
19
  group :test do
15
20
  gem 'rake'
16
21
  gem 'rspec'
@@ -0,0 +1,21 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'gridinit-jmeter'
3
+
4
+ test do
5
+ threads 100 do # threads = RPS * <max response time ms> / 1000
6
+
7
+ throughput_shaper 'increasing load test', [
8
+ { :start_rps => 100, :end_rps => 100, :duration => 60 },
9
+ { :start_rps => 200, :end_rps => 200, :duration => 60 },
10
+ { :start_rps => 300, :end_rps => 300, :duration => 60 },
11
+ { :start_rps => 400, :end_rps => 400, :duration => 60 },
12
+ { :start_rps => 500, :end_rps => 500, :duration => 60 },
13
+ { :start_rps => 600, :end_rps => 600, :duration => 60 }
14
+ ]
15
+
16
+ transaction 'Google Search' do
17
+ visit 'Home Page', 'http://google.com/'
18
+ end
19
+
20
+ end
21
+ end.jmx
@@ -282,6 +282,14 @@ module Gridinit
282
282
  self.instance_exec(&block) if block
283
283
  end
284
284
 
285
+ def throughput_shaper(name="jp@gc - Throughput Shaping Timer", steps=[], params={}, &block)
286
+ node = Gridinit::Jmeter::ThroughputShapingTimer.new(name, steps)
287
+ attach_to_last(node, caller)
288
+ self.instance_exec(&block) if block
289
+ end
290
+
291
+ alias_method :shaper, :throughput_shaper
292
+
285
293
  def out(params={})
286
294
  puts doc.to_xml(:indent => 2)
287
295
  end
@@ -359,6 +367,8 @@ module Gridinit
359
367
  '//RegexExtractor/following-sibling::hashTree'
360
368
  when 'random_timer'
361
369
  '//GaussianRandomTimer/following-sibling::hashTree'
370
+ when 'throughput_shaper'
371
+ '//kg.apc.jmeter.timers.VariableThroughputTimer/following-sibling::hashTree'
362
372
  else
363
373
  '//TestPlan/following-sibling::hashTree'
364
374
  end
@@ -0,0 +1,28 @@
1
+ module Gridinit
2
+ module Jmeter
3
+
4
+ class ThroughputShapingTimer
5
+ attr_accessor :doc
6
+ include Helper
7
+ def initialize(name, steps, params={})
8
+ @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
9
+ <kg.apc.jmeter.timers.VariableThroughputTimer guiclass="kg.apc.jmeter.timers.VariableThroughputTimerGui" testclass="kg.apc.jmeter.timers.VariableThroughputTimer" testname="#{name}" enabled="true">
10
+ <collectionProp name="load_profile"/>
11
+ </kg.apc.jmeter.timers.VariableThroughputTimer>
12
+ EOF
13
+ steps.each_with_index do |step, index|
14
+ @doc.at_xpath('//collectionProp') <<
15
+ Nokogiri::XML(<<-EOF.strip_heredoc).children
16
+ <collectionProp name="step_#{index}">
17
+ <stringProp name="start_rps_#{index}">#{step[:start_rps]}</stringProp>
18
+ <stringProp name="end_rps_#{index}">#{step[:end_rps]}</stringProp>
19
+ <stringProp name="duration_sec_#{index}">#{step[:duration]}</stringProp>
20
+ </collectionProp>
21
+ EOF
22
+ end
23
+ update params
24
+ end
25
+ end
26
+
27
+ end
28
+ end
@@ -1,5 +1,5 @@
1
1
  module Gridinit
2
2
  module Jmeter
3
- VERSION = "0.1.9"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -50,7 +50,7 @@ require 'gridinit-jmeter/helpers/user-agents'
50
50
  # require 'gridinit-jmeter/timers/constant_throughput_timer'
51
51
  # require 'gridinit-jmeter/timers/constant_timer'
52
52
  require 'gridinit-jmeter/timers/gaussian_random_timer'
53
- # require 'gridinit-jmeter/timers/gc_throughput_shaping_timer'
53
+ require 'gridinit-jmeter/timers/gc_throughput_shaping_timer'
54
54
  # require 'gridinit-jmeter/timers/jsr223_timer'
55
55
  # require 'gridinit-jmeter/timers/poisson_random_timer'
56
56
  # require 'gridinit-jmeter/timers/synchronizing_timer'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gridinit-jmeter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-22 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -82,6 +82,7 @@ files:
82
82
  - examples/basic_testplan.jmx
83
83
  - examples/basic_testplan.rb
84
84
  - examples/basic_think_time.rb
85
+ - examples/basic_throughput_shaping_timer.rb
85
86
  - examples/etsy_login_browse.rb
86
87
  - examples/jbhifi_now_search.rb
87
88
  - gridinit-jmeter.gemspec
@@ -126,6 +127,7 @@ files:
126
127
  - lib/gridinit-jmeter/test_plan/test_plan.rb
127
128
  - lib/gridinit-jmeter/threads/thread_group.rb
128
129
  - lib/gridinit-jmeter/timers/gaussian_random_timer.rb
130
+ - lib/gridinit-jmeter/timers/gc_throughput_shaping_timer.rb
129
131
  - lib/gridinit-jmeter/version.rb
130
132
  - spec/dsl_spec.rb
131
133
  - spec/spec_helper.rb