I was surprised not to find any intelligent solution how run Selenium webdriver tests using Selenium Grid but running each test with multiple browsers. Preferably I'd like to have some kind of configuration (file, or hard coded) where I can specify all browsers I want my tests to run. And then each test would be run on each of those browsers.
I assume it is possible to write your own testrunner and place a loop iterating each test rung through all the browsers. But maybe someone knows a more elegant solution? Anyone has done this?
P.S. I have found solutions which advise duplicating the tests and specifying browser parameters for each test. I don't want that.
What I do is run my test at class level then create a TestNG.xml then inside there specify what classes I wish to run and what browsers they should run on. So my TestNG file would look something like:
Then because I'm running on Selenium Grid I pass parameters for browser and port in my code like so:
Hope this helps
I have solved this in a way that I specify different browser parameter for each TestNG suite.
I'm unfamiliar with Selenium Grid, but I know you can have Selenium open multiple browsers simultaneously by running each test on a different thread. You may want to look in to this.