Mobile Software Test Automation: Configuring Jenkins CI server

I apologize that it's been a couple weeks since I have been able to get a post out.  Unlike this blog, I have been covered up with some work that actually makes me money, so I let this fall by the wayside.  But I'm back.  The last post was walking through the initial setup of the Jenkins server.  Now we will get into some configuration in preparation for building the app and then running our tests.

Description of Plugins

There are hundreds, if not thousands of available plugins for Jenkins.  They range from fun but useless plugins like a meme generator when someone breaks the build, to absolute must haves like environment variable injection or version control support.  

essential plugins

Lets talk about the 4 essential plugins first:

Environment Injector Plugin - as the name states, this allows you to inject environment variables into a job.  This will also allow you to pass environment variables from one job to another.

Git plugin - pretty self explanatory...allows you to use git to pull down new versions prior to running a job.  This plugin can also notify the job of a change in git, so jobs can run as soon as code is checked in, instead of waiting for a specified polling interval.

Xcode integration - this plugin does a lot, but basically, you need this so that you can build the latest version of your iOS app and then test it.

Parameterized Trigger plugin - I debated having this in the essential section.  It may not be an absolute must have, but it does make your setup much cleaner.  This allows you to trigger a job to start when another job finishes.

nice to have plugins

Audit Trail - This would be nice to have if you work on a large team, as it keeps a log of who performed particular jenkins operations.

Email Extension Plugin - If you prefer a post job notification email be sent with passed or failed, this is the plugin for you.  You can configure just about everything about the email with this as well, which is pretty nice.

Slack Notification Plugin - If you use slack instead, this plugin is for you.  You can send post notifications to a specified slack channel.  There are also plugins for HipChat, or most other services along the same line.

Green Balls - Because who likes blue balls?  Jokes aside, green is the universal symbol for go or good, so for me, a passing job should be green.  That's all this plugin does.

might need plugins

There are a few plugins that you may need, depending on your setup.  

Android Emulator Plugin - If you are planning on running your tests on an emulated device, this would be nice to have. You could also start up an emulator from the command line, but a nice plugin is nice to have if you need it.  

Gradle plugin - If your android build uses gradle to invoke a build script, you would need this plugin.

Adding Plugins

Now that you know a little bit about some of these plugins, lets add the ones you need for your project.  So navigate to the dashboard of your Jenkins server.  If you have closed out the terminal session from last time, you will have to restart it.  In the left hand navigation bar, click "Manage Jenkins", and then you will need to click on the "Manage Plugins" link from the main content part of that page.

Now, click on the tab marked "Available", and this will show you a list of all the Jenkins plugins that are out there.  You could find the ones you need by scrolling, but it may be faster to type in the names as I listed above, and then click the checkbox next to each.  Once you have selected all the plugins you want to install, click the button to download/install them.  I chose to install them without a restart, but you can do it however you want.  

When installation is complete, navigate back to the "Manage Plugins" page, and click on the "Installed" tab.  You will notice that a few more plugins came along with what you installed.  No problems. This means that the dependencies were handled for you.

Wrapping up

Great job this week.  I am going to try to keep these posts a little shorter than in the past, which should make it easier for me to get these out every week.  Next week, we will work through creating a job to test an application that has already been built, followed by creating a job to pull code from a specified git branch (such as master or develop), then build the app, and then test against the newly built app. See you next week!