Accelerating App Testing with Automation and Modern CI Pipelines
Tags: testing, apptesting
Published: 2022-10-27 14:37:14

Usually when we talk about Quality we think about the QA team in our organisation, but that definition has changed. Now the QA team is also looking after the release cycle process and specifically making sure that Testing is part of the release cycle with the help of CI/CD Automation.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tojuclp42hvctbru60a7.png)

CI/CD is about [continuously testing](https://www.pcloudy.com/) and integrating different teams’ efforts to accelerate software releases with utmost quality. And the CI/CD pipeline in a nutshell, can be described as a script which defines your release workflow. But the most important part here is automating each and every section on the pipeline, which also includes automating the testing phase.

To accelerate the testing cycle we need to integrate the Automation suite with CI pipeline, let’s try to understand it in more detail in the next section.


CICD Flow

Why do we need CI Pipelines With Automation?
Implementation of Agile processes has increased the number of software builds, which involves committing code changes to master regularly, but testing those builds every time manually is near to impossible.

That’s where we need to combine two worlds: QA and CI Pipeline. First we have to make sure that all our test cases are automated and we have the test suite ready with us. Now once we have our automated suite ready, the next task is to integrate those to our CI pipelines, now the question is why should we perform the CI integration?

The main reason is whenever there is a change by the development team, the CI pipeline will build the changes and at the same time trigger the Automation suite to ensure the code is always up-to-date and the changes haven’t impacted the overall features.

[Test Automation in CI/CD Pipeline](https://www.pcloudy.com/blogs/accelerating-app-testing-with-automation-and-modern-ci-pipelines/)
In this section we will integrate the Automation Suite with Jenkins job, so that whenever required we can trigger our test suites from the pipeline or even schedule the same.
Prerequisite for running :
– 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. The path which has been provided here is the path of testng xml suite used in the demo project. You will need to use the path as per the suite located on your setup.

<suiteXmlFile> tag of pom.xml:

<configuration>

<suiteXmlFiles>

<suiteXmlFile>resources\testNG_xml\RegressionSuite.xml</suiteXmlFile>

</suiteXmlFiles>

</configuration>

STEP – 02

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 the 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.

Important Note – This step is very important before starting the integration with Jenkins, because if it fails 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 create a new Jenkins job where we can integrate the automation suite which has all the test scripts for the regression suite.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0un6ph2m3hsv413v6gn.png)

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 realise 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.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hr6l93vsja9trrrup4o7.png)

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.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0y22hhhl4n7wnnf3wez6.png)

Step – 07

To Run the Suite Click on Build Now button as shown below, once you click it will trigger the automation suite and test scripts will get executed. After the execution gets completed we can see the status of the job run, and if it fails then the console output can be used to get the error logs for further fixes.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2ej54oonebb42irhoi3.png)

Benefits
Below are some of the most important benefits of App Testing with Automation and Modern CI pipelines.

Faster 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 test execution time exponentially by triggering from the pipeline. Pipeline helps the organisation to accelerate the release rate with utmost quality.
Maintains High Quality:

All the software process that includes continuous testing is on its way toward establishing a feedback loop to go fast and build effective software by making the automated suite part of the pipeline.
As we run our suite after every change done by the development 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.

Conclusion
At present in the Agile world, QA is not only responsible for testing but also responsible to bring the testing at the same pace as release builds. Automation and CI Pipelines are an integral part of modern testing which need to be brought into every software release life cycle. 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.