Question

i have done a testcase on my windows system, now i need to run the same test case file into Ubuntu Linux server(without desktop).

From this Link tutorials, i supposed to install xvfb. Which i installed & tested. Its running successfully in my server.

Now my confusion is what is the next step? i.e what should i do in order to run the same testcase into my Linux machine? This test case is made with selenium (java) as Maven project on my local windows machine through eclipse

Was it helpful?

Solution

Quick and dirty

Install maven on the linux server and a JDK. Then copy the source code of your project to the linux server (e.g. clone the source repository or zip the directory and scp it). Run:

mvn clean test

A bit more complex but nicer

Using the Selenium Grid. The Grid allows selenium to start a browser from remote nodes.

First download the selenium server from the Google Code download page. Start the hub on your windows machine:

java -jar selenium-server-standalone-2.39.0.jar -role hub

Go to http://localhost:4444/grid/console to check that the hub has correctly started.

Then on the linux server start a node:

java -jar selenium-server-standalone-2.7.0.jar -role webdriver -hub http://<hub_ip_or_hostname>:4444/grid/register -port 5556 -browser browserName=firefox

In your test code, instantiate a RemoteWebDriver object with the Firefox capability. The remote webdriver object will automatically contact the hub to find a remote node with the requested capabilities (and here there is only one single node). Then the hub will forward the selenium commands to the remote node.

DesiredCapabilities capability = DesiredCapabilities.firefox();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
driver.go("http://www.myWebsiteToBeTested/");

Then you can add to the hub as many nodes as you wish, using different platforms and browsers (Firefox on Linux, IE on Windows, Safari on iOS...). The official documentation is here.

OTHER TIPS

For that purpose I used desktop Ubuntu, which contains all X.org dependencies. Also I installed XtightVNC for desktop. After that I added opening new screen using VNC server.

Finally I've installed Hudson (you may use Jenkins) and added env DISPLAY=:%monitorNumber% (e.g.: 2) to my start script. This command redirect execution to our VNC monitor.

I propose you to install X.org dependencies firstly, after that do what I did. But I don't remember exact steps how I setup, it was long long time ago.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top