1

We have some webdriver/testng/maven/java tests that we need to run automatically after each deploy, but its been 4 days and I just cant get the damn thing to work headlessly using xvfb. And I do not have access to the server, and to Jenkins configuration, other to constantly bugging the poor guy who operates these.

So what kind of a workaround would you offer in this case? Can Jenkins do jobs on remote servers (say I find a server that doesnt need to run tests headlessly)? Or is there an alternative to xvfb?

Kara
  • 6,115
  • 16
  • 50
  • 57
Kaloyan Roussev
  • 14,515
  • 21
  • 98
  • 180

1 Answers1

1

Setup your selenium tests to use remote webdriver

For info read here - http://code.google.com/p/selenium/wiki/RemoteWebDriver and http://docs.seleniumhq.org/docs/03_webdriver.jsp#selenium-webdriver-s-drivers

UPDATE

Jeeny - "Can Jenkins do jobs on remote servers (say I find a server that doesnt need to run tests headlessly)?"

Amey - "Yes"

BUT instead of running the Jenkins job on a remote server, make your selenium tests run on a remote server.

I assume you initialize your selenium webdriver browser instance by this command

WebDriver driver = new FirefoxDriver();

change that to

driver = webdriver.Remote("http://your.remote.server:4444/wd/hub", webdriver.DesiredCapabilities.FIREFOX)
Amey
  • 8,470
  • 9
  • 44
  • 63
  • You can deploy jenkins locally on a system and you can execute test cases at a specific time of the day probably late night after the final build of the day. This would allow you to execute test cases in non headless manner as well. – Vinay Jul 26 '13 at 01:42
  • @amey - can you please put this in some context. how can I relate this to the situation? – Kaloyan Roussev Jul 26 '13 at 08:55
  • @Vinay - so I set up a computer that will remain turned on, when I leave work and I install Jenkins on it, connect it to the project and do a job that will start a normal Firefox which will run the tests some time at night? – Kaloyan Roussev Jul 26 '13 at 08:56
  • Yup it will. That is how I run my jobs – Vinay Jul 26 '13 at 08:57
  • Actually I can't use this approach, because we need to run the tests on the new code, and if they fail, not do the deploy, which is done on another machine. – Kaloyan Roussev Jul 26 '13 at 10:01
  • Hmmm then if it is a maven project you can merge your pom code with developers code. By default if the build fails then your code will not get executed. Cheers.. Hope this helped... – Vinay Jul 26 '13 at 13:28