What’s up Guys! Welcome to automationcalling.com

In the traditional development cycle, there were situations that we had been following Waterfall where QA had to wait for a development build to deploy on QA and Stage environment. When the development team was working for new features, hotfixes or bug fixes whereas QA was working on understanding requirements and test case preparation only, QA team had no clue how the application looks and all they came to know during testing phases and come up with surprise the application is not working as expected but it supposed to be working as per requirement. This cycle is repeated again meaning go back to development comes back with all manual process.

Here are some disadvantages and time consuming or Manual Process in the development cycle.

  • Build and Deployment process is Manual.
  • Configuration issues chances are high.
  • QAs to wait for build in the testing phase.
  • No Collaboration among a team, Teamwork as a silo.
  • Build often get failed which impact the deadline.
  • QAs are not able to verify bug fixes or issues quickly.
  • QAs to wait for development dependency to deploy on multiple environments.
  • Configuration Management and Version control System maintenance is high
  • Test Execution was not automated, so no early feedback
  • No proper Unit test and it was all control with development.

To address all this issue and make collaboration with the team, come up with a process called DevOps

What is DevOps?

The terminology Dev refers to “Development” and Ops refers “Operation”. DevOps is a not a framework or process, it’s a culture to collaborate, communicate and integration between Development and Operations Team.

001_Devops_pic

How DevOps Work?

  • Tools that allows to monitor and measure the test code to build and deploy continuously for eg., tools like Jenkins, Bamboo and Travis etc.,
  • Tools that help Source Control allows the team to manage, track and document to the application code and configuration management. For eg., Tools like GitHub, Bitbucket, SVN etc.,
  • Tools that help to run the Unit test to validate your code.
  • Tool that helps to run Test Automation like Functional and Performance test to validate development code
  • Tool that helps to take build from development and deploy to multiple environments like QA, Stage, and production.
  • Tool that helps to maintain configuration management code that allows the team to deploy new code in production, also this helps to maintain Source control management and versioning system in production for multiple customers.

WHO ARE CORE MEMBERS OF DevOps TEAM?

  • Development Team
    • Developers who work for new features of upcoming releases, bug fixes, hotfixes or patch like entire development activity from Coding, Unit Test. Responsibility must be implementing Unit test part of Continuous Integration for their developed code and work with DevOps Team for property or configuration changes
    • Should create unit test Jobs in CI tools.
  • Quality Assurance:
    • Must focus and develop test automation in all areas irrespective of any devices. Should give mostly priority on Rest API test automation suites followed by UI. Must also integrate Performance Test and Security Test in CI
    • Should create functional, performance and security jobs in CI Tools.
  • Operations:
    • Release, Deploy and Monitor using tools like Chef, Puppet, Ansible, ELK etc in Production
    • Automate the process to deliver code in cloud environments for eg., AWS, Azure or a server.
    • Mostly responsibility of Production Support/System Admin
    • Continuous Deployment describes software is deployed quickly in a production environment with complete automation process in the development life cycle.

How DevOps Starts from Scratch?

DevOps can be implemented in the following ways:

  1. Automate Build and development process in in-house:
    1. Use SCM management either in GitHub, Bitbucket or SVN etc.,
    2. Make sure to implement Unit test that should interact with the database not a mockup. Can use a library like JUnit, NUnit, PHP Unit etc.,
    3. Implement Test Automation for Rest API, UI Layer, Security and Performance work on a strategy on quicker feedback. Can use tools like Selenium, Ready API, JMeter, Load Runner etc.,
    4. Implement unit level code coverage, code quality tools for eg., SonarCube.
    5. Make sure new code in testable in all ways from Development to Testing side.
  1. Continuous Integration:

Once all are done in the above section, it’s time to bring up Jenkins/Bamboo/Travis tool in place.

  1. Jenkins will allow adding multiple jobs for each activity and track on a daily basis how our newly developed and maintenance code works with integrating all in one place
  2. Jenkins allows us to install multiple plugins where we can incorporate Unit, Functional, Performance test results and plan our build and test schedule with more collaboration
  3. Possibilities of identifying early bugs in each iteration and integrate creating bugs in management tools like JIRA ,
  1. Continuous Delivery/Deployment
    1. This is the place where we get the real value of our business regarding how our code perform in the production
    2. All new and maintenance code is deployed and monitored
    3. Brings time to market, software is deployed quickly to production with the help of complete automation of the development life cycle.

Benefits of Devops:

  • Time to Market
  • Early or Quick feedback
  • Defect prevention or fewer bugs
  • No or very few configuration issues
  • Less Maintenance and lower cost to delivery.
  • No Manual intervention, a possibility of automating from Development to Deployment

So far, we have seen what is DevOps? And how exactly it is useful to implement in companies in order to achieve time to market for software products, moving forward, we are going to take a look on Continuous integration part especially on Test Automation side in Jenkins.

In this section we are going to take a look on:

  • What is Jenkins?
  • How to Install Jenkins in Windows?
  • Configuration in Jenkins
  • How to Create a Job in Jenkins?
  • How to Kick Start Cross Browser Parallel with Lambda using Jenkins?
  • How to create a simple pipeline only rely on Test Automation Side in Jenkins.

What is Jenkins?

Continuous Integration and Continuous development is an important part of DevOps, in fact it comes under umbrella of Devops, which required the tools to integrate development, testing, and operation work.

Jenkins is one of the very popular tool in the market which actually helps to achieve CI/CD process.

002_Devops_pic

Jenkins is a continuous integration/continuous deployment tools which are written in Java and come up with 1400+ plugins. It’s allowed us to build and test your software project continuously this would make easier for developers, testers and it’s easy for the users to obtain a fresh build.

The power of Jenkins is to achieve continuous integration/continuous deployment with the help of its plugin. For eg.,

  • GIT: Maintain Version Control System
  • Maven: Build and dependency management
  • Configuration Management: Tools like Puppet
  • Continuous Monitoring: Tools like Nagios

Continuous Testing: Can integrate Test automation tools like Selenium, Protractor, UFT etc., and execute with the help of Build Management tools like Maven, Gradle or Package Manager etc.,

  • Continuous Deployment: Ansible

Advantages of Jenkins:

  • It’s an Open Source tool with awesome community support
  • It’s easy to install and maintain
  • It’s built-in Java so can be portable to many platforms
  • 1400+ plugins in Jenkins can be leveraged
  • Provides pipeline functionality which helps CI for software development life cycle
  • Automate complete development life cycle

How to Install Jenkins on Windows

To download Jenkins for windows, click here. Jenkins produces two ways of release lines.

  • LTS (Long-term Support)
    • LTS releases are chosen every 12 weeks once from the stream of regular releases as the stable releases for the time
  • Weekly
    • A new release is produced weekly to deliver bug fixes and features to users and plugin developers.

It’s all depends on your organization needs. I would prefer LTS

In this example, I’m going to show how to install on windows, so I chose “Windows” installer.

003_Devops_Download_Link

After download, extract the installer.

004_Devops_Jenkins_Installer

Once extracted the zip file, right click on “Jenkins.msi” and install as administrator

005_Devops_Jenkins_Install

Here is the complete setup back to back snapshot from installation start to finish installation of Jenkins Part.

Once installation is finished, go to program files(x86) folder and verify jenkins.war file and necessary files are installed as below snapshot.

011_Devops_Jenkins_Install_location

There are two ways you can start Jenkins in Window

  • Started as windows as Service as below snapshot.

012_Devops_Jenkins_default_start

  • Started in command prompt as below013_Devops_Jenkins_start_cmd
  • To interact with machines or especially in test automation side like browser launch etc., this option is preferred

Once Jenkins server is started, it prompts you to type the default password which is located as mentioned in the below snapshot

014_Devops_Jenkins_default_home_Page

After supplied default password, click on next, select “Install Suggested Plugins” and click next

015_Devops_Customize_Jenkins

For installing the plugins take while, wait for some time as you see in the below snapshot.

016_Devops_Plugins_Installation_Progress

After completed plugins installation, it takes you to add your own username and password instead of default password. Click Next button.

Note: Jenkins Plugins allow you to setup  LDAP user account for your organization users, which will help us to login in secure and access only for organization employees.

017_Devops_setpassword

Configure URL how it needs to be configured. For this example, I keep it as localhost

018_Devops_Jenkins_host_setup

Kudos! To you guys! Jenkins has been setup successfully.

019_Devops_Start_using_Jenkins

020_Jenkins_Home_Page

It’s important to let Jenkins know where our installer has been installed. Here are the tools need to be configured in Jenkins:

  • Git Client Installer Location (or) Let Jenkins Install this installer in online
  • JDK Installer location (or) Let Jenkins Install this installer in online
  • Maven Location (or) Let Jenkins install this installer in online
  • Add Necessary credentials in Jenkins for eg., fetching repository for Bitbucket or GitHub from Cloud, we should authenticate the credentials where we can add/store in Jenkins server. So it will be easy to fetch while trigging job.

Configuration in Jenkins:

  • Go to Manage Jenkins link at the left pane
  • Click on Global tool Configuration

021_Devops_Global_tool_configuration

Expand JDK Section and configure where JDK is installed, otherwise select check box install automatically

022_Devops_JDK_configure_Jennkins

Here is the screenshot of how to configure Git client (or) leave let Jenkins install by default by checking “Install automatically”

023_Devops_configure_git

Here is the screenshot of how to configure Maven if you installed in local (or) leave let Jenkins install by default by checking “Install automatically”

024_Devops_Maven_config

The next configuration part is credential which is an important thing to store in one place. Jenkins allows us to create multiple credentials for different integration system for eg.,

  • To maintain different login access for Jenkins
  • To add third-party credentials like bitbucket or GitHub
  • To store LambdaTest credentials so that automation kickstart in a cloud environment

To Add Credentials:

  • Click on “Credentials” at the left pane

Add Credentials as mentioned in the below snapshot

025_Devops_add_credentials_bitbucket

  • Create third-party credentials account for eg., I use my bitbucket account026_Devops_Create_Bitbucket_credentials

How to Create a Job?

  1. In Jenkins Dashboard, click on “New Item” button
  2. 027_Devops_Job_creation
    1. Click “Source Code Management” tab
    2. In this example, I use bitbucket account but feel free to use GitHub or source control management.
    3. Pre-requisites:
      Your project must be exported to Bitbucket account
    4. In Credential page, make sure you configure bitbucket account
  3. 028_Devops_Bitbucket_config
  4. Make sure to add Maven Goals to kick off your automation test.

029_Devops_Build_config

How to Kick Start Cross Browser Parallel with Lambda using Jenkins?

030_Devops_TestNG_configure

  • Configure parallel thread option in TestNG
  • Create a base class to handle all configuration or initialization setup for eg., BeforeClass or BeforeSuite etc.,
  • Make sure you Lambda Username and Password in System environment variabl

Click on Build

031_Devops_build_job

Once the test is done, you will see the status of the job like below

033_Deveops_Job_status

Go to Console page in a specific build and see the test gets passed.

034_Devops_test_results

To verify the results in Cloud, Login to LambdaTest and Navigate to Automation Tab

resultsLambda

035_Test_Results

So far we have seen how to run automation in Jenkins job by configuring necessary dependencies. We are going to take a look at how to create a pipeline in Jenkins job and see how one job interacts with another job without manual intervention.

What is Jenkins Pipeline?

To explain in simple words, it’s a workflow contains multiple perform one after another in a sequential manner. Jenkins pipeline is a combination of the complete development life cycle which includes  Build, Deploy, Test and Release activities. Jenkins has multiple plugins which actually support and integrate third-party tools/libraries that help to create the job for development, QA, release, and monitoring activity.

036_Devops_build_deploy_test_release.png

In this article, I’m going to explain how to create a simple pipeline in Jenkins using automation jobs without coding/Jenkins file. Before creating a pipeline, I would suggest you create more than 1 job in Jenkins and also make sure child job is dependent on parent job. The below steps will explain to you in detail how to do that.

  • Go to your child job and click on the ‘Configure’ link
  • Click on Build Trigger tab
  • Select checkbox “Build after other projects are built” in configured Jenkins job

039_Devops_Build_Triggers

  • Click Save button

Why Jenkins Pipeline is necessary?

  • To automate the software development process
  • Helps Multiple users like developers, QA or IT team to edit and execute the job
  • For best Practice, Jenkins Pipeline must be implemented in code so that other developers can easily edit and enhance the code for better readability and maintenance.
  • Jenkins Pipeline helps to support big projects to maintain independent jobs like WebService, UI or Microservices deployment for multiple servers and kick off automation suites etc.,

To Create jobs in Jenkins, at first we must install a plugin called “Pipeline Plugin”

  1. Click on Manage Jenkins link at the left pane
  2. Click on Manage Plugins link
  3. Click on Available tab
  4. Search “Build Pipeline”
  5. 037_Devops_Pipeline_Plugins
  6. Click on “Install without Restart” this is to avoid your Jenkins restart after installing the plugin.
  7. Click on “+” Icon next to All tab
  8. Select “Pipeline” and add job name as mention in the below image.
  9. 040_Devops_Pipeline_Job
  10. Click the Save button.
  11. Parent and its downstream job get loaded as you see in the below snapshot.
  12. 041_Pipeline_Jobs
  13. Click on “Run” button
  14. It will trigger complete workflow starting REST API to UI Automation.
  15. Pipeline Project current running status
  16. 042_Pipeline_Running_Status
  17. Click on Icon at bottom right pane to track console
  18. 043_Pipeline_console_status
  19. Finally test runs successfully and sees the latest results at top of the page

FinalPipelineResults

With this article, we learned how to set up Jenkins from scratch, create a job and run in a pipeline project. Thanks for your time and please provide your feedback.

Please scribe my blog for more updates!

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s