Sha256: b4f04270b2e69a8bb7c9ae7483935832a473712a6d4d34952fe51a758cce63b2

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

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

  class ResponseAssertion
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "ResponseAssertion" : (params[:name] || "ResponseAssertion")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="#{testname}" enabled="true">
          <collectionProp name="Asserion.test_strings">
            <stringProp name="0"/>
          </collectionProp>
          <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
          <boolProp name="Assertion.assume_success">false</boolProp>
          <intProp name="Assertion.test_type">16</intProp>
          <stringProp name="Assertion.scope">all</stringProp>
        </ResponseAssertion>
      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/response_assertion.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/response_assertion.rb