Class: JmeterPerf::DSL::ThreadGroup

Inherits:
Object
  • Object
show all
Includes:
Helpers::XmlDocumentUpdater
Defined in:
lib/jmeter_perf/dsl/thread_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ ThreadGroup

Returns a new instance of ThreadGroup.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/jmeter_perf/dsl/thread_group.rb', line 17

def initialize(params = {})
  testname = params.is_a?(Array) ? "ThreadGroup" : (params[:name] || "ThreadGroup")
  @doc = Nokogiri::XML(JmeterPerf::Helpers::String.strip_heredoc(
    <<~EOS
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="#{testname}" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="#{testname}" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <intProp name="LoopController.loops">-1</intProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1366415241000</longProp>
        <longProp name="ThreadGroup.end_time">1366415241000</longProp>
        <boolProp name="ThreadGroup.scheduler">true</boolProp>
        <stringProp name="ThreadGroup.duration"/>
        <stringProp name="ThreadGroup.delay"/>
        <boolProp name="ThreadGroup.delayedStart">true</boolProp>
      </ThreadGroup>
    EOS
  ))
  update params
  update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
end

Instance Attribute Details

#docObject

Returns the value of attribute doc.



14
15
16
# File 'lib/jmeter_perf/dsl/thread_group.rb', line 14

def doc
  @doc
end