Class: RubyJmeter::Plugins::ThroughputShapingTimer

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/ruby-jmeter/plugins/variable_throughput_timer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#enabled, #enabled_disabled, #update, #update_at_xpath, #update_collection

Constructor Details

#initialize(params = {}) ⇒ ThroughputShapingTimer

Returns a new instance of ThroughputShapingTimer.


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby-jmeter/plugins/variable_throughput_timer.rb', line 6

def initialize(params={})
  testname = params.kind_of?(Array) ? 'ThroughputShapingTimer' : (params[:name] || 'ThroughputShapingTimer')
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
    <kg.apc.jmeter.timers.VariableThroughputTimer guiclass="kg.apc.jmeter.timers.VariableThroughputTimerGui" testclass="kg.apc.jmeter.timers.VariableThroughputTimer" testname="#{testname}" enabled="true">
      <collectionProp name="load_profile"/>
    </kg.apc.jmeter.timers.VariableThroughputTimer>
  EOF
  (params.kind_of?(Array) ? params : params[:steps]).each_with_index do |step, index|
    @doc.at_xpath('//collectionProp') <<
      Nokogiri::XML(<<-EOF.strip_heredoc).children
        <collectionProp name="step_#{index}">
          <stringProp name="start_rps_#{index}">#{step[:start_rps]}</stringProp>
          <stringProp name="end_rps_#{index}">#{step[:end_rps]}</stringProp>
          <stringProp name="duration_sec_#{index}">#{step[:duration]}</stringProp>
        </collectionProp>
      EOF
  end
  update params
end

Instance Attribute Details

#docObject

Returns the value of attribute doc


4
5
6
# File 'lib/ruby-jmeter/plugins/variable_throughput_timer.rb', line 4

def doc
  @doc
end