Sha256: 202451bdd7ee3263e788473cfa9fba893331ec925d408f7e785e368649801a72

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

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

  class XPathExtractor
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "XPathExtractor" : (params[:name] || "XPathExtractor")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <XPathExtractor guiclass="XPathExtractorGui" testclass="XPathExtractor" testname="#{testname}" enabled="true">
          <stringProp name="XPathExtractor.default"/>
          <stringProp name="XPathExtractor.refname"/>
          <stringProp name="XPathExtractor.xpathQuery"/>
          <boolProp name="XPathExtractor.validate">false</boolProp>
          <boolProp name="XPathExtractor.tolerant">false</boolProp>
          <boolProp name="XPathExtractor.namespace">false</boolProp>
          <stringProp name="Sample.scope">all</stringProp>
        </XPathExtractor>
      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_extractor.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/x_path_extractor.rb