views:

1343

answers:

1

Is there a good tutorial or does anyone have experience with setting this up ? I have a Testsuite.html which launches my tests in one browser atm. This is done in the integration-test lifecycle by the maven selenium plugin. I want to run my tests on multiple browsers. I couldn't find any documentation about selenium grid + maven. I hope somebody can help me.

Thanks in advance, kukudas

+6  A: 

Selenium Grid and maven are really not much different than Selenium and maven.

Grid is basically a drop-in replacement for selenium-rc. In our current setup we let the automated build system use Grid. It does this by simply changing the selenium-rc url (which is normally localhost:4444) to the grid's url.

Additionally we specify the browser string (*firefox, *iexplore, *opera or whatever) as a system property on the mvn command line, which we pick up when we initialize the selenium client libraries in our code.

So the way we've done it we basically set up 4 different build projects with different browser strings.

krosenvold
Btw.: Is it recommended to run the tests as html suits? i read a lot that this isn't actualy used its more like converting the code into java - junit. I think on one hand i have then more flexibility but on the other hand i have to convert my changes all the time unless it's minor changes.
kukudas
We *only* make java based junit tests. After a little initial investment, the flexibility you gain is tremendous. But we don't use the recorder, just firefox and firebug.
krosenvold
How do you launch hub ? Could this be done by the maven-selenium plugin ? Do you could provide a trivial sample? I did convert my test to junit, and start a selenium server with the maven plugin. Does startSeleniumSession() launches a RC ? I don't know how to launch the hub do i have to use ant?
kukudas
We just run hub standalone on a machine. Don't involve maven in starting hub, there's just needless pain down that path. And yes, hub starts with ant so just go with the flow and follow the hub guideline.
krosenvold
Hub and selenium rc can/should both just run as standalone applications in your environments. That's what they were designed for. So although you *can* probably start them from maven, we burnt a *lot* of hours finding out it's best to run it from a shell by itself
krosenvold
Hi, i followed your suggestions, and launched Hub and RC's by console, it seems to work if i call the Hub like this: selenium = new DefaultSelenium(host, port, "*opera", url); how can i make my junit tests run parallel and using all registered RC's for e.g. i want to run 2 tests parallel in ff+ie.
kukudas
I think it's time to ask another question on SO ;)
krosenvold
Our build system handles parallel builds, so we just start multiple builds, one for each browser. In that way we avoid the problem of parallel junit tests. There are ways to do that too, but it may be more trouble than it's worth.
krosenvold
Your right i should ask another question, i will mark your answer as solution thank you again.
kukudas