watirgrid 0.0.7 → 0.0.8.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -5
- data/.gitignore +22 -22
- data/EXAMPLES.rdoc +131 -131
- data/HISTORY.rdoc +18 -18
- data/LICENSE +20 -20
- data/README.rdoc +82 -82
- data/Rakefile +44 -45
- data/bin/controller +59 -59
- data/bin/provider +63 -63
- data/examples/find_by_uuid.rb +28 -28
- data/examples/google.rb +18 -18
- data/examples/info.rb +13 -13
- data/examples/restart_firefox.rb +13 -13
- data/examples/simple.rb +18 -18
- data/lib/controller.rb +104 -104
- data/lib/provider.rb +228 -242
- data/lib/watirgrid.rb +167 -167
- data/spec/grid_spec.rb +148 -148
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +9 -9
- data/spec/stub.rb +48 -48
- data/spec/tuples_spec.rb +46 -46
- data/spec/utilities_spec.rb +50 -50
- data/spec/watir_spec.rb +59 -0
- data/spec/watirgrid_spec.rb +51 -51
- data/spec/webdriver_spec.rb +59 -0
- data/watirgrid.gemspec +32 -13
- metadata +36 -21
data/.document
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
README.rdoc
|
2
|
-
lib/**/*.rb
|
3
|
-
bin/*
|
4
|
-
features/**/*.feature
|
5
|
-
LICENSE
|
1
|
+
README.rdoc
|
2
|
+
lib/**/*.rb
|
3
|
+
bin/*
|
4
|
+
features/**/*.feature
|
5
|
+
LICENSE
|
data/.gitignore
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
## MAC OS
|
2
|
-
.DS_Store
|
3
|
-
|
4
|
-
## TEXTMATE
|
5
|
-
*.tmproj
|
6
|
-
tmtags
|
7
|
-
|
8
|
-
## EMACS
|
9
|
-
*~
|
10
|
-
\#*
|
11
|
-
.\#*
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.swp
|
15
|
-
|
16
|
-
## PROJECT::GENERAL
|
17
|
-
coverage
|
18
|
-
rdoc
|
19
|
-
doc
|
20
|
-
pkg
|
21
|
-
|
22
|
-
## PROJECT::SPECIFIC
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## PROJECT::GENERAL
|
17
|
+
coverage
|
18
|
+
rdoc
|
19
|
+
doc
|
20
|
+
pkg
|
21
|
+
|
22
|
+
## PROJECT::SPECIFIC
|
data/EXAMPLES.rdoc
CHANGED
@@ -1,132 +1,132 @@
|
|
1
|
-
= Common Examples
|
2
|
-
|
3
|
-
== Starting a Controller
|
4
|
-
A controller has the following startup options:
|
5
|
-
controller --help
|
6
|
-
Usage: controller [options]
|
7
|
-
Specific options:
|
8
|
-
-H, --drb-server-host HOST Specify DRb Server interface to host on
|
9
|
-
-d, --drb-server-port PORT Specify DRb Server port to listen on
|
10
|
-
-h, --ring-server-host HOST Specify Ring Server interface to host on
|
11
|
-
-r, --ring-server-port PORT Specify Ring Server port to listen on
|
12
|
-
-a, --access-control-list ACLS Specify a comma separated Access Control List
|
13
|
-
-l, --log-level LEVEL Specify log level {DEBUG|INFO|ERROR}
|
14
|
-
--help Show this message
|
15
|
-
|
16
|
-
=== Default
|
17
|
-
To start a controller with default settings:
|
18
|
-
$ controller
|
19
|
-
|
20
|
-
This will bind the controller to your external facing interface and register the ring server to listen on port 12358
|
21
|
-
e.g.
|
22
|
-
DRb server started on : druby://143.238.105.61:11235
|
23
|
-
Ring server started on: druby://143.238.105.61:12358
|
24
|
-
|
25
|
-
=== Start on specific interface or ports
|
26
|
-
To start a controller on specific interfaces or ports:
|
27
|
-
$ controller -H 127.0.0.1 -h 127.0.0.1 -d 12345 -r 54321
|
28
|
-
|
29
|
-
This will bind the controller to the localhost (127.0.0.1) with the DRb server listening on port 12345 and the ring server listening on port 54321
|
30
|
-
e.g.
|
31
|
-
DRb server started on : druby://127.0.0.1:12345
|
32
|
-
Ring server started on: druby://127.0.0.1:54321
|
33
|
-
|
34
|
-
|
35
|
-
=== Start with access control list
|
36
|
-
To start a controller with an access control list:
|
37
|
-
$ controller -a deny,all,allow,127.0.0.1 -H 127.0.0.1 -h 127.0.0.1
|
38
|
-
|
39
|
-
This will bind the controller to the localhost (127.0.0.1) and deny all access to the controller by default, whilst allowing access from localhost only. The ACL constructor takes an array of strings. The first string of a pair is always “allow” or “deny”, and it’s followed by the address or addresses to allow or deny access.
|
40
|
-
|
41
|
-
== Starting a Provider
|
42
|
-
A provider has similar startup options:
|
43
|
-
provider --help
|
44
|
-
# Usage: provider [options]
|
45
|
-
# Specific options:
|
46
|
-
# -H, --drb-server-host HOST Specify DRb Server interface to host on
|
47
|
-
# -d, --drb-server-port PORT Specify DRb Server port to listen on
|
48
|
-
# -h, --ring-server-host HOST Specify Ring Server host to connect to
|
49
|
-
# -r, --ring-server-port PORT Specify Ring Server port to broadcast on
|
50
|
-
# -b, --browser-type TYPE Specify browser type to register {ie|firefox|safari}
|
51
|
-
# -a, --access-control-list ACLS Specify a comma separated Access Control List
|
52
|
-
# -l, --log-level LEVEL Specify log level {DEBUG|INFO|ERROR}
|
53
|
-
# --help Show this message
|
54
|
-
|
55
|
-
=== Default
|
56
|
-
To start a controller with default settings:
|
57
|
-
$ provider
|
58
|
-
|
59
|
-
This will bind the provider to your external facing interface attempt to find the ring server on the default port of 12358
|
60
|
-
e.g.
|
61
|
-
DRb server started on : druby://143.238.105.61:11236
|
62
|
-
Ring server found on : druby://143.238.105.61:12358
|
63
|
-
New tuple registered : druby://143.238.105.61:12358
|
64
|
-
|
65
|
-
=== Start on specific interface or ports
|
66
|
-
To start a provider on specific interfaces or ports:
|
67
|
-
$ provider -r 12358 -h 143.238.105.61
|
68
|
-
|
69
|
-
This will attempt to find the ring server on the port and hostname specifed
|
70
|
-
e.g.
|
71
|
-
DRb server started on : druby://143.238.105.61:11236
|
72
|
-
Ring server found on : druby://143.238.105.61:12358
|
73
|
-
New tuple registered : druby://143.238.105.61:12358
|
74
|
-
|
75
|
-
=== Start with access control list
|
76
|
-
To start a controller with an access control list:
|
77
|
-
$ provider -a deny,all,allow,127.0.0.1
|
78
|
-
|
79
|
-
This will deny all access by default and allow access to this provider on localhost only.
|
80
|
-
|
81
|
-
=== Start with a specific browser supported
|
82
|
-
By default, the provider will try to instantiate a browser object based on availability with your operating system e.g. Internet Explorer, Firefox or Safari. You can force provision of a set browser type as follows:
|
83
|
-
$ provider -b safari
|
84
|
-
|
85
|
-
This will provide a Safari browser object. Other options are:
|
86
|
-
$ provider -b ie
|
87
|
-
$ provider -b firefox
|
88
|
-
|
89
|
-
== Consuming Browser Objects on the Grid
|
90
|
-
Watir has been extended with a Grid class that can be used as follows:
|
91
|
-
require 'rubygems'
|
92
|
-
require 'watirgrid'
|
93
|
-
|
94
|
-
grid = Watir::Grid.new(:ring_server_port => 12358)
|
95
|
-
grid.start(:quantity => 1, :read_all => true, :browser_type => 'ie')
|
96
|
-
threads = []
|
97
|
-
grid.browsers.each do |browser|
|
98
|
-
threads << Thread.new do
|
99
|
-
b = browser[:object].new_browser
|
100
|
-
b.goto("http://www.google.com")
|
101
|
-
b.text_field(:name, 'q').set("watirgrid")
|
102
|
-
b.button(:name, "btnI").click
|
103
|
-
end
|
104
|
-
end
|
105
|
-
threads.each {|thread| thread.join}
|
106
|
-
|
107
|
-
Stepping through this example we first instantiate a browsers object, specifying which ring server port to broadcast on when looking for available providers:
|
108
|
-
grid = Watir::Grid.new(:ring_server_port => 12358)
|
109
|
-
|
110
|
-
You may also need to tell the code which host the ring server is on:
|
111
|
-
grid = Watir::Grid.new(:ring_server_port => 12358, :ring_server_host => 143.238.105.61)
|
112
|
-
|
113
|
-
Next we start up the grid, specifying the number of browsers we wish to use, and the method of accessing the tuple space:
|
114
|
-
grid.start(:quantity => 1, :read_all => true)
|
115
|
-
|
116
|
-
There are two methods for accessing the tuple space.
|
117
|
-
:read_all => true
|
118
|
-
:take_all => true
|
119
|
-
*Read* *All* will read all browsers in the tuple space provided by the providers. This leaves the tuple open to other clients.
|
120
|
-
|
121
|
-
*Take* *All* will take all browsers in the tuple space in a destructive manner. That is, once a tuple has been taken, no other clients will be able to re-use that tuple. This is useful if you do not want concurrent access to the same host, for example, multiple browsers running on the one machine.
|
122
|
-
|
123
|
-
The quantity attribute will determine how many browsers are accessed.
|
124
|
-
:quantity => 10
|
125
|
-
Will attempt to access 10 tuples if they are available.
|
126
|
-
|
127
|
-
Other attributes include:
|
128
|
-
:hostnames => { "localhost" => "127.0.0.1"}
|
129
|
-
Will determine which providers identified by a hash of hostnames that should be accessed. Useful if trying to limit the test to run from specific hostnames or IP addresses.
|
130
|
-
|
131
|
-
:browser_type => 'firefox'
|
1
|
+
= Common Examples
|
2
|
+
|
3
|
+
== Starting a Controller
|
4
|
+
A controller has the following startup options:
|
5
|
+
controller --help
|
6
|
+
Usage: controller [options]
|
7
|
+
Specific options:
|
8
|
+
-H, --drb-server-host HOST Specify DRb Server interface to host on
|
9
|
+
-d, --drb-server-port PORT Specify DRb Server port to listen on
|
10
|
+
-h, --ring-server-host HOST Specify Ring Server interface to host on
|
11
|
+
-r, --ring-server-port PORT Specify Ring Server port to listen on
|
12
|
+
-a, --access-control-list ACLS Specify a comma separated Access Control List
|
13
|
+
-l, --log-level LEVEL Specify log level {DEBUG|INFO|ERROR}
|
14
|
+
--help Show this message
|
15
|
+
|
16
|
+
=== Default
|
17
|
+
To start a controller with default settings:
|
18
|
+
$ controller
|
19
|
+
|
20
|
+
This will bind the controller to your external facing interface and register the ring server to listen on port 12358
|
21
|
+
e.g.
|
22
|
+
DRb server started on : druby://143.238.105.61:11235
|
23
|
+
Ring server started on: druby://143.238.105.61:12358
|
24
|
+
|
25
|
+
=== Start on specific interface or ports
|
26
|
+
To start a controller on specific interfaces or ports:
|
27
|
+
$ controller -H 127.0.0.1 -h 127.0.0.1 -d 12345 -r 54321
|
28
|
+
|
29
|
+
This will bind the controller to the localhost (127.0.0.1) with the DRb server listening on port 12345 and the ring server listening on port 54321
|
30
|
+
e.g.
|
31
|
+
DRb server started on : druby://127.0.0.1:12345
|
32
|
+
Ring server started on: druby://127.0.0.1:54321
|
33
|
+
|
34
|
+
|
35
|
+
=== Start with access control list
|
36
|
+
To start a controller with an access control list:
|
37
|
+
$ controller -a deny,all,allow,127.0.0.1 -H 127.0.0.1 -h 127.0.0.1
|
38
|
+
|
39
|
+
This will bind the controller to the localhost (127.0.0.1) and deny all access to the controller by default, whilst allowing access from localhost only. The ACL constructor takes an array of strings. The first string of a pair is always “allow” or “deny”, and it’s followed by the address or addresses to allow or deny access.
|
40
|
+
|
41
|
+
== Starting a Provider
|
42
|
+
A provider has similar startup options:
|
43
|
+
provider --help
|
44
|
+
# Usage: provider [options]
|
45
|
+
# Specific options:
|
46
|
+
# -H, --drb-server-host HOST Specify DRb Server interface to host on
|
47
|
+
# -d, --drb-server-port PORT Specify DRb Server port to listen on
|
48
|
+
# -h, --ring-server-host HOST Specify Ring Server host to connect to
|
49
|
+
# -r, --ring-server-port PORT Specify Ring Server port to broadcast on
|
50
|
+
# -b, --browser-type TYPE Specify browser type to register {ie|firefox|safari}
|
51
|
+
# -a, --access-control-list ACLS Specify a comma separated Access Control List
|
52
|
+
# -l, --log-level LEVEL Specify log level {DEBUG|INFO|ERROR}
|
53
|
+
# --help Show this message
|
54
|
+
|
55
|
+
=== Default
|
56
|
+
To start a controller with default settings:
|
57
|
+
$ provider
|
58
|
+
|
59
|
+
This will bind the provider to your external facing interface attempt to find the ring server on the default port of 12358
|
60
|
+
e.g.
|
61
|
+
DRb server started on : druby://143.238.105.61:11236
|
62
|
+
Ring server found on : druby://143.238.105.61:12358
|
63
|
+
New tuple registered : druby://143.238.105.61:12358
|
64
|
+
|
65
|
+
=== Start on specific interface or ports
|
66
|
+
To start a provider on specific interfaces or ports:
|
67
|
+
$ provider -r 12358 -h 143.238.105.61
|
68
|
+
|
69
|
+
This will attempt to find the ring server on the port and hostname specifed
|
70
|
+
e.g.
|
71
|
+
DRb server started on : druby://143.238.105.61:11236
|
72
|
+
Ring server found on : druby://143.238.105.61:12358
|
73
|
+
New tuple registered : druby://143.238.105.61:12358
|
74
|
+
|
75
|
+
=== Start with access control list
|
76
|
+
To start a controller with an access control list:
|
77
|
+
$ provider -a deny,all,allow,127.0.0.1
|
78
|
+
|
79
|
+
This will deny all access by default and allow access to this provider on localhost only.
|
80
|
+
|
81
|
+
=== Start with a specific browser supported
|
82
|
+
By default, the provider will try to instantiate a browser object based on availability with your operating system e.g. Internet Explorer, Firefox or Safari. You can force provision of a set browser type as follows:
|
83
|
+
$ provider -b safari
|
84
|
+
|
85
|
+
This will provide a Safari browser object. Other options are:
|
86
|
+
$ provider -b ie
|
87
|
+
$ provider -b firefox
|
88
|
+
|
89
|
+
== Consuming Browser Objects on the Grid
|
90
|
+
Watir has been extended with a Grid class that can be used as follows:
|
91
|
+
require 'rubygems'
|
92
|
+
require 'watirgrid'
|
93
|
+
|
94
|
+
grid = Watir::Grid.new(:ring_server_port => 12358)
|
95
|
+
grid.start(:quantity => 1, :read_all => true, :browser_type => 'ie')
|
96
|
+
threads = []
|
97
|
+
grid.browsers.each do |browser|
|
98
|
+
threads << Thread.new do
|
99
|
+
b = browser[:object].new_browser
|
100
|
+
b.goto("http://www.google.com")
|
101
|
+
b.text_field(:name, 'q').set("watirgrid")
|
102
|
+
b.button(:name, "btnI").click
|
103
|
+
end
|
104
|
+
end
|
105
|
+
threads.each {|thread| thread.join}
|
106
|
+
|
107
|
+
Stepping through this example we first instantiate a browsers object, specifying which ring server port to broadcast on when looking for available providers:
|
108
|
+
grid = Watir::Grid.new(:ring_server_port => 12358)
|
109
|
+
|
110
|
+
You may also need to tell the code which host the ring server is on:
|
111
|
+
grid = Watir::Grid.new(:ring_server_port => 12358, :ring_server_host => 143.238.105.61)
|
112
|
+
|
113
|
+
Next we start up the grid, specifying the number of browsers we wish to use, and the method of accessing the tuple space:
|
114
|
+
grid.start(:quantity => 1, :read_all => true)
|
115
|
+
|
116
|
+
There are two methods for accessing the tuple space.
|
117
|
+
:read_all => true
|
118
|
+
:take_all => true
|
119
|
+
*Read* *All* will read all browsers in the tuple space provided by the providers. This leaves the tuple open to other clients.
|
120
|
+
|
121
|
+
*Take* *All* will take all browsers in the tuple space in a destructive manner. That is, once a tuple has been taken, no other clients will be able to re-use that tuple. This is useful if you do not want concurrent access to the same host, for example, multiple browsers running on the one machine.
|
122
|
+
|
123
|
+
The quantity attribute will determine how many browsers are accessed.
|
124
|
+
:quantity => 10
|
125
|
+
Will attempt to access 10 tuples if they are available.
|
126
|
+
|
127
|
+
Other attributes include:
|
128
|
+
:hostnames => { "localhost" => "127.0.0.1"}
|
129
|
+
Will determine which providers identified by a hash of hostnames that should be accessed. Useful if trying to limit the test to run from specific hostnames or IP addresses.
|
130
|
+
|
131
|
+
:browser_type => 'firefox'
|
132
132
|
Will determine which providers identified by a browser type should be accessed. Useful if trying to to test with specific browser types.
|
data/HISTORY.rdoc
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
== Release Notes
|
2
|
-
=== 0.0.1
|
3
|
-
Added access control lists for the controller and provider. This lets the user specify ACLs by way of simple white/blacklist security similar to that used by the Unix /etc/hosts.allow and /etc/hosts.deny files. The ACL constructor takes an array of strings. The first string of a pair is always “allow” or “deny”, and it’s followed by the address or addresses to allow or deny access.
|
4
|
-
|
5
|
-
e.g.
|
6
|
-
provider.rb -a deny,all,allow,127.0.0.1
|
7
|
-
This would deny all access to this provider by default and allow access only from the localhost (127.0.0.1). This is the default setting if no ACLs are specified from the command line. This would affect all connectivity from the controller to the providers.
|
8
|
-
|
9
|
-
e.g.
|
10
|
-
controller -a deny,all,allow,192.168.1.*
|
11
|
-
This would deny all access to the controller by default with access allowed from any host in the 192.168.1.* subnet. This would affect all connectivity from the providers to the controller.
|
12
|
-
|
13
|
-
Added startup bin scripts for the provider and controller. Ruby Gems will automatically deploy these on installation.
|
14
|
-
|
15
|
-
---
|
16
|
-
=== 0.0.2
|
17
|
-
Allowed specification of remote host for ring server with -h option on provider.
|
18
|
-
|
1
|
+
== Release Notes
|
2
|
+
=== 0.0.1
|
3
|
+
Added access control lists for the controller and provider. This lets the user specify ACLs by way of simple white/blacklist security similar to that used by the Unix /etc/hosts.allow and /etc/hosts.deny files. The ACL constructor takes an array of strings. The first string of a pair is always “allow” or “deny”, and it’s followed by the address or addresses to allow or deny access.
|
4
|
+
|
5
|
+
e.g.
|
6
|
+
provider.rb -a deny,all,allow,127.0.0.1
|
7
|
+
This would deny all access to this provider by default and allow access only from the localhost (127.0.0.1). This is the default setting if no ACLs are specified from the command line. This would affect all connectivity from the controller to the providers.
|
8
|
+
|
9
|
+
e.g.
|
10
|
+
controller -a deny,all,allow,192.168.1.*
|
11
|
+
This would deny all access to the controller by default with access allowed from any host in the 192.168.1.* subnet. This would affect all connectivity from the providers to the controller.
|
12
|
+
|
13
|
+
Added startup bin scripts for the provider and controller. Ruby Gems will automatically deploy these on installation.
|
14
|
+
|
15
|
+
---
|
16
|
+
=== 0.0.2
|
17
|
+
Allowed specification of remote host for ring server with -h option on provider.
|
18
|
+
|
data/LICENSE
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c) 2009 Tim Koopmans
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2009 Tim Koopmans
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -1,82 +1,82 @@
|
|
1
|
-
= WatirGrid
|
2
|
-
|
3
|
-
WatirGrid allows for distributed testing across a grid network using Watir.
|
4
|
-
|
5
|
-
== Getting Started
|
6
|
-
This gem is hosted on Gemcutter. Gemcutter is the next generation of gem hosting for the Ruby community. To get started:
|
7
|
-
gem install gemcutter
|
8
|
-
gem tumble
|
9
|
-
|
10
|
-
Then to install WatirGrid:
|
11
|
-
gem install watirgrid
|
12
|
-
|
13
|
-
=== The Basics
|
14
|
-
WatirGrid is built on Rinda which implements the Linda distributed computing paradigm in Ruby. According to Wikipedia: “Linda is a model of coordination and communication among several parallel processes operating upon objects stored in and retrieved from shared, virtual, associative memory.”
|
15
|
-
|
16
|
-
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.
|
17
|
-
|
18
|
-
==== Key Terminology
|
19
|
-
The *controller* implements a repository of tuples (tuple space) that can be accessed concurrently. The controller hosts the *ring* *server* which advertises these tuples across a grid network. Typically you will host one controller on a central machine.
|
20
|
-
|
21
|
-
The *providers* make remote Watir objects available to the tuple space hosted by the *ring* *server*. 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 or Safari browser object.
|
22
|
-
|
23
|
-
=== Simple Example
|
24
|
-
|
25
|
-
Pick a server to host the 'controller' for the ring server and execute the following:
|
26
|
-
$ controller
|
27
|
-
|
28
|
-
This should find your external facing IP and start the corresponding DRb and Ring Servers:
|
29
|
-
DRb server started on : druby://143.238.105.61:11235
|
30
|
-
Ring server started on: druby://143.238.105.61:12358
|
31
|
-
|
32
|
-
On each client PC, host the 'provider' for the distributed (DRb) Watir objects
|
33
|
-
$ provider
|
34
|
-
|
35
|
-
This should find the recently started Ring Server and register a tuple for the Watir object:
|
36
|
-
DRb server started on : druby://143.238.105.61:11236
|
37
|
-
Ring server found on : druby://143.238.105.61:12358
|
38
|
-
New tuple registered : druby://143.238.105.61:12358
|
39
|
-
|
40
|
-
You will now be able to execute commands across remote browsers on your grid network.
|
41
|
-
|
42
|
-
e.g.
|
43
|
-
grid = Watir::Grid.new(:ring_server_port => 12358)
|
44
|
-
grid.start(:quantity => 1, :read_all => true)
|
45
|
-
threads = []
|
46
|
-
grid.browsers.each do |browser|
|
47
|
-
threads << Thread.new do
|
48
|
-
b = browser[:object].new_browser
|
49
|
-
b.goto("http://www.google.com")
|
50
|
-
b.text_field(:name, 'q').set("watirgrid")
|
51
|
-
b.button(:name, "btnI").click
|
52
|
-
end
|
53
|
-
end
|
54
|
-
threads.each {|thread| thread.join}
|
55
|
-
|
56
|
-
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:
|
57
|
-
$ controller --help
|
58
|
-
Usage: controller [options]
|
59
|
-
Specific options:
|
60
|
-
-H, --drb-server-host HOST Specify DRb Server interface to host on
|
61
|
-
-d, --drb-server-port PORT Specify DRb Server port to listen on
|
62
|
-
-h, --ring-server-host HOST Specify Ring Server interface to host on
|
63
|
-
-r, --ring-server-port PORT Specify Ring Server port to listen on
|
64
|
-
-a, --access-control-list ACLS Specify a comma separated Access Control List
|
65
|
-
-l, --log-level LEVEL Specify log level {DEBUG|INFO|ERROR}
|
66
|
-
--help Show this message
|
67
|
-
|
68
|
-
$ provider --help
|
69
|
-
Usage: provider [options]
|
70
|
-
Specific options:
|
71
|
-
-H, --drb-server-host HOST Specify DRb Server interface to host on
|
72
|
-
-d, --drb-server-port PORT Specify DRb Server port to listen on
|
73
|
-
-h, --ring-server-host HOST Specify Ring Server host to connect to
|
74
|
-
-r, --ring-server-port PORT Specify Ring Server port to broadcast on
|
75
|
-
-b, --browser-type TYPE Specify browser type to register {ie|firefox|safari}
|
76
|
-
-a, --access-control-list ACLS Specify a comma separated Access Control List
|
77
|
-
-l, --log-level LEVEL Specify log level {DEBUG|INFO|ERROR}
|
78
|
-
--help Show this message
|
79
|
-
|
80
|
-
== Copyright
|
81
|
-
|
82
|
-
Copyright (c) 2009 Tim Koopmans. See LICENSE for details.
|
1
|
+
= WatirGrid
|
2
|
+
|
3
|
+
WatirGrid allows for distributed testing across a grid network using Watir.
|
4
|
+
|
5
|
+
== Getting Started
|
6
|
+
This gem is hosted on Gemcutter. Gemcutter is the next generation of gem hosting for the Ruby community. To get started:
|
7
|
+
gem install gemcutter
|
8
|
+
gem tumble
|
9
|
+
|
10
|
+
Then to install WatirGrid:
|
11
|
+
gem install watirgrid
|
12
|
+
|
13
|
+
=== The Basics
|
14
|
+
WatirGrid is built on Rinda which implements the Linda distributed computing paradigm in Ruby. According to Wikipedia: “Linda is a model of coordination and communication among several parallel processes operating upon objects stored in and retrieved from shared, virtual, associative memory.”
|
15
|
+
|
16
|
+
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.
|
17
|
+
|
18
|
+
==== Key Terminology
|
19
|
+
The *controller* implements a repository of tuples (tuple space) that can be accessed concurrently. The controller hosts the *ring* *server* which advertises these tuples across a grid network. Typically you will host one controller on a central machine.
|
20
|
+
|
21
|
+
The *providers* make remote Watir objects available to the tuple space hosted by the *ring* *server*. 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 or Safari browser object.
|
22
|
+
|
23
|
+
=== Simple Example
|
24
|
+
|
25
|
+
Pick a server to host the 'controller' for the ring server and execute the following:
|
26
|
+
$ controller
|
27
|
+
|
28
|
+
This should find your external facing IP and start the corresponding DRb and Ring Servers:
|
29
|
+
DRb server started on : druby://143.238.105.61:11235
|
30
|
+
Ring server started on: druby://143.238.105.61:12358
|
31
|
+
|
32
|
+
On each client PC, host the 'provider' for the distributed (DRb) Watir objects
|
33
|
+
$ provider
|
34
|
+
|
35
|
+
This should find the recently started Ring Server and register a tuple for the Watir object:
|
36
|
+
DRb server started on : druby://143.238.105.61:11236
|
37
|
+
Ring server found on : druby://143.238.105.61:12358
|
38
|
+
New tuple registered : druby://143.238.105.61:12358
|
39
|
+
|
40
|
+
You will now be able to execute commands across remote browsers on your grid network.
|
41
|
+
|
42
|
+
e.g.
|
43
|
+
grid = Watir::Grid.new(:ring_server_port => 12358)
|
44
|
+
grid.start(:quantity => 1, :read_all => true)
|
45
|
+
threads = []
|
46
|
+
grid.browsers.each do |browser|
|
47
|
+
threads << Thread.new do
|
48
|
+
b = browser[:object].new_browser
|
49
|
+
b.goto("http://www.google.com")
|
50
|
+
b.text_field(:name, 'q').set("watirgrid")
|
51
|
+
b.button(:name, "btnI").click
|
52
|
+
end
|
53
|
+
end
|
54
|
+
threads.each {|thread| thread.join}
|
55
|
+
|
56
|
+
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:
|
57
|
+
$ controller --help
|
58
|
+
Usage: controller [options]
|
59
|
+
Specific options:
|
60
|
+
-H, --drb-server-host HOST Specify DRb Server interface to host on
|
61
|
+
-d, --drb-server-port PORT Specify DRb Server port to listen on
|
62
|
+
-h, --ring-server-host HOST Specify Ring Server interface to host on
|
63
|
+
-r, --ring-server-port PORT Specify Ring Server port to listen on
|
64
|
+
-a, --access-control-list ACLS Specify a comma separated Access Control List
|
65
|
+
-l, --log-level LEVEL Specify log level {DEBUG|INFO|ERROR}
|
66
|
+
--help Show this message
|
67
|
+
|
68
|
+
$ provider --help
|
69
|
+
Usage: provider [options]
|
70
|
+
Specific options:
|
71
|
+
-H, --drb-server-host HOST Specify DRb Server interface to host on
|
72
|
+
-d, --drb-server-port PORT Specify DRb Server port to listen on
|
73
|
+
-h, --ring-server-host HOST Specify Ring Server host to connect to
|
74
|
+
-r, --ring-server-port PORT Specify Ring Server port to broadcast on
|
75
|
+
-b, --browser-type TYPE Specify browser type to register {ie|firefox|safari}
|
76
|
+
-a, --access-control-list ACLS Specify a comma separated Access Control List
|
77
|
+
-l, --log-level LEVEL Specify log level {DEBUG|INFO|ERROR}
|
78
|
+
--help Show this message
|
79
|
+
|
80
|
+
== Copyright
|
81
|
+
|
82
|
+
Copyright (c) 2009 Tim Koopmans. See LICENSE for details.
|