Sha256: 7242eaaf8c2013d39106b6e6ea0dd293da6c47ddfde0a4fb969be1671b14a0c5

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

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

  class ResultStatusActionHandler
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "ResultStatusActionHandler" : (params[:name] || "ResultStatusActionHandler")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <ResultAction guiclass="ResultActionGui" testclass="ResultAction" testname="#{testname}" enabled="true">
          <intProp name="OnError.action">0</intProp>
        </ResultAction>
      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/result_status_action_handler.rb