Sha256: 1ccec9dfdfc3140762e31fe4d821d977c7d1a443defd4af1a2d0d09a1efb5b6b

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

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

  class BeanShellPostprocessor
    attr_accessor :doc
    include Helper

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