Mobile Software Test Automation: Setting up a Jenkins CI server

We have finally made it through to the final phase of the mobile automation series.  This phase will likely span over a few weeks, but that's because I wanted to go through the process from start to finish.  So hang tight if you are already a few steps of where we are today.  The first step is (obviously) setting up the CI server.

Jenkins Initial Setup

download

We will be using Jenkins to set up our CI server.  The application is very simple to setup and use, and is one of the more popular tools for CI, meaning your company likely already has an instance of Jenkins running as a build/deploy server.  So the first thing you will need to do to get started is download the jenkins.war jar file from their website.  Or you can click here for a direct link to download.  

running the server

Once it's downloaded, you will need to cd to the location of the jenkins.war jar file that was download.  For me, that was my Downloads folder, but you can move this wherever you like.  Now, in the terminal, type:


$ java -jar jenkins.war

Your results should look something like this:

starting_jenkins_war

accessing the server

Now that the server is running, we can go check it out.  So open up http://localhost:8080/ in a new window, or you can click on the link to take you there.  It should look something like this:

Now how simple was that?!? That's all that is needed to start up your jenkins server.  Remember the run command, because closing out that terminal window will kill the server.  So anytime you restart the computer or update jenkins, you will have to start the server back up again.  The good news is, everything we configure will still be there, so don't worry.

Configuring the Server

Now that the server is started, there are still some setup steps we need to do before we can begin running jobs.

credentials

First, we are going to set up some credentials.  Click on 'Credentials' in the side-panel on the left hand side.  Now click 'Global Credentials'.  You should now be able to click 'Add Credentials' to add a username and password.  Once done, click OK.  

configure system

From the default home view, click on 'Manage Jenkins' in the left side-panel, and then click 'Configure System'.  For now, the only thing you need to do here is set the JDK location and URL.  The JDK location should look something like this:

For the URL, set it as the IP address for the machine in place of localhost.  Leave this on port 8080.  Click save and you should be taken back to the manage jenkins page.

Wrapping up

That wraps up our initial setup of the jenkins server.  Next, we will pick up where we left off, with adding the necessary plugins, followed by creating the necessary jobs, and finishing up with running the jobs (i.e. Our test automation) with the push of a button.  See you next week!