How can Artificial Intelligence enhance software testing? Hear from Testim.io Developer Evangelist, Raj Subramanian.

Screen Shot 2018-09-29 at 12.32.42 PM-min

Technology has drastically evolved throughout the past decade. Many innovations have deeply influenced our lives such as smartphones, bitcoin, electric cars, and blockchain, but artificial intelligence (AI) definitely tops the list. AI has become vital in analyzing a large amount of unstructured data and identifying different patterns, relationships and perform process optimization in various domains including speech recognition, self-driving cars, computer vision, health care, fintech and now in software testing. We now have the ability to predict future behavior and discover patterns missed by the naked eye with the help of complex models that analyze large amounts of data. This becomes all the more important with the need to support the latest developments in software testing related to Agile Processes, DevOps and CI/CD integration.

In this digital era, organizations are forced to trade off between faster time to market and good user experience. The current goal for organizations is to run more tests, find bugs fast and release faster. AI can help to achieve this goal.

Why Embrace AI testing?

AI based testing can have a positive impact on several facets of software testing especially test automation. There have been so many different tools and frameworks that have come up trying to solve different kinds of problems related to test automation but one problem that has been a constant challenge till date, is the aspect of “maintenance”. One of the main reasons for this is the use of static locators.

With static locators, we use only one attribute of an element to uniquely identify it on a page and if this changes, the test breaks and as testers we end up spending a considerable amount of time troubleshooting the problem and fixing it. Based on research, about 30% of testers’ time is consumed in just maintaining tests. Can you imagine the opportunity cost associated with this effort? It is mind blowing. Testers’ time is valuable and better spent on actually exploring the application and providing information to help stakeholders make informed decisions about the product. With AI based testing we can overcome this problem by using dynamic locators. Dynamic Locators is a concept where we use multiple attributes of an element to locate it on on the page instead of a single attribute. This way, even if one attribute changes, the element can still be successfully located with the help of other attributes that have already been extracted from the DOM by the AI.

machine learning GIF

Now with AI, you can connect your production apps to the testing cycle. This means that we can create tests based on actual flows done by the user in production. Also, the AI can observe and find repeated steps and cluster them to make reusable components in your tests. For Example – Login, Logout scenarios. Also, the more tests you run, the smarter the AI becomes in terms of identifying flaky tests, optimizing waits in between steps and also proactively fixing issues for us before they occur due to its self-healing mechanism.

The field of test automation has historically been a technical tester focused community. This stigma can also change with AI; as it brings the concept of collaboration in test automation. What this means is, non-technical resources no longer need to fear code and technology, rather AI will help to bridge the gap between the technical know-how and authoring and execution of tests making life easier for teams.

The Tester’s Role in AI Based Testing

AI has proven ability to function with more collective intelligence, speed and scale than even the best-funded app teams of today. With Continuous Development setting an ever aggressive pace, and the combined pressure from AI inspired automation, robots, and chatbots, it begs the question that looms in the mind of most likely all software testers: are testing and QA teams under siege? Are QA roles in jeopardy of being phased out or replaced, similar to the manufacturing industry?

Over the past decade, technologies have evolved drastically, there have been so many changes happening in the technology space but one thing constant is human testers’ interaction with them and how we use them for our needs. The same holds true for AI as well. Secondly, to train the AI, we need good input/output combinations (which we call a training dataset). So to work with modern software we need to choose this training dataset carefully as the AI starts learning from this and starts creating relationships based on what we give to it. Also, it is important to monitor how the AI is learning as we give different training datasets. This is going to be vital to how the software is going to be tested as well. We would still need human involvement in training the AI.

Finally, it is important to ensure while working with AI the security, privacy and ethical aspects of the software are not compromised. All these factors contribute to better testability of the software. We need humans for this too.

So, contrary to popular belief, the outlook is not all ‘doom-and-gloom;’ being a real, live human does have its advantages.

For instance, human testers can improvise and test without written specifications, differentiate clarity from confusion, and sense when the ‘look and feel’ of an on-screen component is ‘off’ or wrong. Complete replacement of manual testers will only happen when AI exceeds those unique qualities of human intellect. There are a myriad of areas that will require in-depth testing to ensure safety, security, and accuracy of all the data-driven technology and apps being created on a daily basis. In this regard, utilizing AI for software testing is still in its infancy with the potential for monumental impact.

How is AI Shaping the Future?

AI in testing

We have discussed the various ways in which AI will influence the field of software testing and help to solve some of the biggest challenges with test automation. In the future, the way we do test automation is going to significantly change in terms of taking a more risk-based approach to software testing.

AI has the ability to learn from different user flows and create test cases based on actual user data. We no longer have to spend a lot of time to create test data based on production users since the AI is doing it automatically for us. This helps to increase test coverage and makes the automated tests much more effective as they have been created based on real user flows.

Replacing static locators with dynamic locators is going to make the tests more stable and as a result of this, the authoring and execution of tests is going to be much faster. For example – Say we have a “Checkout” button and change its name to “Buy”, the tests that would have failed earlier due to the use of a single attribute to locate the element will no longer fail as we will start using dynamic locators and make use of multiple attributes for the same element. Wherein, even if the name of the button changed, the AI will go to the next best attribute to locate the element on the page instead of failing the tests. This saves considerable amount of time maintaining the automated tests.

Also, the more tests the user runs, the more data the AI collects about the test and the more stable the tests become over a period of time. For example – based on the number of test runs, the AI can start optimizing the wait times in tests to accommodate different page load times in the application.

Finally, test automation is no more a developer-focused task.

Users can record tests on their own and also use the tests that are automatically created by the AI to create effective automated test suites. In this way, even non-technical people can author and write effective tests.

Conclusion

With the steady progress being made with AI, the truth remains that mimicking the human brain is no easy task. Humans are the users of apps and the technological innovations that are being created takes into account that, the human understanding, creativity, and contextualization are traits necessary to ensure a quality product. That said, manual testing remains essential and should compliment automation and AI. They are distinct and different functions that, instead of being compared, should be leveraged according to their respective strengths.

What’s clear is that leaders in the technology industry will continue to dissolve boundaries, discover and innovate with machine learning and AI. As QA teams continue to embrace automation and welcome AI into their software testing practices, the outcomes will contribute to new solutions and ways of working, reinventing what’s possible.

 

About the Author

Raj Subramanian

Raj Subramanian is a former developer who moved to testing to focus on his passion. Raj currently works as a Developer Evangelist for Testim.io, that provides stable self-healing AI based test automation to enterprises such as Netapp, Swisscom, Wix and Autodesk. He also provides mobile training and consulting. He actively contributes to the testing community by speaking at conferences, writing articles, blogging, making videos on his youtube channel and being directly involved in various testing-related activities. He currently resides in Chicago and can be reached [email protected] and on twitter at @epsilon11. He actively blogs on www.testim.io and www.rajsubra.com. His videos on testing, leadership and productivity can be found here.