watirgrid 1.0.4.pre → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +28 -28
- data/Rakefile +1 -1
- data/bin/controller +12 -12
- data/bin/provider +32 -17
- data/lib/controller.rb +2 -4
- data/lib/provider.rb +4 -5
- data/lib/watirgrid.rb +1 -1
- data/watirgrid.gemspec +3 -3
- metadata +8 -11
data/README.rdoc
CHANGED
@@ -12,9 +12,9 @@ WatirGrid is built on Rinda which implements the Linda distributed computing par
|
|
12
12
|
In other words, WatirGrid allows multiple parallel processes to *_provide_* remote Watir objects in the form of tuple spaces across a grid network. This grid network is *_controlled_* by a ring server.
|
13
13
|
|
14
14
|
==== Key Terminology
|
15
|
-
The *controller* implements a repository of tuples (tuple space) that can be accessed concurrently. The controller hosts
|
15
|
+
The *controller* implements a repository of tuples (tuple space) that can be accessed concurrently. The controller also hosts a *ring* *server* which advertises these tuples across a grid network making it loosely coupled. Typically you will host one controller on a central machine. You will normally connect to this controller via a direct URI. You can also find this controller by its ring server, using a UDP broadcast for the ring server port.
|
16
16
|
|
17
|
-
The *providers* make remote Watir objects available to the tuple space hosted by the *
|
17
|
+
The *providers* make remote Watir objects available to the tuple space hosted by the *controller*. Typically you will host one or many providers on your grid network, for example, each PC may become a single provider of a Watir tuple in the form of an Internet Explorer, Firefox, Safari or WebDriver browser object.
|
18
18
|
|
19
19
|
=== Simple Example
|
20
20
|
|
@@ -22,51 +22,51 @@ Pick a server to host the 'controller' for the ring server and execute the follo
|
|
22
22
|
$ controller
|
23
23
|
|
24
24
|
This should find your external facing IP and start the corresponding DRb and Ring Servers:
|
25
|
-
Controller started on : druby://
|
26
|
-
Ring server started on: druby://143.238.105.61:12358
|
25
|
+
I, [2011-04-09 18:06:19 #1971] INFO -- : Controller started on : druby://127.0.0.1:11235
|
27
26
|
|
28
27
|
On each client PC, host the 'provider' for the distributed (DRb) Watir objects
|
29
|
-
$ provider
|
28
|
+
$ provider -b ie -c druby://127.0.0.1:11235
|
30
29
|
|
31
30
|
This should find the recently started Ring Server and register a tuple for the Watir object:
|
32
|
-
Provider started on : druby://
|
33
|
-
Controller found on : druby://
|
34
|
-
|
31
|
+
I, [2011-04-09 18:06:26 #1972] INFO -- : Provider started on : druby://127.0.0.1:11236
|
32
|
+
I, [2011-04-09 18:06:26 #1972] INFO -- : Controller found on : druby://127.0.0.1:11235
|
33
|
+
I, [2011-04-09 18:06:26 #1972] INFO -- : Provider registered : druby://127.0.0.1:11235
|
35
34
|
|
36
35
|
You will now be able to execute commands across remote browsers on your grid network.
|
37
36
|
|
38
37
|
e.g.
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
require 'watirgrid'
|
39
|
+
|
40
|
+
Watir::Grid.control(:controller_uri => 'druby://127.0.0.1:11235') do |browser, id|
|
41
|
+
puts "My remote browser id is #{id}"
|
42
|
+
browser.goto("http://www.google.com")
|
43
|
+
browser.text_field(:name, 'q').set("watirgrid")
|
44
|
+
browser.button(:name, "btnI").click
|
44
45
|
end
|
45
|
-
threads.each {|thread| thread.join}
|
46
46
|
|
47
47
|
You may wish to host the controller and providers on different machines in a real scenario. You can specify things like server hostnames, ports and access control lists for each of the different types of servers. For more help see:
|
48
48
|
$ controller --help
|
49
49
|
Usage: controller [options]
|
50
50
|
Specific options:
|
51
|
-
-H, --drb-server-host HOST Specify DRb Server interface to host on
|
52
|
-
-d, --drb-server-port PORT Specify DRb Server port to listen on
|
53
|
-
-h, --ring-server-host HOST Specify Ring Server interface to host on
|
54
|
-
-r, --ring-server-port PORT Specify Ring Server port to listen on
|
55
|
-
-a, --access-control-list ACLS Specify a comma separated Access Control List
|
56
|
-
-l, --log-level LEVEL Specify log level {DEBUG|INFO|ERROR}
|
51
|
+
-H, --drb-server-host [HOST] Specify DRb Server interface to host on
|
52
|
+
-d, --drb-server-port [PORT] Specify DRb Server port to listen on
|
53
|
+
-h, --ring-server-host [HOST] Specify Ring Server interface to host on
|
54
|
+
-r, --ring-server-port [PORT] Specify Ring Server port to listen on
|
55
|
+
-a, --access-control-list [ACLS] Specify a comma separated Access Control List
|
56
|
+
-l, --log-level [LEVEL] Specify log level {DEBUG|INFO|ERROR}
|
57
57
|
--help Show this message
|
58
58
|
|
59
59
|
$ provider --help
|
60
|
-
Usage: provider [options]
|
60
|
+
Usage: Usage: provider -b BROWSER_TYPE [options]
|
61
61
|
Specific options:
|
62
|
-
-H, --drb-server-host HOST Specify DRb Server interface to host on
|
63
|
-
-d, --drb-server-port PORT Specify DRb Server port to listen on
|
64
|
-
-h, --ring-server-host HOST Specify Ring Server host to connect to
|
65
|
-
-r, --ring-server-port PORT Specify Ring Server port to broadcast on
|
66
|
-
-c, --controller-uri URI Specify Controller URI e.g. druby://127.0.0.1:11235 to bypass Ring Server
|
67
62
|
-b, --browser-type TYPE Specify browser type to register {ie|firefox|safari|webdriver}
|
68
|
-
-
|
69
|
-
-
|
63
|
+
-c, --controller-uri [URI] Specify Controller URI e.g. druby://127.0.0.1:11235
|
64
|
+
-H, --drb-server-host [HOST] Specify DRb Server interface to host on
|
65
|
+
-d, --drb-server-port [PORT] Specify DRb Server port to listen on
|
66
|
+
-h, --ring-server-host [HOST] Specify Ring Server host to connect to
|
67
|
+
-r, --ring-server-port [PORT] Specify Ring Server port to broadcast on
|
68
|
+
-a, --access-control-list [ACL] Specify a comma separated Access Control List
|
69
|
+
-l, --log-level [LEVEL] Specify log level {DEBUG|INFO|ERROR}
|
70
70
|
--help Show this message
|
71
71
|
|
72
72
|
== Copyright
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
gem.email = "tim.koops@gmail.com"
|
10
10
|
gem.homepage = "http://github.com/90kts/watirgrid"
|
11
11
|
gem.authors = ["Tim Koopmans"]
|
12
|
-
gem.version = "1.0.4
|
12
|
+
gem.version = "1.0.4"
|
13
13
|
end
|
14
14
|
rescue LoadError
|
15
15
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
data/bin/controller
CHANGED
@@ -9,33 +9,33 @@ OptionParser.new do |opts|
|
|
9
9
|
opts.banner = "Usage: controller [options]"
|
10
10
|
opts.separator ""
|
11
11
|
opts.separator "Specific options:"
|
12
|
-
opts.on("-H
|
12
|
+
opts.on("-H", "--drb-server-host [HOST]", String,
|
13
13
|
"Specify DRb Server interface to host on") do |h|
|
14
14
|
options[:drb_server_host] = h || nil
|
15
15
|
end
|
16
|
-
opts.on("-d
|
16
|
+
opts.on("-d", "--drb-server-port [PORT]", Integer,
|
17
17
|
"Specify DRb Server port to listen on") do |d|
|
18
18
|
options[:drb_server_port] = d
|
19
|
-
end
|
20
|
-
opts.on("-h
|
19
|
+
end
|
20
|
+
opts.on("-h", "--ring-server-host [HOST]", String,
|
21
21
|
"Specify Ring Server interface to host on") do |h|
|
22
22
|
options[:ring_server_host] = h || nil
|
23
23
|
end
|
24
|
-
opts.on("-r
|
24
|
+
opts.on("-r", "--ring-server-port [PORT]", Integer,
|
25
25
|
"Specify Ring Server port to listen on") do |r|
|
26
|
-
options[:ring_server_port] = r
|
26
|
+
options[:ring_server_port] = r
|
27
27
|
end
|
28
|
-
opts.on("-a
|
28
|
+
opts.on("-a", "--access-control-list [ACLS]", Array,
|
29
29
|
"Specify a comma separated Access Control List") do |a|
|
30
30
|
options[:acls] = a
|
31
31
|
end
|
32
|
-
opts.on("-l
|
32
|
+
opts.on("-l", "--log-level [LEVEL]", String,
|
33
33
|
"Specify log level {DEBUG|INFO|ERROR}") do |l|
|
34
34
|
case l
|
35
35
|
when 'DEBUG'
|
36
36
|
options[:loglevel] = Logger::DEBUG
|
37
37
|
when 'INFO'
|
38
|
-
options[:loglevel] = Logger::INFO
|
38
|
+
options[:loglevel] = Logger::INFO
|
39
39
|
when 'ERROR'
|
40
40
|
options[:loglevel] = Logger::ERROR
|
41
41
|
else
|
@@ -49,9 +49,9 @@ OptionParser.new do |opts|
|
|
49
49
|
end.parse!
|
50
50
|
|
51
51
|
controller = Controller.new(
|
52
|
-
:drb_server_host
|
53
|
-
:drb_server_port => options[:drb_server_port] || 11235,
|
54
|
-
:ring_server_host => options[:ring_server_host],
|
52
|
+
:drb_server_host => options[:drb_server_host],
|
53
|
+
:drb_server_port => options[:drb_server_port] || 11235,
|
54
|
+
:ring_server_host => options[:ring_server_host],
|
55
55
|
:ring_server_port => options[:ring_server_port] || 12358,
|
56
56
|
:acls => options[:acls] || %w{ allow all },
|
57
57
|
:loglevel => options[:loglevel]
|
data/bin/provider
CHANGED
@@ -5,39 +5,39 @@ require 'provider'
|
|
5
5
|
require 'optparse'
|
6
6
|
|
7
7
|
options = {}
|
8
|
-
OptionParser.new do |opts|
|
9
|
-
opts.banner = "Usage: provider [options]"
|
8
|
+
optparse = OptionParser.new do |opts|
|
9
|
+
opts.banner = "Usage: provider -b BROWSER_TYPE [options]"
|
10
10
|
opts.separator ""
|
11
11
|
opts.separator "Specific options:"
|
12
|
-
opts.on("-
|
12
|
+
opts.on("-b", "--browser-type TYPE",
|
13
|
+
"Specify browser type to register {ie|firefox|safari|webdriver}") do |b|
|
14
|
+
options[:browser_type] = b
|
15
|
+
end
|
16
|
+
opts.on("-c", "--controller-uri [URI]",
|
17
|
+
"Specify Controller URI e.g. druby://127.0.0.1:11235") do |h|
|
18
|
+
options[:controller_uri] = h || nil
|
19
|
+
end
|
20
|
+
opts.on("-H", "--drb-server-host [HOST]",
|
13
21
|
"Specify DRb Server interface to host on") do |h|
|
14
22
|
options[:drb_server_host] = h || nil
|
15
23
|
end
|
16
|
-
opts.on("-d
|
24
|
+
opts.on("-d", "--drb-server-port [PORT]",
|
17
25
|
"Specify DRb Server port to listen on") do |d|
|
18
26
|
options[:drb_server_port] = d
|
19
27
|
end
|
20
|
-
opts.on("-h
|
28
|
+
opts.on("-h", "--ring-server-host [HOST]",
|
21
29
|
"Specify Ring Server host to connect to") do |h|
|
22
30
|
options[:ring_server_host] = h || nil
|
23
31
|
end
|
24
|
-
opts.on("-r
|
32
|
+
opts.on("-r", "--ring-server-port [PORT]",
|
25
33
|
"Specify Ring Server port to broadcast on") do |r|
|
26
34
|
options[:ring_server_port] = r
|
27
35
|
end
|
28
|
-
opts.on("-
|
29
|
-
"Specify Controller URI e.g. druby://127.0.0.1:11235 to bypass Ring Server") do |h|
|
30
|
-
options[:controller_uri] = h || nil
|
31
|
-
end
|
32
|
-
opts.on("-b TYPE", "--browser-type", String,
|
33
|
-
"Specify browser type to register {ie|firefox|safari}") do |b|
|
34
|
-
options[:browser_type] = b
|
35
|
-
end
|
36
|
-
opts.on("-a ACLS", "--access-control-list", Array,
|
36
|
+
opts.on("-a", "--access-control-list [ACL]", Array,
|
37
37
|
"Specify a comma separated Access Control List") do |a|
|
38
38
|
options[:acls] = a
|
39
39
|
end
|
40
|
-
opts.on("-l
|
40
|
+
opts.on("-l", "--log-level [LEVEL]",
|
41
41
|
"Specify log level {DEBUG|INFO|ERROR}") do |l|
|
42
42
|
case l
|
43
43
|
when 'DEBUG'
|
@@ -54,7 +54,22 @@ OptionParser.new do |opts|
|
|
54
54
|
puts opts
|
55
55
|
exit
|
56
56
|
end
|
57
|
-
end
|
57
|
+
end
|
58
|
+
|
59
|
+
begin
|
60
|
+
optparse.parse!
|
61
|
+
mandatory = [:browser_type]
|
62
|
+
missing = mandatory.select{ |param| options[param].nil? }
|
63
|
+
if not missing.empty?
|
64
|
+
puts "Missing options: #{missing.join(', ')}"
|
65
|
+
puts optparse
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
69
|
+
puts $!.to_s
|
70
|
+
puts optparse
|
71
|
+
exit
|
72
|
+
end
|
58
73
|
|
59
74
|
provider = Provider.new(
|
60
75
|
:drb_server_host => options[:drb_server_host],
|
data/lib/controller.rb
CHANGED
@@ -46,8 +46,6 @@ class Controller
|
|
46
46
|
@log = Logger.new(logfile, 'daily')
|
47
47
|
@log.level = params[:loglevel] || Logger::INFO
|
48
48
|
@log.datetime_format = "%Y-%m-%d %H:%M:%S "
|
49
|
-
|
50
|
-
@log.debug("DRB Server Port #{@drb_server_port}\nRing Server Port #{@ring_server_port}")
|
51
49
|
end
|
52
50
|
|
53
51
|
##
|
@@ -73,7 +71,7 @@ class Controller
|
|
73
71
|
|
74
72
|
# obtain Ring Server uri
|
75
73
|
@ring_server_uri = ring_server.uri
|
76
|
-
@log.
|
74
|
+
@log.debug("Ring Server started : #{@ring_server_uri}")
|
77
75
|
|
78
76
|
# abort all threads on an exception
|
79
77
|
Thread.abort_on_exception = true
|
@@ -86,7 +84,7 @@ class Controller
|
|
86
84
|
# Stop the controller by shutting down the DRb service
|
87
85
|
def stop
|
88
86
|
DRb.stop_service
|
89
|
-
@log.info("Controller stopped on: #{@drb_server_uri}")
|
87
|
+
@log.info("Controller stopped on : #{@drb_server_uri}")
|
90
88
|
end
|
91
89
|
|
92
90
|
private
|
data/lib/provider.rb
CHANGED
@@ -156,9 +156,8 @@ class Provider
|
|
156
156
|
# Start providing watir objects on the ring server
|
157
157
|
def start
|
158
158
|
# create a DRb 'front' object
|
159
|
-
@log.debug("About to create a watir_provider")
|
160
159
|
watir_provider = Watir::Provider.new(@browser_type)
|
161
|
-
@log.debug("
|
160
|
+
@log.debug("Watir provider is : #{watir_provider}")
|
162
161
|
architecture = Config::CONFIG['arch']
|
163
162
|
hostname = ENV['SERVER_NAME'] || %x{hostname}.strip
|
164
163
|
|
@@ -185,14 +184,14 @@ class Provider
|
|
185
184
|
]
|
186
185
|
|
187
186
|
# locate the Rinda Ring Server via a UDP broadcast
|
188
|
-
@log.debug("
|
187
|
+
@log.debug("Broadcast Ring Server : druby://#{@ring_server_host}:#{@ring_server_port}")
|
189
188
|
find_ring_server
|
190
189
|
|
191
190
|
# advertise this service on the primary remote tuple space
|
192
191
|
@ring_server.write(@tuple, @renewer)
|
193
192
|
|
194
193
|
# log DRb server uri
|
195
|
-
@log.info("
|
194
|
+
@log.info("Provider registered : #{@controller_uri}")
|
196
195
|
|
197
196
|
# wait for explicit stop via ctrl-c
|
198
197
|
DRb.thread.join if __FILE__ == $0
|
@@ -202,7 +201,7 @@ class Provider
|
|
202
201
|
# Stop the provider by shutting down the DRb service
|
203
202
|
def stop
|
204
203
|
DRb.stop_service
|
205
|
-
@log.info("
|
204
|
+
@log.info("Provider stopped on : #{@drb_server_uri}")
|
206
205
|
end
|
207
206
|
|
208
207
|
private
|
data/lib/watirgrid.rb
CHANGED
@@ -107,7 +107,7 @@ module Watir
|
|
107
107
|
drb_server = DRb.start_service(
|
108
108
|
"druby://#{@drb_server_host}:#{@drb_server_port}")
|
109
109
|
@drb_server_uri = drb_server.uri
|
110
|
-
@log.info("
|
110
|
+
@log.info("Watir Grid started on : #{@drb_server_uri}")
|
111
111
|
end
|
112
112
|
|
113
113
|
##
|
data/watirgrid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{watirgrid}
|
8
|
-
s.version = "1.0.4
|
8
|
+
s.version = "1.0.4"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tim Koopmans"]
|
12
|
-
s.date = %q{2011-04-
|
12
|
+
s.date = %q{2011-04-09}
|
13
13
|
s.description = %q{WatirGrid allows for distributed testing across a grid network using Watir.}
|
14
14
|
s.email = %q{tim.koops@gmail.com}
|
15
15
|
s.executables = ["controller", "listener", "provider"]
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watirgrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 4
|
10
|
-
|
11
|
-
version: 1.0.4.pre
|
10
|
+
version: 1.0.4
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Tim Koopmans
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-09 00:00:00 -07:00
|
20
19
|
default_executable:
|
21
20
|
dependencies: []
|
22
21
|
|
@@ -81,14 +80,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
81
|
none: false
|
83
82
|
requirements:
|
84
|
-
- - "
|
83
|
+
- - ">="
|
85
84
|
- !ruby/object:Gem::Version
|
86
|
-
hash:
|
85
|
+
hash: 3
|
87
86
|
segments:
|
88
|
-
-
|
89
|
-
|
90
|
-
- 1
|
91
|
-
version: 1.3.1
|
87
|
+
- 0
|
88
|
+
version: "0"
|
92
89
|
requirements: []
|
93
90
|
|
94
91
|
rubyforge_project:
|