CICD helps continuously test and integrate different teams’ efforts to accelerate software releases with utmost quality. Continuous Integration & Continuous Delivery has been gaining a lot of attention & the most hyped topic in the DevOps world. And the CICD pipeline in a nutshell, it might be described as a script which defines your workflow. Having the right platforms and tools for rapid release cycles has become a core necessity of the software release cycle. Especially for those companies which are looking to increase the overall quality, efficiency, and pace of the software delivery process.
Among all the different types of tools available in the market for CICD integration, the most used one is Jenkins. In-fact, as per Slintel data, Jenkins has a market share of 47.69%.
Jenkins is a popular open source server used to implement CI/CD for any development project. Testing early and testing often the tool helps in accelerating the release cycle. It also helps maintain the required levels of quality via running the automated testing.
The point to gain attention here is How we can run our Automated tests with Jenkins. As most of the automation are done using Selenium, we need to first learn to integrate the selenium suites with Jenkins.
Why we need CICD Integration With Selenium Testing
Due to the Agile process and frequent changes in features, the number of software builds provided by developers has been increased. Continuous integration involves committing code changes to master regularly, triggering a build if applicable and testing the software each time.
Jenkins allows teams to execute a series of automated tests and builds. This ensures the code is always up-to-date and the automation suite is getting executed after every commit.
Usually if we don’t have Jenkins integrated with the automation suite, then it will be near to impossible to manually run the automation suite after every change in code pushed by developers. When we have integrated automation suite with Jenkins pipeline then with every commit done by developers, the automation suite will get triggered and the reports will be shared with the concerned team
One of the major roles of CICD integration is when the team is working in different time zones. Working in multiple time zones increases the duration of testing without CICD. If the developer team pushes the code in PST then if the testing team works from IST then it will take the QA another 12 hours to start testing. So instead of manually testing or triggering the automation suite, we can use the CICD pipeline to trigger our automation suite after the code is being pushed by developers.
Steps to Integrate Selenium with Jenkins
In this section we will integrate the Selenium Automation Suite with Jenkins job, so that whenever required we can trigger our test suites from the pipeline or even schedule the same. Remember that in the below demo we are using testng xml suite and the framework is designed with Maven pom.xml.
Prerequisite for running :
– Selenium Automation suite in testng xml – Jenkins server access with valid credentials
STEP - 01
Integrate testng.xml suite with pom.xml. To do that we have to pass the path of testng.xml suite inside the suiteXmlFiles tag. We need to remember that the path which has been provided here is the path of testng xml suite used in our project, so you need to use the path as per the suite located on your setup. Instead of Regression we can also pass the path of Smoke, Sanity, BVT or Confidence suite.
tag of pom.xml:
To get the entire pom.xml with dependencies required in Selenium Automation Framework Refer below link:
Go to your Automation project path and open command prompt, as shown below project name is “Task” and we have opened cmd @project location:
STEP - 03
Enter maven goal for test as: “mvn clean test” in the command prompt and hit ENTER. This will execute all the test scripts present in our suite and provide the execution status. This step is very important before starting the integration with Jenkins.
If it fails while running in the command prompt then we need to make sure to fix all the issues before moving it to the Jenkins server.
STEP - 04
Go to Jenkins, click on New Item as shown in below screenshot. This new item will help us to create a new Jenkins job where we can integrate the automation suite which has all the test scripts for the regression suite.
STEP - 05
Provide the name for the Job, in the below screenshot we have provided the project name as “UiAutomationG11” and select “Maven Project” click on OK button. We need to release that as our automation framework is in Maven so we are selecting Maven project, if you are using Gradle then you have to select accordingly.
Note: Always provide a meaningful name to the project with proper naming convention.
STEP - 06
Go to Build Select “Invoke top-level Maven targets”, and then Enter the Goals as “clean test” and put the pom.xml path of your project in the “POM” section as shown below. Now click on the “Save” button which is in the left bottom section.
Remember that as we are using it for demo so our pom.xml is in our local machine and we are providing path of the project in the POM section, but if you are trying to implement at project level then you need to integrate your github repo link in Jenkins so the code will be pulled from repo directly.
Below are some of the most important benefits of CICD Integration With Selenium Testing:
Quicker Release Cycle: Pacing up the build and testing cycle will allow the team to get new features into production faster, and it also helps to reduce the testing execution time exponentially by triggering from the pipeline. Pipeline helps the organisation to accelerate the release rate with utmost quality.
Ensures High Quality Any software development process that includes continuous testing is on its way toward establishing a critical feedback loop to go fast and build effective software by making the Selenium automated suite part of the pipeline. As we run our suite after every change done by the developer team, it always provides a quality check of each and every code pushed by the developers. The pipeline with continuous testing builds quality and reduces risk and waste in the software development lifecycle.
Simplify Rollbacks Integration of automation with the pipeline helps to run regression on code changes and if the tests fail then we can easily rollback the changes to working state. In most of the cases we basically rollback to the last successful build for stability.
No matter how stable and good your Selenium Automation Suite is but if it is not part of the Jenkins pipeline then you are not making the best use of automation testing. Though creating Automated test suites will take some time & money but making it part of the pipeline to run a validation on every deployment soon pays for themselves.
Setting up CI/CD pipeline for Selenium automation tests is no different than other development workflows. We know that it is not a cakewalk to design a Selenium automation suite, create a Jenkins job and again integrate the selenium suite with pipeline. The good thing is ThoughtFrameworks has already worked with multiple clients and provided solutions for Jenkins Pipeline integration with Selenium Testing and also supports future maintenance of Jenkins jobs along with logs debugging.
We @ThoughtFrameworks will design your automation suite and help you to create the Jenkins pipeline from scratch along with a session explaining the implementation. Let’s talk and discuss how we can help your product to reach greater heights with utmost quality by using the benefits of Jenkins Pipeline and Automation Testing.
The Evolution of Software Testing - Thought Frameworks Edition Introduction The increasing emphasis on the timely delivery of a quality software has undoubtedly made software testing an inseparably integral part
Navigating QA Career Journeys Introduction The role of software testing has emerged as a critical component in ensuring quality, reliability, and functionality for most of the software applications out there