grid 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -4
- data/VERSION +1 -1
- data/grid.gemspec +1 -1
- data/lib/grid.rb +9 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -173,17 +173,19 @@ Very little modification is needed to your existing test scripts. Essentially yo
|
|
173
173
|
require 'watir-webdriver'
|
174
174
|
browser = Watir::Browser.new :firefox
|
175
175
|
browser.goto("http://www.google.com")
|
176
|
-
browser.text_field(:name, 'q').set("
|
177
|
-
browser.button(:name
|
176
|
+
browser.text_field(:name, 'q').set("gridinit")
|
177
|
+
browser.button(:name => "btnG").click
|
178
|
+
browser.close
|
178
179
|
|
179
180
|
*New Code*
|
180
181
|
require 'grid'
|
181
182
|
Grid.control(
|
182
|
-
:controller_uri => 'druby://ec2-50-17-
|
183
|
+
:controller_uri => 'druby://ec2-50-17-172-40.compute-1.amazonaws.com:11235') do |browser, id|
|
183
184
|
puts "My remote browser id is #{id}"
|
184
185
|
browser.goto("http://www.google.com")
|
185
186
|
browser.text_field(:name, 'q').set("watirgrid")
|
186
|
-
browser.button(:name
|
187
|
+
browser.button(:name => "btnG").click
|
188
|
+
browser.close
|
187
189
|
end
|
188
190
|
|
189
191
|
In this example, we required the 'grid' gem and controlled a Grid object with the "control" method. This method requires the *:controller_uri* parameter obtained from step 3 and is passed a block of your existing watir code. The same method will yield an individual browser object (same as a Watir browser object) as well as a thread ID which you can use to help identify which node your code is executed on.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/grid.gemspec
CHANGED
data/lib/grid.rb
CHANGED
@@ -15,6 +15,7 @@ class Grid
|
|
15
15
|
# It involves some general block thuggery and could
|
16
16
|
# honestly benefit from some brutal refactoring...
|
17
17
|
def self.control(params = {}, &block)
|
18
|
+
$stdout.flush
|
18
19
|
log = Logger.new(STDOUT, 'daily')
|
19
20
|
log.level = params[:loglevel] || Logger::DEBUG
|
20
21
|
grid = Watir::Grid.new(params)
|
@@ -25,6 +26,7 @@ class Grid
|
|
25
26
|
grid.browsers.each_with_index do |browser, index|
|
26
27
|
sleep rampup(grid.size, params)
|
27
28
|
threads << Thread.new do
|
29
|
+
$stdout.flush
|
28
30
|
start = ::Time.now
|
29
31
|
log.debug("Browser #{index+1}##{Thread.current.object_id} start : #{::Time.now}")
|
30
32
|
log.debug("Browser #{index+1}##{Thread.current.object_id} architecture : #{browser[:architecture]}")
|
@@ -36,7 +38,13 @@ class Grid
|
|
36
38
|
log.debug("Browser #{index+1}##{Thread.current.object_id} elapsed : #{(::Time.now - start).to_i} secs")
|
37
39
|
end
|
38
40
|
end
|
39
|
-
|
41
|
+
begin
|
42
|
+
threads.each {|thread| thread.join}
|
43
|
+
rescue => e
|
44
|
+
puts e.inspect
|
45
|
+
puts e.backtrace
|
46
|
+
grid.release_tuples
|
47
|
+
end
|
40
48
|
grid.release_tuples
|
41
49
|
end
|
42
50
|
|
metadata
CHANGED