Sha256: b26ac61dcf547bc50d695cc218f0746dbc870edb827ab24cc302e98f6601ce01

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module JmeterPerf
  class DSL
    # DSL method synonymous with the JMeter Element ConstantTimer
    # @see https://github.com/jlurena/jmeter_perf/wiki/1.-DSL-Documentation#constanttimer
    # @param [Hash] params Parameters for the ConstantTimer element (default: `{}`).
    # @yield block to attach to the ConstantTimer element
    # @return [JmeterPerf::ConstantTimer], a subclass of JmeterPerf::DSL that can be chained with other DSL methods.
    def constant_timer(params = {}, &)
      node = JmeterPerf::ConstantTimer.new(params)
      attach_node(node, &)
    end
  end

  class ConstantTimer
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "ConstantTimer" : (params[:name] || "ConstantTimer")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="#{testname}" enabled="true">
          <stringProp name="ConstantTimer.delay">300</stringProp>
        </ConstantTimer>
      EOS
      update params
      update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jmeter_perf-0.0.7 lib/jmeter_perf/dsl/constant_timer.rb