Selenium Grid 2 - Nodes

712 views
Skip to first unread message

vitorm

unread,
Apr 10, 2012, 1:00:57 PM4/10/12
to Selenium Users
Hi all!

Is there any documentation around on how to delegate what each node
will do/run? I've read somewhere that there is ways to do this, but
unfortunately I haven't found anything better than "look at the cood
and think of something" stuff so far.

So far I've started a hub and a couple of nodes (one default and one
IE only), but I don't know how to "intercept requests" (don't know if
this sounds right) to each of them, or if this is even possible/
plausible.

Thanks in advance!

François Reynaud

unread,
Apr 10, 2012, 1:41:59 PM4/10/12
to seleniu...@googlegroups.com
http://code.google.com/p/selenium/wiki/Grid2

What do you mean by "intercept request". Are you trying to use grid to modify the requests sent by the tests ?

François


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


vitorm

unread,
Apr 10, 2012, 4:45:51 PM4/10/12
to Selenium Users
Hm no. I want to know if there's a way to modify the hub behavior when
delegating a node to run a test, kinda like "extending" it. For
example, let's say I have 2 nodes, one that supports 5 FF instances
and the other one IE instance. How the hub will know the node it will
delegate the execution of the test? I want to understand how that
happens and if I can modify that behavior if needed.

It's more like a "understanding the grid structure" question rather
than a "how to do this or that" one, so sorry if this sounds too dumb/
confusing, I'm still trying to get the big picture.

Kevin O.

unread,
Apr 10, 2012, 9:02:15 PM4/10/12
to Selenium Users
>How the hub will know the node it will
>delegate the execution of the test?
It basically finds the first node that matches the requested
capabilities. Platform is a special case, but other than that it
matches browser name, version, and applicationName?? by string
comparison and no others.
If the node selection build in is not sufficient you can override it.
The easiest way to do that is to compile a class that implements
org.openqa.grid.internal.utils.CapabilityMatcher and make sure your
code is in the classpath before you start Selenium server with this
argument:
-capabilityMatcher:
(hub) a class implementing the CapabilityMatcher interface.
Defaults to
org.openqa.grid.internal.utils.DefaultCapabilityMatcher. Specify
the logic the hub will follow to define if a request can be
assigned to a node.Change this class if you want to have the
matching process use regular expression instead of exact match
for the version of the browser for instance.Al the nodes of a
grid instance wil use the same matcher, defined by the registry.

François Reynaud

unread,
Apr 11, 2012, 5:51:27 AM4/11/12
to seleniu...@googlegroups.com
You can extends everything in grid via plugins. For that you need to read the code though, no real doc here.
A plugin will replace the default proxy that is used to forward the tests to the nodes.
You hook into grid internals by having your new proxy implementing those interfaces :

https://github.com/krosenvold/Selenium2/tree/master/java/server/src/org/openqa/grid/internal/listeners
A tutorial, outdated here : https://github.com/freynaud/grid-plugin-tutorial

The logic for forwarding a new test is :
- take all the node, sort them by number of test running
- iterate throught them, the first one that is capable of running the new test will run it.
( capable of running is configurable by specifying your own capabilityMatcher )

vitorm

unread,
Apr 11, 2012, 8:26:07 AM4/11/12
to Selenium Users
Wow, that's exactly the kind of answer I was looking for :) I'll work
on those.

Thanks guys!

On 11 abr, 06:51, François Reynaud <francois.reyn...@gmail.com> wrote:
> You can extends everything in grid via plugins. For that you need to read
> the code though, no real doc here.
> A plugin will replace the default proxy that is used to forward the tests
> to the nodes.
> You hook into grid internals by having your new proxy implementing those
> interfaces :
>
> https://github.com/krosenvold/Selenium2/tree/master/java/server/src/o...
Reply all
Reply to author
Forward
0 new messages