Sha256: fb0136d9034415eff356941df185d3e98659c44df6d562e340bddd734ab0f28a

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

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

  class JUnitRequest
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "JUnitRequest" : (params[:name] || "JUnitRequest")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <JUnitSampler guiclass="JUnitTestSamplerGui" testclass="JUnitSampler" testname="#{testname}" enabled="true">
          <stringProp name="junitSampler.classname">test.RerunTest</stringProp>
          <stringProp name="junitsampler.constructorstring"/>
          <stringProp name="junitsampler.method">testRerun</stringProp>
          <stringProp name="junitsampler.pkg.filter"/>
          <stringProp name="junitsampler.success">Test successful</stringProp>
          <stringProp name="junitsampler.success.code">1000</stringProp>
          <stringProp name="junitsampler.failure">Test failed</stringProp>
          <stringProp name="junitsampler.failure.code">0001</stringProp>
          <stringProp name="junitsampler.error">An unexpected error occured</stringProp>
          <stringProp name="junitsampler.error.code">9999</stringProp>
          <stringProp name="junitsampler.exec.setup">false</stringProp>
          <stringProp name="junitsampler.append.error">false</stringProp>
          <stringProp name="junitsampler.append.exception">false</stringProp>
        </JUnitSampler>
      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/j_unit_request.rb
jmeter_perf-0.0.2 lib/jmeter_perf/dsl/j_unit_request.rb