Please note: This article is old and refers to Selenium Server which has been deprecated by Selenium Webdriver so the following post is now pretty useless!
There's a big thing about unit testing at the moment, well, unit testing is something that's been around for years, and no doubt it's something that the best companies have been doing for a long time. There can be quite an overhead in setting up testing, especially unit testing, because it can require a test environment as well as the tests themselves. In the longer term, code is more stable, better managed, and you can be a lot more confident when deploying.
I've always been one for getting the best return on effort which is why I particularly like Selenium. There is the Firefox plugin for Selenium where you can record your tests directly from your browser, export them to your code base, commit them and then Jenkins will run them for you!
Without repeating stuff and giving credit where it's due I followed the blog here: http://www.labelmedia.co.uk/blog/posts/setting-up-selenium-server-on-a-h...
That got me most of the way but unfortunately, because I didn't understand all of the configuration lines it just didn't work. So hopefully, I can explain them now and help you set your own one up.
In the execute shell step we have this:
export DISPLAY=":99" && java -jar /var/lib/selenium/selenium-server.jar
-browserSessionReuse -htmlSuite *firefox http://path/to/app
/var/lib/jenkins/jobs/project/workspace/path/to/Suite.html
/var/lib/jenkins/jobs/project/workspace/path/to/logs/selenium.html
If you're still having problems running Selenium through Jenkins then take the full command and run it through terminal. It should give you some useful errors and you can also add the -debug flag after selenium-server.jar.
Once it's all done, you'll have a link in Jenkins to the most recent selenium report on the project page and of course the build will fail if the Selenium tests fail.
Submitted by oliver on Fri, 20/05/2011 - 10:08
Post new comment