Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Overcoming the Pitfalls of Maintenance in Continuous Testing

DZone's Guide to

Overcoming the Pitfalls of Maintenance in Continuous Testing

Learn how companies are using Dynamic Locators to overcome the challenges of continuous testing to enable continuous integration and delivery.

· DevOps Zone ·
Free Resource

Read why times series is the fastest growing database category.

We live in a competitive era where meeting customers expectations and demands is the key to winning over your competition. Digital media is the battlefield and fast release cycle if your weapon. The need to release software at a rapid pace requires continuous integration (CI) and deployment (CD) is key to drive the frequency in which code is pushed to production.

Throughout this process, it is important for testing to start right from the requirements phase and continue all the way until production deployment and monitoring. This is what we call "Continuous Testing" (CT). Automation is a vital component of CT and starts early in the software development lifecycle. here have been various challenges related to test automation in a CT/CI/CD environment such as skill set, authoring, execution, and scaling of automated tests. But the biggest challenge that still continues to haunt teams is the challenge of maintenance.

For example - Say the team has written 500 tests. The next day, they come in only to find out that, half of them have failed due to multiple factors. They slowly start realizing that, this is a regular occurrence and they have been spending about half their time just trying to fix these failed tests. Does this ring a bell?

These failures are a result of the agile methodologies organization use today and constant changes the developers make to the application under test (AUT). They are usually related to the use of static locators in the application where a developer changes the name, id or another attribute of an element and the tests immediately break due to this change. As a result, testers have to try troubleshooting the problem by identifying which element has changed, then update the test scripts accordingly and re-run the test to ensure it passes. There is a lot of wastage of cost, time and effort.

I've recently seen an innovative approach to that challenge using "Dynamic Locators." This is a strategy where we get multiple attributes for every single element of the AUT we interact through our tests and create a list of location strategies. So when the test runs and detects a change in the element property, it can look for the next best location strategy from the list; instead of failing. Thus making the test adaptive to the changes in the AUT. For example - If a developer changes the name of a "Login" button to "Submit", instead of the test breaking due to this change, the test looks for the next best location strategy of the button which could be id, class, tag or any other attribute which has already been extracted from the Document Object Model (DOM). This is how Dynamic Locators can help in creating more stable tests. As a result of this, the authoring and execution of the test is really fast and far less time is spent on maintaining the tests.

Testim.io, for example, utilizes Dynamic Locators and helps in easy authoring, execution and maintenance of automated tests. The Artificial Intelligence (AI) underneath the hood, analyzes the DOM in real time and extracts all the object trees and properties. Finally, the AI decides the best location strategy to locate a particular element based on this analysis, as it has already extracted multiple attributes for each element. It also supports cross-browser testing using the same location strategy. In fact, they have a webinar coming up and I will be speaking on the same topic. Check it out here: Not Another Browser Version... Continuous Cross Browser Testing for a Changing World.

In summary, as we go through the continuous testing cycle, it is important to pay attention to problems due to maintenance; take corrective actions immediately and prevent this being a bottleneck for faster release cycles.

Please feel free to share your thoughts and experiences you have had in a CI/CD/CT environment below in the comments section.

Learn how to get 20x more performance than Elastic by moving to a Time Series database.

Topics:
devops ,continuous testing ,test automation ,ci/cd

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}