Sha256: a9dd3af2ab163622187a000895137c2c4f3950228e56e64989090ec5b42f6e70

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

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

  class HTMLAssertion
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "HTMLAssertion" : (params[:name] || "HTMLAssertion")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <HTMLAssertion guiclass="HTMLAssertionGui" testclass="HTMLAssertion" testname="#{testname}" enabled="true">
          <longProp name="html_assertion_error_threshold">0</longProp>
          <longProp name="html_assertion_warning_threshold">0</longProp>
          <stringProp name="html_assertion_doctype">omit</stringProp>
          <boolProp name="html_assertion_errorsonly">false</boolProp>
          <longProp name="html_assertion_format">0</longProp>
          <stringProp name="html_assertion_filename"/>
        </HTMLAssertion>
      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/html_assertion.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/html_assertion.rb