DevOps in Automation Testing

DevOps in Automation Testing

19 June 2024 5 Minutes Read BY Anjana Prakash

What is Devops

In simple word we can say devops is development + Operations .Devops helps to increase the viability, speed, and security of development of software and its delivery compared to traditional software development processes. In DevOps model, development and operations teams work together throughout the  software application life cycle, from development, test, deployment and operations. Let’s analyze the role of DevOps in Automation Testing.

A successful DevOps testing strategy starts with adopting the top agile practice of Continuous Integration (CI)., where developers frequently push/pull code into a shared repository. Each check-in is validated by an automated build, enabling teams to detect errors and conflicts promptly. CI/CD tools like Jenkins automate the build, test, and deployment of applications whenever there are changes, accelerating the release process.

Some DevOps process like continuous Integration and continuous Delivery( CI/ CD) support frequent software releases. This implies that software testing is crucial for ensuring software quality throughout every phase of the development lifecycle.

 

Traditional Testing method

Traditional software testing and testing in a DevOps environment differ significantly.. Under the old waterfall methodology, testing was confined to a single phase of the life cycle, commencing only after the entire software was developed. This manual process was highly prone to errors and time-consuming. Additionally, software testers were part of a separate team, isolated from developers, making it challenging and costly to address bugs discovered during testing. These issues arose because error scenarios needed to be identified early in the process. Consequently, maintaining the desired standards and quality within the expected timeline was difficult.

 

Key Aspects of Testing in a DevOps Environment

Organizations are rapidly adopting DevOps for Agile teams, emphasizing automated testing activities. Here are the key features of DevOps testing:

 

key features of DevOps testing - Testvox

 

 

Effective DevOps Testing Approach

Selecting the right DevOps automation tools is not enough to ensure the success of DevOps testing. A well-crafted DevOps testing strategy is essential. This strategy should take into account the organization’s skillsets, ecosystem, architecture, and release patterns. Here are some useful guidelines:

  • Identify specific test cases for particular builds and create corresponding test suites.
  • Prioritize unit tests, as they are faster and more stable.
  • Employ test coverage tools and quality gates to ensure that unit testing standards are met.
  • Focus end-to-end tests on end-user scenarios only.
  • Implement quality checks at all levels and environments, including QA, Staging, and Production.
  • Ensure your automation tool supports parallel and compatibility testing, and design your automation architecture accordingly.
  • Conduct testing on various platforms, such as Mac, Windows, and Linux, with supported browsers like Chrome, Firefox, and Edge.
  • Make the development code author primarily responsible for addressing failures, thus delegating testing responsibility across team members.
  • Adopt monitoring tools like Splunk, Datadog, and Grafana to continuously monitor application health.
  • Consider building test harness tools to support test cases that cannot be directly automated, finding workarounds as needed.
  • Automate your end-to-end tests for web, mobile, desktop applications, and APIs 5x faster using Test Automation tools.

 

DevOps – CI/CD

Continuous Integration (CI) and Continuous Delivery (CD) are practices in software development aimed at improving the quality, efficiency, and reliability of software deployment. Although they are often mentioned together and share some similarities, they address different stages of the software development lifecycle.

Role of Automation testing tools

DevOps is each about automating the process. Selection of right tool at every stage is important. As we know more tools bring further conservation and further complexity. Considering the DevOps testing you need to choose the tool precisely.

As there are numerous testing types you can not have different testing tools for each type of testing. This may make your testing more complex and demands more professed coffers. Instead, select an automation tool that supports various types of testing, requires minimal technical expertise, and easily integrates with the DevOps ecosystem.

 

Let’s discuss few tools and steps to configure for  DevOps testing

1)Create a test script in any framework using a automation tool. Here in this article i have used Selenium-Maven project in eclipse.

 

Selenium script for Devops testing

2)Push the code into a git repository.

 

github for Devops

 

3)Setup jenkins in your system.

1.jenkins

  • Download Jenkins.war file from google
  • Open command prompt and then type ‘Java -jar “drag and drop the downloaded war file here”
  • By clicking on Enter a key will be generated
  • Open chrome browser and type ‘localhost:8080 and click on enter
  • Install suggested plugins from the opened window
  • Create username and password and click on ‘start using jenkins’

2. Navigate to pluginManager from Manage Jenkins and install the below plugins

  •  Maven Integration Plugin
  • TestNG Result Plugin
  • HTML Publisher plugin

3. Click on ‘New Item’ from dashboard. enter the item name and select ‘Maven project’->click on ‘OK”

 

jenkins for Devops in Automation Testing

4. Configure the CI setup for the project

  • Configure the git repository url in ‘source code management’

configuring the git repository

 

 

configuring the git repository for Devops

 

  • Mention pom.xml in root POM
  • Give Goal and Options as in screenshot

configuring git repository for Devops

 

  • Add post step with following data

post configuration of github repository for devops

 

  • If you want to generate HTML Extend report, then provide Extent.html file path from ‘Workspace’ and provide a title.

github configuration of repository for Devops

 

 

  • For generating TestNG report configure as below

github repository configuration for Devops

 

  • Click on Save

 

5. Build the execution.

  • Click on ‘Build Now’ from the left side panel.

 

6.

jenkins dashboard

 

 

Also in Jenkins if we want to schedule an automatic run at a specific time we can do that by selecting the ‘Build Periodically’ option in the build triggers section.

  • With the following cron configuration, the build execution will automatically trigger every day at 10:30 AM IST:

30 10 * * *

  • Jenkins will use the server’s timezone settings, so ensure your server is set to the desired timezone (Asia/Calcutta in this case). If needed, you can configure the timezone by setting the TZ environment variable or adjusting the Java runtime settings to use a specific timezone. However, there is no direct option within Jenkins’ web interface to change the timezone.

 

 

Conclusion

Automation in DevOps optimizes software development workflows, enhancing their simplicity, speed, and efficiency. This empowers development and operations teams to build, test, deploy, and maintain code more quickly and with higher quality than traditional manual practices. By integrating automated tools and workflows, teams can reduce the likelihood of errors, enhance collaboration, and ensure consistent delivery. Additionally, Test automation allows for continuous integration and continuous delivery (CI/CD), which further accelerates the development lifecycle and improves overall product reliability.

Moreover, automation in DevOps fosters a culture of continuous improvement and rapid feedback, enabling teams to respond swiftly to changing requirements and market demands. This proactive approach not only mitigates risks but also facilitates innovation, as teams can experiment with new features and solutions with minimal downtime. As automation tools and practices continue to evolve, the potential for even greater efficiencies and enhancements in software development becomes increasingly attainable. In conclusion, embracing automation within DevOps is not just a technological advancement but a strategic imperative for organizations aiming to stay competitive in today’s fast-paced digital landscape.

 

Anjana Prakash

Senior Automation Test Engineer at Testvox.