ruby-jmeter 3.0.6 → 3.0.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: 83a73747c3402824faf4023f61c4112600524e41
4
- data.tar.gz: 235497d579565a177859e267d20bed5a334660fc
3
+ metadata.gz: 4bd3659e8b6c63f914431419f9eeacfa7e7df8d8
4
+ data.tar.gz: 1706ffed23bd94c9a6bfdb39c5895a8125fb385f
5
5
  SHA512:
6
- metadata.gz: 92f50f345639762f2bb7a20cd3b5f9ec74f33e184ec802f397c040e103560a4ccb1b3b843a16ec7de9bf762b2c2dd54d78cf80737ab2498f624a21d36fae8fdb
7
- data.tar.gz: 73b8827a09177d8182e27f510b10b422d8eda3759eb53901a5aa248ecd5a6589d5d8e960fdedebacf8af9b8913bccf3081ced5f79dc8d13f0dfd833e30849b7d
6
+ metadata.gz: d4cdbda09d55d140d39a938f02abec9565ed94a004017ff34756009de8cda1b681f86028d5b1e958f13d934b3533e5daa2837aa183e3bea4e7cdb3925caa20c7
7
+ data.tar.gz: 03a415a86d46d38dc238c6410b59982159d66b46ba0631376ceb73967f0d9213599048e16777c33a2a9d3c8f6438bd172d038c9905841d84f47c8c819c4ed863
@@ -3,6 +3,7 @@ require 'ruby-jmeter'
3
3
 
4
4
  test do
5
5
  threads count: 1 do
6
- dummy_sampler '__grid_data_api', {response_data: "ACIR0001, ACIR0002, ACIR0003, ACIR0004, ACIR0005, ACIR0006, ABS0003, MBS0001, MBS0004, MBS0005, ABS0004, ABS0005, ABS0010, ABS0011, ABS0012, ABS0013, ABS0014, ABS0016, ABS0017, ABS0018, ABS0021, ABS0022, MBS0006, MBS0009, MBS0010"}
6
+ dummy_sampler name: '__grid_data_api',
7
+ response_data: 'ACIR0001, ACIR0002, ACIR0003, ACIR0004, ACIR0005, ACIR0006, ABS0003, MBS0001, MBS0004, MBS0005, ABS0004, ABS0005, ABS0010, ABS0011, ABS0012, ABS0013, ABS0014, ABS0016, ABS0017, ABS0018, ABS0021, ABS0022, MBS0006, MBS0009, MBS0010'
7
8
  end
8
9
  end.run(path: '/usr/share/jmeter/bin/', gui: true)
@@ -12,7 +12,8 @@ test do
12
12
  { name: 'Accept', value: 'text/javascript, text/html, application/xml, text/xml, */*' }
13
13
  ]
14
14
 
15
- step total_threads: 200,
15
+ step name: 'stepping thread group example',
16
+ total_threads: 200,
16
17
  initial_delay: 0,
17
18
  start_threads: 20,
18
19
  add_threads: 0,
@@ -4,7 +4,7 @@ require 'ruby-jmeter'
4
4
  test do
5
5
  threads count: 100 do # threads = RPS * <max response time ms> / 1000
6
6
 
7
- throughput_shaper 'increasing load test', [
7
+ throughput_shaper name: 'increasing load test', steps: [
8
8
  { :start_rps => 100, :end_rps => 100, :duration => 60 },
9
9
  { :start_rps => 200, :end_rps => 200, :duration => 60 },
10
10
  { :start_rps => 300, :end_rps => 300, :duration => 60 },
@@ -12,23 +12,24 @@ test do
12
12
  { name: 'Accept', value: 'text/javascript, text/html, application/xml, text/xml, */*' }
13
13
  ]
14
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
- ],
31
- {on_sample_error: 'startnextloop'} do
15
+ ultimate name: 'ultimate thread group example',
16
+ on_sample_error: 'startnextloop',
17
+ threads: [
18
+ {
19
+ start_threads: 200,
20
+ initial_delay: 0,
21
+ start_time: 30,
22
+ hold_time: 60,
23
+ stop_time: 5
24
+ },
25
+ {
26
+ start_threads: 200,
27
+ initial_delay: 60,
28
+ start_time: 30,
29
+ hold_time: 60,
30
+ stop_time: 5
31
+ }
32
+ ] do
32
33
 
33
34
  random_timer 1000, 3000
34
35
 
@@ -1,51 +1,51 @@
1
1
  module RubyJmeter
2
2
  class ExtendedDSL < DSL
3
- def response_codes_per_second(name = 'Response Codes per Second', params = {}, &block)
4
- node = RubyJmeter::Plugins::ResponseCodesPerSecond.new(name, params)
3
+ def response_codes_per_second(params = {}, &block)
4
+ node = RubyJmeter::Plugins::ResponseCodesPerSecond.new(params)
5
5
  attach_node(node, &block)
6
6
  end
7
7
 
8
- def response_times_distribution(name = 'Response Times Distribution', params = {}, &block)
9
- node = RubyJmeter::Plugins::ResponseTimesDistribution.new(name, params)
8
+ def response_times_distribution(params = {}, &block)
9
+ node = RubyJmeter::Plugins::ResponseTimesDistribution.new(params)
10
10
  attach_node(node, &block)
11
11
  end
12
12
 
13
- def response_times_over_time(name = 'Response Times Over Time', params = {}, &block)
14
- node = RubyJmeter::Plugins::ResponseTimesOverTime.new(name, params)
13
+ def response_times_over_time(params = {}, &block)
14
+ node = RubyJmeter::Plugins::ResponseTimesOverTime.new(params)
15
15
  attach_node(node, &block)
16
16
  end
17
17
 
18
- def response_times_percentiles(name = 'Response Times Percentiles', params = {}, &block)
19
- node = RubyJmeter::Plugins::ResponseTimesPercentiles.new(name, params)
18
+ def response_times_percentiles(params = {}, &block)
19
+ node = RubyJmeter::Plugins::ResponseTimesPercentiles.new(params)
20
20
  attach_node(node, &block)
21
21
  end
22
22
 
23
- def transactions_per_second(name = 'Transactions per Second', params = {}, &block)
24
- node = RubyJmeter::Plugins::TransactionsPerSecond.new(name, params)
23
+ def transactions_per_second(params = {}, &block)
24
+ node = RubyJmeter::Plugins::TransactionsPerSecond.new(params)
25
25
  attach_node(node, &block)
26
26
  end
27
27
 
28
- def latencies_over_time(name = 'Response Latencies Over Time', params = {}, &block)
29
- node = RubyJmeter::Plugins::LatenciesOverTime.new(name, params)
28
+ def latencies_over_time(params = {}, &block)
29
+ node = RubyJmeter::Plugins::LatenciesOverTime.new(params)
30
30
  attach_node(node, &block)
31
31
  end
32
32
 
33
- def console_status_logger(name = 'Console Status Logger', params = {}, &block)
34
- node = RubyJmeter::Plugins::ConsoleStatusLogger.new(name, params)
33
+ def console_status_logger(params = {}, &block)
34
+ node = RubyJmeter::Plugins::ConsoleStatusLogger.new(params)
35
35
  attach_node(node, &block)
36
36
  end
37
37
 
38
38
  alias console console_status_logger
39
39
 
40
- def throughput_shaper(name = 'Throughput Shaping Timer', steps=[], params = {}, &block)
41
- node = RubyJmeter::Plugins::ThroughputShapingTimer.new(name, steps)
40
+ def throughput_shaper(params = {}, &block)
41
+ node = RubyJmeter::Plugins::ThroughputShapingTimer.new(params)
42
42
  attach_node(node, &block)
43
43
  end
44
44
 
45
45
  alias shaper throughput_shaper
46
46
 
47
- def dummy_sampler(name = 'Dummy Sampler', params = {}, &block)
48
- node = RubyJmeter::Plugins::DummySampler.new(name, params)
47
+ def dummy_sampler(params = {}, &block)
48
+ node = RubyJmeter::Plugins::DummySampler.new(params)
49
49
  attach_node(node, &block)
50
50
  end
51
51
 
@@ -58,10 +58,10 @@ module RubyJmeter
58
58
 
59
59
  alias step stepping_thread_group
60
60
 
61
- def ultimate_thread_group(threads = [], params = {}, &block)
61
+ def ultimate_thread_group(params = {}, &block)
62
62
  node = RubyJmeter::Plugins::UltimateThreadGroup.new(params)
63
63
 
64
- threads.each_with_index do |group, index|
64
+ (params.kind_of?(Array) ? params : params[:threads]).each_with_index do |group, index|
65
65
  node.doc.at_xpath('//collectionProp') <<
66
66
  Nokogiri::XML(<<-EOS.strip_heredoc).children
67
67
  <collectionProp name="index">
@@ -79,8 +79,8 @@ module RubyJmeter
79
79
 
80
80
  alias ultimate ultimate_thread_group
81
81
 
82
- def composite_graph(name, params = {}, &block)
83
- node = RubyJmeter::Plugins::CompositeGraph.new(name, params)
82
+ def composite_graph(params = {}, &block)
83
+ node = RubyJmeter::Plugins::CompositeGraph.new(params)
84
84
  attach_node(node, &block)
85
85
  end
86
86
 
@@ -100,8 +100,8 @@ module RubyJmeter
100
100
 
101
101
  alias perfmon perfmon_collector
102
102
 
103
- def loadosophia_uploader(name = "Loadosophia.org Uploader", params = {}, &block)
104
- node = RubyJmeter::Plugins::LoadosophiaUploader.new(name, params)
103
+ def loadosophia_uploader(params = {}, &block)
104
+ node = RubyJmeter::Plugins::LoadosophiaUploader.new(params)
105
105
  attach_node(node, &block)
106
106
  end
107
107
 
@@ -3,9 +3,10 @@ module RubyJmeter
3
3
  class ActiveThreadsOverTime
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'ActiveThreadsOverTime' : (params[:name] || 'ActiveThreadsOverTime')
7
8
  @doc = Nokogiri::XML(<<-XML.strip_heredoc)
8
- <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ThreadsStateOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="true">
9
+ <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ThreadsStateOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="true">
9
10
  <boolProp name="ResultCollector.error_logging">false</boolProp>
10
11
  <objProp>
11
12
  <name>saveConfig</name>
@@ -3,7 +3,8 @@ module RubyJmeter
3
3
  class CompositeGraph
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'CompositeGraph' : (params[:name] || 'CompositeGraph')
7
8
  graphNodes = params.collect { |g| "<stringProp name=\"\">#{g[:graph]}</stringProp>"}
8
9
  metricNodes = params.collect { |m| "<stringProp name=\"\">#{m[:metric]}</stringProp>"}
9
10
 
@@ -19,7 +20,7 @@ module RubyJmeter
19
20
  XML
20
21
 
21
22
  @doc = Nokogiri::XML(<<-XML.strip_heredoc)
22
- <kg.apc.jmeter.vizualizers.CompositeResultCollector guiclass="kg.apc.jmeter.vizualizers.CompositeGraphGui" testclass="kg.apc.jmeter.vizualizers.CompositeResultCollector" testname="#{name}" enabled="true">
23
+ <kg.apc.jmeter.vizualizers.CompositeResultCollector guiclass="kg.apc.jmeter.vizualizers.CompositeGraphGui" testclass="kg.apc.jmeter.vizualizers.CompositeResultCollector" testname="#{testname}" enabled="true">
23
24
  <boolProp name="ResultCollector.error_logging">false</boolProp>
24
25
  <objProp>
25
26
  <name>saveConfig</name>
@@ -3,9 +3,10 @@ module RubyJmeter
3
3
  class ConsoleStatusLogger
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'ConsoleStatusLogger' : (params[:name] || 'ConsoleStatusLogger')
7
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
- <kg.apc.jmeter.reporters.ConsoleStatusLogger guiclass="kg.apc.jmeter.reporters.ConsoleStatusLoggerGui" testclass="kg.apc.jmeter.reporters.ConsoleStatusLogger" testname="#{name}" enabled="true"/>
9
+ <kg.apc.jmeter.reporters.ConsoleStatusLogger guiclass="kg.apc.jmeter.reporters.ConsoleStatusLoggerGui" testclass="kg.apc.jmeter.reporters.ConsoleStatusLogger" testname="#{testname}" enabled="true"/>
9
10
  EOF
10
11
  update params
11
12
  end
@@ -3,9 +3,10 @@ module RubyJmeter
3
3
  class DummySampler
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'DummySampler' : (params[:name] || 'DummySampler')
7
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
- <kg.apc.jmeter.samplers.DummySampler guiclass="kg.apc.jmeter.samplers.DummySamplerGui" testclass="kg.apc.jmeter.samplers.DummySampler" testname="#{name}" enabled="true">
9
+ <kg.apc.jmeter.samplers.DummySampler guiclass="kg.apc.jmeter.samplers.DummySamplerGui" testclass="kg.apc.jmeter.samplers.DummySampler" testname="#{testname}" enabled="true">
9
10
  <boolProp name="WAITING">true</boolProp>
10
11
  <boolProp name="SUCCESFULL">true</boolProp>
11
12
  <stringProp name="RESPONSE_CODE">200</stringProp>
@@ -16,7 +17,9 @@ module RubyJmeter
16
17
  <stringProp name="LATENCY">0</stringProp>
17
18
  </kg.apc.jmeter.samplers.DummySampler>
18
19
  EOF
19
- update params
20
+ upcased_params = {}
21
+ params.each {|k,v| upcased_params[k.to_s.upcase] = v}
22
+ update upcased_params
20
23
  end
21
24
  end
22
25
  end
@@ -3,9 +3,10 @@ module RubyJmeter
3
3
  class LatenciesOverTime
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'LatenciesOverTime' : (params[:name] || 'LatenciesOverTime')
7
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
- <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.LatenciesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
9
+ <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.LatenciesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
9
10
  <boolProp name="ResultCollector.error_logging">false</boolProp>
10
11
  <objProp>
11
12
  <name>saveConfig</name>
@@ -3,9 +3,10 @@ module RubyJmeter
3
3
  class ResponseCodesPerSecond
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'ResponseCodesPerSecond' : (params[:name] || 'ResponseCodesPerSecond')
7
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
- <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseCodesPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
9
+ <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseCodesPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
9
10
  <boolProp name="ResultCollector.error_logging">false</boolProp>
10
11
  <objProp>
11
12
  <name>saveConfig</name>
@@ -3,9 +3,10 @@ module RubyJmeter
3
3
  class ResponseTimesDistribution
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'ResponseTimesDistribution' : (params[:name] || 'ResponseTimesDistribution')
7
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
- <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesDistributionGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
9
+ <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesDistributionGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
9
10
  <boolProp name="ResultCollector.error_logging">false</boolProp>
10
11
  <objProp>
11
12
  <name>saveConfig</name>
@@ -3,9 +3,10 @@ module RubyJmeter
3
3
  class ResponseTimesOverTime
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'ResponseTimesOverTime' : (params[:name] || 'ResponseTimesOverTime')
7
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
- <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
9
+ <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
9
10
  <boolProp name="ResultCollector.error_logging">false</boolProp>
10
11
  <objProp>
11
12
  <name>saveConfig</name>
@@ -3,9 +3,10 @@ module RubyJmeter
3
3
  class ResponseTimesPercentiles
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'ResponseTimesPercentiles' : (params[:name] || 'ResponseTimesPercentiles')
7
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
- <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesPercentilesGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
9
+ <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesPercentilesGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
9
10
  <boolProp name="ResultCollector.error_logging">false</boolProp>
10
11
  <objProp>
11
12
  <name>saveConfig</name>
@@ -4,9 +4,9 @@ module RubyJmeter
4
4
  attr_accessor :doc
5
5
  include Helper
6
6
  def initialize(params={})
7
- params[:name] ||= 'jp@gc - Stepping Thread Group'
7
+ testname = params.kind_of?(Array) ? 'SteppingThreadGroup' : (params[:name] || 'SteppingThreadGroup')
8
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
9
- <kg.apc.jmeter.threads.SteppingThreadGroup guiclass="kg.apc.jmeter.threads.SteppingThreadGroupGui" testclass="kg.apc.jmeter.threads.SteppingThreadGroup" testname="#{params[:name]}" enabled="true">
9
+ <kg.apc.jmeter.threads.SteppingThreadGroup guiclass="kg.apc.jmeter.threads.SteppingThreadGroupGui" testclass="kg.apc.jmeter.threads.SteppingThreadGroup" testname="#{testname}" enabled="true">
10
10
  <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
11
11
  <stringProp name="ThreadGroup.num_threads">#{params[:total_threads]}</stringProp>
12
12
  <stringProp name="Threads initial delay">#{params[:initial_delay]}</stringProp>
@@ -3,9 +3,10 @@ module RubyJmeter
3
3
  class TransactionsPerSecond
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'TransactionsPerSecond' : (params[:name] || 'TransactionsPerSecond')
7
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
- <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.TransactionsPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{name}" enabled="#{enabled(params)}">
9
+ <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.TransactionsPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
9
10
  <boolProp name="ResultCollector.error_logging">false</boolProp>
10
11
  <objProp>
11
12
  <name>saveConfig</name>
@@ -4,8 +4,9 @@ module RubyJmeter
4
4
  attr_accessor :doc
5
5
  include Helper
6
6
  def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'UltimateThreadGroup' : (params[:name] || 'UltimateThreadGroup')
7
8
  @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
+ <kg.apc.jmeter.threads.UltimateThreadGroup guiclass="kg.apc.jmeter.threads.UltimateThreadGroupGui" testclass="kg.apc.jmeter.threads.UltimateThreadGroup" testname="#{testname}" enabled="true">
9
10
  <collectionProp name="ultimatethreadgroupdata">
10
11
  </collectionProp>
11
12
  <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
@@ -3,13 +3,14 @@ module RubyJmeter
3
3
  class ThroughputShapingTimer
4
4
  attr_accessor :doc
5
5
  include Helper
6
- def initialize(name, steps, params={})
6
+ def initialize(params={})
7
+ testname = params.kind_of?(Array) ? 'ThroughputShapingTimer' : (params[:name] || 'ThroughputShapingTimer')
7
8
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
8
- <kg.apc.jmeter.timers.VariableThroughputTimer guiclass="kg.apc.jmeter.timers.VariableThroughputTimerGui" testclass="kg.apc.jmeter.timers.VariableThroughputTimer" testname="#{name}" enabled="true">
9
+ <kg.apc.jmeter.timers.VariableThroughputTimer guiclass="kg.apc.jmeter.timers.VariableThroughputTimerGui" testclass="kg.apc.jmeter.timers.VariableThroughputTimer" testname="#{testname}" enabled="true">
9
10
  <collectionProp name="load_profile"/>
10
11
  </kg.apc.jmeter.timers.VariableThroughputTimer>
11
12
  EOF
12
- steps.each_with_index do |step, index|
13
+ (params.kind_of?(Array) ? params : params[:steps]).each_with_index do |step, index|
13
14
  @doc.at_xpath('//collectionProp') <<
14
15
  Nokogiri::XML(<<-EOF.strip_heredoc).children
15
16
  <collectionProp name="step_#{index}">
@@ -1,3 +1,3 @@
1
1
  module RubyJmeter
2
- VERSION = '3.0.6'
2
+ VERSION = '3.0.7'
3
3
  end
@@ -53,7 +53,7 @@ describe 'dummy sampler' do
53
53
  let(:doc) do
54
54
  test do
55
55
  threads do
56
- dummy_sampler 'dummy sampler name', { RESPONSE_DATA: "Some response data" }
56
+ dummy_sampler name: 'dummy sampler name', response_data: 'Some response data'
57
57
  end
58
58
  end.to_doc
59
59
  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.6
4
+ version: 3.0.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: 2016-09-21 00:00:00.000000000 Z
11
+ date: 2016-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client