Model 24 Part 3 : Run test cases on Grid | Selenium Forum
K
Kam Posted on 02/10/2019

When I run test cases trough ANT run parallel, only one browser opens . I dont see other browser

I have two laptops connected to my home network. One Laptop I use as local host, Other IP adress I put in JASON2 file to replace with local host.When I run I dont see any activity on second laptop


K
Kam Replied on 03/10/2019

I use following commond on NODE1 machine : Windows 7

java -Dwebdriver.gecko.driver=”C:\SeleniumFiles\drivers\geckodriver.exe” -Dwebdriver.chrome.driver=”C:\SeleniumFiles\drivers\chromedriver.exe” -Dwebdriver.ie.driver=”C:\SeleniumFiles\drivers\IEDriverServer.exe” -jar C:\SeleniumFiles\Jar\selenium-server-standalone-3.141.59.jar -role node -nodeConfig C:\SeleniumFiles\node1.json

getting following error:

 

 

Responsive image


A
Ashish Thakur Replied on 07/10/2019

What is the name of the node config JSON file?

Pass the same name at the end of the command.

 


K
Kam Replied on 07/10/2019

It is already passing:

 

java -Dwebdriver.gecko.driver=”C:\SeleniumFiles\drivers\geckodriver.exe” -Dwebdriver.chrome.driver=”C:\SeleniumFiles\drivers\chromedriver.exe” -Dwebdriver.ie.driver=”C:\SeleniumFiles\drivers\IEDriverServer.exe” -jar C:\SeleniumFiles\Jar\selenium-server-standalone-3.141.59.jar -role node -nodeConfig C:\SeleniumFiles\node1.json


K
Kam Replied on 08/10/2019

Same file is working when I run grid on same machine. 


A
Ashish Thakur Replied on 09/10/2019

Have you set the parallel tag in the testng.xml?


K
Kam Replied on 11/10/2019

yes


A
Ashish Thakur Replied on 11/10/2019

Please share your testng.xml and suite xml files as well.


K
Kam Replied on 17/10/2019

TEST NG .xml

 

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="MYSuite" parallel="tests">

<!--<suite name="MYSuite" parallel="methods" thread-count="6"> -->

<!-- suite name="Suite Name" -->
<suite-files>
<suite-file path ="./src//test//resources//suiteportfoilio.xml"/>
<suite-file path ="./src//test//resources//suiteStock.xml"/>

</suite-files>
</suite>

=================================================================

NODES1.jason

 

{
"capabilities":
[
{
"browserName": "firefox",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 1,
"port": 5558,
"register": true,
"registerCycle": 5000,
"hub": "http://localhost:4444",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}

===============================================================

Nodes2 Jason

{
"capabilities":
[
{
"browserName": "firefox",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "chrome",
"maxInstances": 2,
"seleniumProtocol": "WebDriver"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 1,
"port": 5556,
"register": true,
"registerCycle": 5000,
"hub": "http://192.168.1.7:5566"
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}

=================================================================

Grid.txt


Hub setup->
java -jar C:\SeleniumFiles\Jar\selenium-server-standalone-3.141.59.jar -role hub

Node 1 setup->
java -Dwebdriver.gecko.driver="C:\SeleniumFiles\drivers\geckodriver.exe" -Dwebdriver.chrome.driver="C:\SeleniumFiles\drivers\drivers\chromedriver.exe" -Dwebdriver.ie.driver="C:\SeleniumFiles\drivers\IEDriverServer.exe" -jar C:\SeleniumFiles\Jar\selenium-server-standalone-3.141.59.jar -role node -nodeConfig C:\SeleniumFiles\Common\Grid\node1.json

Node 2 setup->
java -Dwebdriver.gecko.driver="D:\Common\drivers\geckodriver.exe" -Dwebdriver.chrome.driver="D:\Common\drivers\chromedriver.exe" -Dwebdriver.ie.driver="D:\Common\drivers\IEDriverServer.exe" -jar C:\SeleniumFiles\Jar\selenium-server-standalone-3.141.59.jar -role node -nodeConfig C:\SeleniumFiles\Common\Grid\node2.json

 


K
Kam Replied on 17/10/2019

Parllel.exe:

package com.ktest.rediff.Hybrid.Base;

import java.util.Arrays;

import org.testng.TestNG;

public class Parallel_exec
{
public static void main (String [] rgs)
{
TestNG testng = new TestNG();
testng.setTestSuites(Arrays.asList(new String[] {System.getProperty("user.dir")+"//src/test/resources//testng.xml"}));
testng.setSuiteThreadPoolSize(2);
testng.run();


}

}


A
Ashish Thakur Replied on 17/10/2019

What is the IP address of the hub?

Is it Static or Dynamic?

What is the IP Address of the Node?

Is it on the same subnet?

Is the firewall disabled on both of the machines?

Make sure that you are providing the correct IP address and port number for the hub in node config JSON files.

Please provide the above-mentioned detail and share the config files in a compressed zip folder.