Sha256: 97ae2e6a54ad27c3a1d045b9bf59543a5fedba59ba68c87b1271e6094718a4a1

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

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

  class BSFTimer
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "BSFTimer" : (params[:name] || "BSFTimer")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <BSFTimer guiclass="TestBeanGUI" testclass="BSFTimer" testname="#{testname}" enabled="true">
          <stringProp name="filename"/>
          <stringProp name="parameters"/>
          <stringProp name="script"/>
          <stringProp name="scriptLanguage"/>
        </BSFTimer>
      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/bsf_timer.rb