Author : Ansu

Published on: June 22, 2018

Continuous Integration (CI) and Continuous Delivery (CD) are two main DevOps Software Development practices which help organizations to deliver applications in a faster and reliable way. In Continuous Integration, developers regularly merge their code changes into a central repository, after which automated builds and tests are run. Thus developers can find and locate error quickly and improve software quality.

To deliver software updates to the customers faster and frequently with high quality, organizations should include automated software testing into continuous delivery pipeline. This is the only way to ensure that quality assurance is continuous, agile and reliable as the rest of the DevOps operation. If automation testing is not part of the continuous delivery pipeline, the code changes that developers write cannot be tested regularly.

ccid

CI/CD Pipeline consists of the following steps:

  • Commit: 

When a developer finishes coding, he will commit the source code to a central repository.

  • Build.

The change is pulled out from the repository like Git and the software is built using some build tools, so that it can be run by a computer.

  • Automated tests.

Develop test script for testing the built version. The change is tested to ensure whether the feature will work and also verifies that it doesn’t break anything else.

  • Deploy.

The built version is deployed to production.

Why Automated Testing is Essential in CI/CD  ?

Automated Test have good role in CI/CD. Without proper automated tests that run fast, have good coverage, and no erroneous results, there can be no successful CI/CD pipeline.

  1.      Automated tests mean faster tests.

Automation will produce faster results than a human could produce manually. Through automation, we can run test in parallel, which speeds the testing process even more. Speed and the avoidance of delays are essential in order to deliver software continuously.

  1.      Automated testing is more consistent than manual testing.

A software should be consistent. Consistency means that software behaves as expected at every stages of the delivery chain. Test automation helps to achieve consistency by avoiding the chance of human error when while testing the application

  1.      Automated testing will empower agility.

In CI/CD, sometimes we need to adjust to tools and frameworks rapidly when a better technology comes. If we have automated tests, then all configurations are done automatically. So that we can migrate to a technology easily.

CI/CD with Jenkins

Jenkins is a popular open source tool used to achieve continuous integration and build automation. It will execute a predefined list of steps and will send notification in case of success or failure. Jenkins can be extended by adding additional plug-ins based on our need.

Benefits of using Jenkins in Automation Testing

How Jenkins automated testing will make the life of an automation tester easier?

  1.      Scheduled run of Test Script.

Jenkins will allow the user to schedule test automation script and run them at a specific time.

  1.      Test Result Trend Graph.

Jenkins will display the test result trend graph. This graph will contain test failures from previous build also.

  1.      Summary of Test Result.

Test Result will contain all information such as the total number of test cases that were executed, time taken to execute the script, passed test and failed test case.

  1. Test Failure Details.

With the help of Jenkins, a tester can find details of test failure. It will display the details like error message and stack trace.

  1. Jenkins will send test result email after the execution of test script

Jenkins can send email notification. This can be achieved using the Email Notification feature in post build action.

Integrating Git with Jenkins

Integration of GitHub with Jenkins will automate testing and improve software quality. We can integrate Jenkins with GitHub projects by using the GitHub plugin.

This plugin can schedule the build, pull code and data files from the GitHub repository to the Jenkins machine and automatically trigger each build on the Jenkins server.

Steps to integrate GitHub with Jenkins

  1.      First Install GitHub Jenkins plugin.
  2.      Navigate to Manage Jenkins -> Manage Plugin->Search GitHub Plugin in the Available tab then click on Download now and install.

Create Jenkins Job

To create a new job in Jenkins, Click on New Item and then enter the Name for the New Job and choose Freestyle project.

Create Jenkins Job

In General section, you can give project description and Configure Git in the Source Code Management Section. It will specify how the source code can be retrieved.

Source Code Management

If we are using Git for source Code Management, we can enter URL of Git Repository. If the repository is not public, we can add credentials to access it.

2

Build Triggers– We can configure when and how our build should be triggered.

Build Triggers

Build– Operations that we wish to perform can be configured in this section. Here I can give the command for executing the script.

Build

Post Build Actions- Here we can configure the actions to be performed after the completion of build. Here I configure the email notification after every build.

Post Build Actions

Based on our configuration, our testing scripts will be taken from Git Repository and will be executed on a daily basis.

FacebooktwitterlinkedinFacebooktwitterlinkedin