Preparing Jenkins to do Automated Testing

Good afternoon, guys. Back to my routines, it is time to post some knowledge 😀

In this article, i would like to tell you about preparing our Jenkins server to run QA Testing so your QA can automate their tests. In my test, i used my mac as Jenkins server. So if you have another UNIX system, this article might work for you 🙂

There are some steps to make Jenkins can doing QA Automation in Android, iOS, and Web.

In this guide, Jenkins will have one node which is in the same Mac as Jenkins itself.

Jenkins Preparation

  1. Install Jenkins on your mac. You can download jenkins from
  2. After Jenkins is installed, you can configure its plugin. For this article, we need below Plugins:
  • Environment Injector Plugin
  • JDK Parameter Plugin
  • Node and Label Parameter Plugin

Maven 3.3.9

You can download the archive file from, then extract it to /opt/ directory.

After it’s extracted, change the owner of the directory to jenkins and add its path to .zshrc.

sudo chown -R jenkins:wheel apache-maven-3.3.9

Add Path to .zshrc

export PATH=/opt/apache-maven-3.3.9/bin:$PATH

Add Path in Jenkins system configuration:



You could install Java using this instruction:

To verified that java is installed, you can check it by:

java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

You can also add Java’s Path to your environment:

export JAVA_HOME=$(/path/to/java_home)

Android SDK

You can download the latest SDK command line tools from:

Extract the archive file then add it to your $PATH

export ANDROID_HOME=/Users/rezasetiadi/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/build-tools:$PATH

If Jenkins can’t access Android SDK, you could extract the archive file once again in other directory such as /opt/ and change the owner of the directory then add its Path to Jenkins system configuration.




You can install Appium on your Mac using npm:

npm install -g appium

To check if your environment is already suit to do Android and iOS automation with Appium, we can install appium-doctor.

npm install -g appium-doctor

After it is installed, check it like below:

~appium-doctor --ios
info AppiumDoctor Appium Doctor v.1.2.5
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor ✔ Xcode is installed at: /Applications/
info AppiumDoctor ✔ Xcode Command Line Tools are installed.
info AppiumDoctor ✔ DevToolsSecurity is enabled.
info AppiumDoctor ✔ The Authorization DB is set up properly.
info AppiumDoctor ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor ✔ Carthage was found at: /usr/local/bin/carthage
info AppiumDoctor ✔ HOME is set to: /Users/rezasetiadi
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor 
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor
~ appium-doctor --android
info AppiumDoctor Appium Doctor v.1.2.5
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor ✔ ANDROID_HOME is set to: /Users/rezasetiadi/Library/Android/sdk
info AppiumDoctor ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
info AppiumDoctor ✔ adb exists at: /Users/rezasetiadi/Library/Android/sdk/platform-tools/adb
info AppiumDoctor ✔ android exists at: /Users/rezasetiadi/Library/Android/sdk/tools/android
info AppiumDoctor ✔ emulator exists at: /Users/rezasetiadi/Library/Android/sdk/tools/emulator
info AppiumDoctor ✔ Bin directory of $JAVA_HOME is set
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor 
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor

If there is some item that not checklisted by appium-doctor, you can repair it is installed correctly.

Chrome driver & Safari driver

You can install chrome driver using brew command like below:

brew install chromedriver

To install Safari driver, you can follow this instruction:

Setting Jenkins Node

Because of Jenkins user in our Mac is headless (has no GUI), we can use our user as Jenkins Node. This configuration will help us to run Web QA Automation.

On the Jenkins configuration create new Jenkins Node as follow:




Make sure this node is connected to the Jenkins server, usually we can just configuring from this setting page.

Make Jenkins Job

Create jenkins job like below:

screen-shot-2017-01-16-at-1-37-53-pm screen-shot-2017-01-16-at-1-38-04-pm

On the build step, you can see the Maven Goals, you can ask the QA team what command to run their script.


Before run the jenkins job, don’t forget to run the appium server from your terminal and specify which port which you’ll use to run the test.


If you want to run iOS and Android QA Automation, you need to specify the appium server, make sure you have the same version as the QA.

If you want to run web QA automation, you can select the node you have created before, so that jenkins can open browsers to run automation.

To run iOS QA Automation, you need to install the same XCode as the QA team requirements. If you have multiple XCode on your Mac, you need to set the default XCode using XCode Command Line Tools.

If your iOS test can’t launch the App because of error Instrument Exited with error code 253, you can try to restart your Mac, or if you have multiple XCode, try to reselect the default XCode to use by Appium.

For example, in the first try QA ask to use XCode 7.3. And you have XCode 7.3 and XCode 8.2, try to select the default to 8.2 first, then turn it back to 7.3.

Leave a Reply

Your email address will not be published. Required fields are marked *