Class: Smokey::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/smokey.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(testscript, vusers, base_url, duration, delay, rampup, think_time) ⇒ Runner

Returns a new instance of Runner.



8
9
10
11
12
13
14
15
16
# File 'lib/smokey.rb', line 8

def initialize(testscript, vusers, base_url, duration, delay, rampup, think_time)
  @testscript = testscript
  @vusers     = vusers
  @base_url   = base_url
  @duration   = duration
  @delay      = delay
  @rampup     = rampup
  @think_time = think_time
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url.



6
7
8
# File 'lib/smokey.rb', line 6

def base_url
  @base_url
end

#delayObject (readonly)

Returns the value of attribute delay.



6
7
8
# File 'lib/smokey.rb', line 6

def delay
  @delay
end

#durationObject (readonly)

Returns the value of attribute duration.



6
7
8
# File 'lib/smokey.rb', line 6

def duration
  @duration
end

#rampupObject (readonly)

Returns the value of attribute rampup.



6
7
8
# File 'lib/smokey.rb', line 6

def rampup
  @rampup
end

#testscriptObject (readonly)

Returns the value of attribute testscript.



6
7
8
# File 'lib/smokey.rb', line 6

def testscript
  @testscript
end

#think_timeObject (readonly)

Returns the value of attribute think_time.



6
7
8
# File 'lib/smokey.rb', line 6

def think_time
  @think_time
end

#vusersObject (readonly)

Returns the value of attribute vusers.



6
7
8
# File 'lib/smokey.rb', line 6

def vusers
  @vusers
end

Instance Method Details

#start_testObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/smokey.rb', line 18

def start_test
  threads = []
  @vusers.times do
    thread = Thread.new do
      VirtualUser.new(@testscript, @base_url).start
    end
    threads << thread
  end
  threads.each { |t| t.join }
end