Sha256: d76a54d159301b8f9694901c24c4c6b66098c01ba8834c9f25cea9cff2f1d13d

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

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

  class CompareAssertion
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "CompareAssertion" : (params[:name] || "CompareAssertion")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <CompareAssertion guiclass="TestBeanGUI" testclass="CompareAssertion" testname="#{testname}" enabled="true">
          <boolProp name="compareContent">true</boolProp>
          <longProp name="compareTime">-1</longProp>
          <collectionProp name="stringsToSkip"/>
        </CompareAssertion>
      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/compare_assertion.rb