flood-io/ruby-jmeter

View on GitHub
lib/ruby-jmeter/extend/controllers/throughput_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
module RubyJmeter
  class ExtendedDSL < DSL
    def throughput_controller(params = {}, &block)
      params[:style] = 1 if params[:percent]
      params[:maxThroughput] = params[:total] || params[:percent] || 1

      node = RubyJmeter::ThroughputController.new(params)
      node.doc.xpath(".//FloatProperty/value").first.content = params[:maxThroughput].to_f

      attach_node(node, &block)
    end

    alias throughput throughput_controller
  end
end