Executing tests Concurrently on different OS and Browsers with WebDriver using Java and TestNG
Aditya,
Your code(testng.xml) for running parallel test on different-different or same system should be like below:
Testng.xml
<!DOCTYPE suite SYSTEM "Http://testng.org/testng-1.0.dtd">
<suite name="My Sample Suite" verbose="3" parallel="tests" thread-count="2">
<test name="Run on Firefox">
<parameter name="mybrowser" value="firefox"/>
<parameter name="myip" value="http://172.16.10.119:5566/wd/hub"/>
<classes>
<class name="testcases.Login"/>
</classes>
</test>
<test name="Run on Chrome">
<parameter name="mybrowser" value="chrome"/>
<parameter name="myip" value="http://172.16.10.106:5567/wd/hub"/>
<classes>
<class name="testcases.Login"/>
</classes>
</test>
</suite>
here i am trying to acess one linux(ttp://172.16.10.119:5566) and one mac(http://172.16.10.106:5567) and sending its ip and browser as a parameter. To run it parallel i have mentioned in my <testsuite> tag as parallel="tests" thread-count="2"
I hope that you are pretty clear now.
Selenium test execution via jenkins on linux box
Basically to run selenium scripts via any CI tool needs to have build tool like ANT, MAVEN etc or any other tool which allows you to run selenium scripts using command line. Jenkins provides options to run shell scripts, windows batch commands, ant targets etc so If you can run tests via any one of above the ways then you can easily configure a job in Jenkins which will run the tests.
An overview to run selenium tests in Jenkins:
Locate your code pool in Jenkins Job. You can either use your local codebase or any version control system.
As Jenkins provides options to run any command which can get executed from command line so you have to setup your selenium tests in such way that it can get executed from command line. I'd suggest to use ANT for that. If you use ANT to run the tests then you can specify your build.xml path and ANT target in Jenkins and it will run that target for you.
Jenkins provides you option to publish HTML/Junit reports, so you just need to locate the path of report where it gets generated after test execution. Jenkins will publish those report for you.
As you said Jenkins setup exist on linux box, so you need to make your tests compatible to linux machine. You have to instantiate drivers considering linux machine or you can setup a Jenkins windows slave which will allow you to run tests on windows machine.
Need a machine to run selenium Grid test cases
VirtualBox is good and works well for grid tests, I expect it to be a fairly common solution. Same IP is not a problem as you make it work with port forwarding on your desktop. For example you should manage to build a grid like the following:
- -role hub on your Windows host on port 4444
- -role node on an Ubuntu VM with port forward 5556 in VirtualBox, for Firefox
- -role node on an OSX VM with port forward 5557 in VirtualBox, for Safari
- -role node on a Windows VM with port forward 5558 in VirtualBox, for IE and Chrome
- node with socat+flynnid.py on an Android emulator with port forward 5559
- maybe also iPhone Simulator from inside OSX VM (I don't remember if I made it work with grid)
Related Topics
_Ldg Causes Slower Execution Time in Certain Situation
Why Is Running Node.Js on Port 80 Might Not Be Safe
Tcp Keepalive - Protocol Not Available
Unexpected Eof While Looking for Matching '"'
Rmpi: Cannot Use Mpi_Comm_Spawn API
Basic Build Issue Regarding Libs, Pkg-Config and Opencv
Make Uses "Cc" Instead of "Arm-None-Eabi-As"
Fortran: How to Get The Node Name of a Cluster
Gitlab Ce Doesn't Add a Public Key to Authorized_Keys
Arm Linux ":Start_Kernel Is Not Calling After Decompressing UImage"
Get Apache Total CPU Usage in (Linux)
"The Launch Timed Out and Was Terminated" Error with Bumblebee on Linux
Sorting in Fortran, Undefined Reference to Qsort_
Chef-Server Stuck Ruby_Block[Supervise_Rabbitmq_Sleep] Action Run on Docker Container
Host Multiple ASP.NET Core Web Application Under a Single Linux Server
Bash Script for Executing Commands on Multiple Server
How to Ensure Data Reaches Storage, Bypassing Memory/Cache/Buffered-Io