- manvya
- Posts : 3
Join date : 2011-08-31
How to Set up Grid 2 in selenium RC using TestNG for executing Tests Parallel?
Thu Dec 08, 2011 8:14 pm
Hi,
I have done the following process to make the RC work as Grid for Parallel execution in TestNG:
I have downloaded the selenium-server-standalone-2.1.0.jar. Also I have my TestNG test cases.
And i have a test xml like :
test name="FFTest" preserve-order="true"
parameter name="selenium.host" value="localhost">
parameter name="selenium.port" value="5569">
parameter name="selenium.browser" value="*firefox">
parameter name="selenium.url" value="http://www.google.com">
classes
class name="EmployeeHealth.TestScripts.EmployeeHealthRegressionSuite"
methods>
include name="InitScript">
include name="SelectAvoidableAdmissionModule">
methods>
class>
classes>
test> test name="IETest" preserve-order="true"
parameter name="selenium.host" value="localhost">
parameter name="selenium.port" value="5579">
parameter name="selenium.browser" value="*iehta">
parameter name="selenium.url" value="http://www.google.com">
classes
class name="EmployeeHealth.TestScripts.EmployeeHealthRegressionSuite"
methods>
include name="InitScript">
include name="SelectAvoidableAdmissionModule">
methods>
class>
classes>
test>
And I followed the below steps:
Start Hub:
java -jar selenium-server-standalone-2.5.0.jar -role hub
Start remote control supporting Firefox
java -jar selenium-server-standalone-2.5.0.jar -role RC -hub http://localhost:4444/grid/register -browser browserName=firefox,platform=WINDOWS -port 5579
Start another RC supporting Internet explore
java -jar selenium-server-standalone-2.5.0.jar -role RC -hub http://localhost:4444/grid/register -browser browserName=iexplore,platform=WINDOWS -port 5556.
And in my SetUp.java file, Am creating the selenium objects like:
selenium = new DefaultSelenium(host,Integer.parseInt(port),
browser, url);
if ( browser.equalsIgnoreCase("*chrome")) {
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setFirefoxProfileTemplate(new File(
"test\\Resources\\ThirdParty\\FirefoxProfile\"));
seleniumServer = new SeleniumServer(rcc);
} else {
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setFirefoxProfileTemplate(new File("Object Repository\\SSL"));
//"src\\Script\\lib\\ThirdParty\\FirefoxProfile\"));C:\\Biju\\NewFrameworkStrcuture\\Framework\\ABC_JSAF\\
seleniumServer = new SeleniumServer(rcc);
RemoteControlConfiguration a= seleniumServer.getConfiguration();
File uimap=new File("src\\Script\\lib\\user-extensions.js");
a.setUserExtensions(uimap);
//seleniumServer = new SeleniumServer();
}
http://seleniumServer.start();
selenium.start();
selenium.windowMaximize();
selenium.windowFocus();
By this way, when am running the xml file, the tests are running in sequence(First Firefox and then the IE). But not in parallel.
Also i tried giving the @Test parameter like
@Test(dataProvider="CommonTestData",threadPoolSize = 3)
But i dont see any change in the seqence.
do any one got why this is happening?..
Appreciate for your help.
I have done the following process to make the RC work as Grid for Parallel execution in TestNG:
I have downloaded the selenium-server-standalone-2.1.0.jar. Also I have my TestNG test cases.
And i have a test xml like :
test name="FFTest" preserve-order="true"
parameter name="selenium.host" value="localhost">
parameter name="selenium.port" value="5569">
parameter name="selenium.browser" value="*firefox">
parameter name="selenium.url" value="http://www.google.com">
classes
class name="EmployeeHealth.TestScripts.EmployeeHealthRegressionSuite"
methods>
include name="InitScript">
include name="SelectAvoidableAdmissionModule">
methods>
class>
classes>
test> test name="IETest" preserve-order="true"
parameter name="selenium.host" value="localhost">
parameter name="selenium.port" value="5579">
parameter name="selenium.browser" value="*iehta">
parameter name="selenium.url" value="http://www.google.com">
classes
class name="EmployeeHealth.TestScripts.EmployeeHealthRegressionSuite"
methods>
include name="InitScript">
include name="SelectAvoidableAdmissionModule">
methods>
class>
classes>
test>
And I followed the below steps:
Start Hub:
java -jar selenium-server-standalone-2.5.0.jar -role hub
Start remote control supporting Firefox
java -jar selenium-server-standalone-2.5.0.jar -role RC -hub http://localhost:4444/grid/register -browser browserName=firefox,platform=WINDOWS -port 5579
Start another RC supporting Internet explore
java -jar selenium-server-standalone-2.5.0.jar -role RC -hub http://localhost:4444/grid/register -browser browserName=iexplore,platform=WINDOWS -port 5556.
And in my SetUp.java file, Am creating the selenium objects like:
selenium = new DefaultSelenium(host,Integer.parseInt(port),
browser, url);
if ( browser.equalsIgnoreCase("*chrome")) {
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setFirefoxProfileTemplate(new File(
"test\\Resources\\ThirdParty\\FirefoxProfile\"));
seleniumServer = new SeleniumServer(rcc);
} else {
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setFirefoxProfileTemplate(new File("Object Repository\\SSL"));
//"src\\Script\\lib\\ThirdParty\\FirefoxProfile\"));C:\\Biju\\NewFrameworkStrcuture\\Framework\\ABC_JSAF\\
seleniumServer = new SeleniumServer(rcc);
RemoteControlConfiguration a= seleniumServer.getConfiguration();
File uimap=new File("src\\Script\\lib\\user-extensions.js");
a.setUserExtensions(uimap);
//seleniumServer = new SeleniumServer();
}
http://seleniumServer.start();
selenium.start();
selenium.windowMaximize();
selenium.windowFocus();
By this way, when am running the xml file, the tests are running in sequence(First Firefox and then the IE). But not in parallel.
Also i tried giving the @Test parameter like
@Test(dataProvider="CommonTestData",threadPoolSize = 3)
But i dont see any change in the seqence.
do any one got why this is happening?..
Appreciate for your help.
Permissions in this forum:
You cannot reply to topics in this forum