Continuous integration mixing Jenkins, iOS 9 and XCode 7.

Published October 29, 2015 - Updated December 26, 2016


The execution of tests to source code is a vital link in the software development process. Performing all test to system means using a lot of resources during the execution and sometimes the tests can take a long time to complete.

The development team could see their work hampered by waiting the result of all tests run every time he finished a task. To avoid this situation the review activity is delegated to continuous integration systems with higher-performance. These systems can be configured to perform activities in nightly hours for performance increase. Once the activity has been finished, the system send notifications to interested users.

This article shows how we can configure an iOS 9 project with in continuous integration flow using Jenkins.

Build Pipeline as Code

Now you can define Continuous Integration and Continuous Delivery (CI/CD) process as code with Jenkins 2.0 for your projects in iOS 9 Activities like to build, test, code coverage, check style, reports and notifications can be described in only one file.

If you want to know how, just follow this link and read the second version of the current article.

How does it work?

Jenkins can be configured to perform tests on iOS 9 projects. In Jenkins’ repository exist the XCode integration plugin that allows us compile the source code and execute tests.

The XCode integration plugin does the execution of the tests and the result is written in a file with XML format inside the project. The XML file generated can be read by JUnit. That’s why we are going to use the JUnit plugin to show the tests executed in the iOS 9 project. The Test Result Analyzer plugin will show the results of the tests on graphics for a better understanding.


To take the steps mentioned in this article you must complete the following requirements:

  • Having Jenkins installed.
  • Having XCode 7 installed.
  • Having an iOS 9 project created with unit test implemented.

Jenkins is a cross platform system. However, if it have installed in a computer with a different operating system to Mac OS you must also include the following:

  • Having a machine with operating system Mac OS 10.10.5.
  • Configuring the Mac OS machine as Jenkins Node to execute jobs.
  • Having XCode 7 installed in Mac OS machine.

Source code

If you don’t have an iOS 9 project created, you can access the source code used for the article.

You should use code version 1.0.0.


The environment configuration used for this article is the following:

### Continuous Integration System ###
             OS: Ubuntu 14.04
        Jenkins: 1.635
   XCode Plugin: 1.4.9
   JUnit Plugin: 1.9
Test Results 
Analyzer Plugin: 0.2.1

### Jenkins Node ###
          	 OS: Mac OS 10.10.5
       	  XCode: 7

### Project iOS 9 ###
       Language: Swift

Step One – Install Jenkins’ plugins.

You must follow these steps to install the plugins on Jenkins:

  • Open Jenkins in your web browser.
  • Navigate to Manage Jenkins > Manage Plugins.
  • Select Available panel.
  • Filter by Xcode integration and select it to install. Repeat this step using Junit Plugin and after Test Results Analyzer Plugin.
  • Click on button Install without restart after having the plugins selected.
  • Click on button Restart Jenkins when the installation is complete.

After restart you should go back to Manage Jenkins > Manage Plugins and verify that plugins were installed correctly. You should also verify the plugins version with Environment section.

Step Two – Create new Jenkins’ job.

Select New Item on Jenkins home page. After, fill the field Item name with the desired value and select Freestyle project. We used time-table for the example.

Once the job has been created, select Configuration option to realize required settings inside.

Step Three – Executing the job on Mac OS Node.

If the machine with Mac OS operating system is a Jenkins’ Node then the job must be restricted only for this Node.

To accomplish, you must select Restrict where this project can be run option. We used Mac OS as node name for the example.

Step Four – Get project’s source code.

The section Source Code Management must be configured. We used Git Plugin to get the source code from a local server.

Step Five – Configure XCode Plugin.

To incorporate the functionalities of XCode Plugin we click on Add build step button and select Xcode option.

The plugin has four sections: General build settings, Code signing & OS X keychain options, Advanced Xcode build options and Versioning. In this article we are going to use only two of them: General build settings and Advanced Xcode build options.

General build settings Section

The Configuration field is set with Debug value. The plugin set the value Release by default.

Advanced Xcode build options Section

The scheme where the tests are performed must be established. The Xcode Schema File field is responsible for storing this value. We set TimeTable for the example.

The field Custom xcodebuild arguments is used to add custom elements to the execution. In this case, writing test is required to execute the tests of the project.

The -destination parameter has also been added to perform tests on a specific device. The example has been configured for iPhone 6 and the text for this device is the following: -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0'.

The configurations described above are shown in the following figure.

Step Six – Configure JUnit Plugin.

JUnit plugin is responsible for showing the results of executed tests in the project. The XCode plugin generates an XML file into the folder test-reports located in the root of project. The JUnit plugin has to be configured to interpret the XML file generated by the XCode plugin. The results are shown on the Jenkins web.

First of all, click on Add post-build action button and select Publish Junit test result report. After, fill the Test report XMLs field with the location of XML file generated by the XCode plugin.

The following figure show the configuration of the Junit plugin.

Up to this point task settings have been completed. To save changes click on Save button at the end of the screen.

Let’s run the job!!! Everything is ready to see the configuration’s result.

Step Seven – Run Jenkins’ job.

Once configurations have been finished, click on Build Now. The execution can be finished successfully or not depending on the tests created in the project.

If you use the source code proposed by this article the execution will be finished successfully. During the process the node will automatically launch the XCode’s emulator to perform the tests. The emulator displays the following screen.

We can also inspect Console Output for this job and see the results. Console’s fragments will be shown below.

Step Eight – Show job’s reports.

Reviewing the state of the tests is important. Click on the job created and it will show a graphic of results trend.

Select Test Result to get a detailed view of the results.

Show the results using Test Result Analyzer plugin

Click on the job and select Test Result Analyzer.

Select Get Build Reports button and it will show a table with the results of the tests.

If you want to see the results in a graph just select Generate Charts button and it will show similar reports to the following image:

Final Thoughts

Automate testing for iOS 9 projects is possible. Delegating the execution of test cases to higher-performance machines simplifies the development process. Jenkins allows for configuration of our environment to get these goals, we just need to do it.

Significant Revisions

Published October 29, 2015 - Updated December 26, 2016