Jenkins & Selenium
I have in the past used Atlassian Bamboo for build automation and to run automated tests. While I love that solution, it costs money and not everyone wants to buy it.
This is not a step by step, but I've included all the things I got tripped up on. So here are my tips if you try to do this:
Install Jenkins on ubuntu
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins
Setup Jenkins User
At this point jenkins will load up on http://localhost:8080 and run as a jenkins user; but we want to use git, rbenv, ruby and selenium. So login to your machine as the jenkins user: sudo su jenkins -s /bin/bash
Remember to create an ssh key and add it where appropriate; ex. github or bitbucket
ssh-keygen -t rsa git config --global user.email "firstname.lastname@example.org" git config --global user.name "Your Name"
Go through the steps to install rbenv for the jenkins user.
Finally when you setup your jenkins job and try to execute a shell command, remember to include: source /var/lib/jenkins/.bashrc
as well as run your bundle install and bundle exec rake
bundle install --path vendor && bundle exec rake your_rake_task
If you're using the ruby_tester remember to add a 'post-build action' to 'publish j-unit test report' and set the pattern to:
You can use the Selenium Web Driver, but you're going to need to run it against a Selenium Server (very easy). Because jenkin runs under a service account and is not inside of a windowed (x-session) environment and has no access to a browser. Download the Selenium Server Jar and then run the following command to start it.
java -jar selenium-server-standalone-2.33.0.jar [-port 4444] [-interactive] [-timeout 1800]
Then you simply need to launch your web driver using this syntax
driver = Selenium::WebDriver.for :remote, :desired_capabilities => :chrome
NOTE: local host and port 4444 are assumed
I simply used a gmail account to send email and put the credentials into Jenkins.