Selenium Grid + Maven 2
Asked Answered
C

1

6

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

Cheyenne answered 5/2, 2009 at 9:43 Comment(0)
H
7

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.

Hammerskjold answered 5/2, 2009 at 9:49 Comment(11)
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.Cheyenne
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.Hammerskjold
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?Cheyenne
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.Hammerskjold
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 itselfHammerskjold
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.Cheyenne
I think it's time to ask another question on SO ;)Hammerskjold
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.Hammerskjold
Your right i should ask another question, i will mark your answer as solution thank you again.Cheyenne
@Hammerskjold what's the point of using hub, then? You add a middleman (the hub, possibly on a machine different than hudson AND from real selenium RCs) while you could just configure the build system to use real RCs addresses instead of the hub's. The only benefit I can see in reward is single place where real RC locations can be configured for multiple projects, which (with maven) could be acheived by defining them in hudson's ~/.m2/settings.xml. Am I wrong? Doesn't your solution impair the tests' performance?Jabez
Well, ok: there is additional benefit of a queue for every real RC, which can help during simultaneous hudson builds of two selenium-tested projectsJabez

© 2022 - 2024 — McMap. All rights reserved.