loader image

Continuous Integration With Jenkins For MEAN Stack App


Jenkins is continuous integration tool that can automate our development process. This article will explain why we need to use Jenkins, installation of Jenkins, configuring Jenkins, and creating our first project. First, we need to setup the basics, and then we will see how we need to setup MEAN stack app in order to integrate unit and functional test cases, and how to do this continuous integration with Jenkins.

Why do we need to use Jenkins?

It is obvious that generally a project is developed by a team of many members, and not by a single person. So processes like Merging code, Release Coordination, Determining the build status, Maintaining all the updates can be difficult.

In this difficult situations, Jenkins helps us to automate everything. Jenkins being a solution for continuous integration merges all code continuously into one central build. Therefore, we are going to perform continuous integration with Jenkins. Jenkins by monitoring, regulating, comparing, merging and maintaining your project acts as your projects headquarters.

The core functionalities of Jenkins are automated integration and external build monitoring. It not only makes it easy for us to maintain the code but also monitor our builds and ensures that other developers merge their code before the code gets ready.

Let’s set up and learn Jenkins and how to use it.


  • You should have the VPS running and you should log-in as root.
  • I wrote this article for Ubuntu 14.04 x64, but the same instructions will work for Ubuntu 12.04 and up.
  • Web server – nginx
  • Java at least 1.8 for functional testing using selenium web driver

Installing Jenkins:

Customize Jenkins
Before installing the Jenkins, We the following two steps have to be done to add key and source  list to apt.

  1. Adding the key.

2. Creating the sources list.


After updating the apt’s cache, we can install Jenkins now.


Now the Jenkins is run, go to 
http://ip-of-your-machine:8080. We will now be able to see a default Jenkins screen. We can log in with help of “admin” user credentials

Suppose if you want to create “one more user”, you can create a user with help of  Manage Jenkins -> Manage Users option from Jenkins admin dashboard.

Manage Jenkins Plugins:

Once we install the Jenkins and configure it, We need to install the right plugins that suit our project needs.  For installing and managing the plugins follow the below steps.
Inside the menu, Click on Manage Jenkins and in the sub Menu click on Manage Plugins. By clicking on the link you land on a page where the list of all previously installed plugins are available and needs to be updated. You just have to click on update button given at the bottom to update the plugins.
To view the list of all the available plugins click on Available button on the same page. This shows you the list of all the available plugins. The challenge you face now is to select the right ones for your project. You can refer Jenkins wiki for this purpose, it provides a good summary of each available plugin making it easy to select the right plugin for our needs.

Here are a few, some generic, some specific to the app:

  • Git plugin
  • Jenkins Disk Usage
  • Node js

After selecting the right plugins. Click on Download now and install after the restart button.

Creating Project and schedule build:

Now that everything is up and running, it’s time to create our first project.

  1. General: Click the New Item link and create a freestyle project with project name
  1. Source code management: Fill source code management details like Git credentials to access our project repo
  1. Schedule build trigger methods in any of the following:
    • Trigger builds remotely (e.g., from scripts)
    • Build after other projects are built
    • Build periodically
    • Periodically need to trigger, GitHub hook trigger for GITScm polling
    • Poll SCM
  1. Setup build environment: We build env for MEAN application, so we need to configure Node & npm details
  1. Execute Shell script: Add a execute shell  script to run our unit test cases

Click the Save button at the bottom of the screen. Then click the “Build Now” button in the project dashboard.

  1. Build output: Once setup is done, We can able to see build output continuously in Jenkins dashboard.

Install Protractor and Selenium WebDriver for functional testing:

Protractor is an end-to-end test framework for AngularJS applications. Follow below steps to install protractor and selenium web driver:


Setup Headless Chrome browser

Follow below steps to setup headless chrome browser:


To launch the web driver with Xvfb at backend

Script is present in  /etc/init.d/selenium:


Execute this script and verify the service on Port. Xvfb may be useful for other browser dependent applications in non-GUI mode.

Add a execute shell script to run our functional test cases

In Post Build section, add below script to execute end to end functional testing using protractor:



Hope this helps you to integrate unit and functional testing of MEAN stack application, and thereby perform continuous integration with Jenkins. Enjoy JENKINS!!

The following two tabs change content below.
Bharanidharan Arumugam

Bharanidharan Arumugam

Technical Architect | Tech Lead | Mentor | - An enthusiastic & vibrant Full stack developer has 7 plus years of experience in Web development arena. Owns legitimate knowledge in Ruby, Ruby On Rails, AngularJs, NodeJs, MEAN Stack, CMS Services. Apart all, A Modest human who strictly says "No To Harming Humans".

One thought on “Continuous Integration With Jenkins For MEAN Stack App”

Leave a Reply

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

Join our 30,000+ subscribers, never miss out anything on our latest blogs, tips, tutorials, updates & more.