Sha256: 911bc3601c3128ff9b11fa4aae7879382c4726f8d67fb25510708be5de9ec692

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

module JmeterPerf
  class DSL
    def x_path_assertion(params = {}, &)
      node = JmeterPerf::XPathAssertion.new(params)
      attach_node(node, &)
    end
  end

  class XPathAssertion
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "XPathAssertion" : (params[:name] || "XPathAssertion")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <XPathAssertion guiclass="XPathAssertionGui" testclass="XPathAssertion" testname="#{testname}" enabled="true">
          <boolProp name="XPath.negate">false</boolProp>
          <stringProp name="XPath.xpath">/</stringProp>
          <boolProp name="XPath.validate">false</boolProp>
          <boolProp name="XPath.whitespace">false</boolProp>
          <boolProp name="XPath.tolerant">false</boolProp>
          <boolProp name="XPath.namespace">false</boolProp>
          <stringProp name="Assertion.scope">all</stringProp>
        </XPathAssertion>
      EOS
      update params
      update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jmeter_perf-0.0.6 lib/jmeter_perf/dsl/x_path_assertion.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/x_path_assertion.rb