How to Make Webdriver Testsuite Created in Windows Machine to Run in a Linux Box

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:

  1. Locate your code pool in Jenkins Job. You can either use your local codebase or any version control system.

  2. 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.

  3. 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:

  1. -role hub on your Windows host on port 4444
  2. -role node on an Ubuntu VM with port forward 5556 in VirtualBox, for Firefox
  3. -role node on an OSX VM with port forward 5557 in VirtualBox, for Safari
  4. -role node on a Windows VM with port forward 5558 in VirtualBox, for IE and Chrome
  5. node with socat+flynnid.py on an Android emulator with port forward 5559
  6. maybe also iPhone Simulator from inside OSX VM (I don't remember if I made it work with grid)


Related Topics



Leave a reply



Submit