A few decades back, Artificial Intelligence (AI) was no more than a dream, but now it has become such an inseparable part of our daily routine that imagining life without AI seems impossible. From self-driving cars, smart phones, and smart devices like Alexa and Siri to Google Maps that help you navigate your daily life, everything has become influenced or driven by AI. Thanks to the technology revolutions that make impossible things possible!
As the innovations and the usage of AI has hit our day to day life, its impact on software development is not far away. One of the examples of that is Test Automation (or automated testing). If you have spent any time in software development in the last two decades, you might remember the days when manual testing was the norm – in fact, it might still be the case in many organizations! It took several hours to test the software and it still could not be tested comprehensively. Thanks to test automation, that landscape changed completely and allowed us to test software with minimal manual effort, providing high-quality results.
However, when it comes to high-quality software testing in minimum time, even Test Automation is not enough as it needs time and effort for writing test scripts and its maintenance. With the help of AI, we can get far better results. If you are wondering how, then read on! But before that, let’s understand in brief what AI is and how it works.
What is AI?
Artificial or Machine Intelligence is intelligence shown or performed by machines (computers) based on the observation of human behavior. An AI-based system collects data of human behavior including speech, voice, face recognition and other things and learns from it. It then suggests answers to our queries based on its learning or observation. If you have an eye for detail, you must have noticed that all AI technologies have very specialized functions and not generalized. We still have a long way to reach the stage when AI will be able to do all the things that human beings can do, not just specialized activities.
AI and Machine Learning go hand in hand
Since the 1950’s, AI has been experimented with in different fields to find its ground and the term that finally made its way as an important part of AI is machine learning. ML or Machine Learning is an important part of AI that uses pattern recognition technology. It finds patterns in the data provided by you and then uses these patterns to predict future trends.
A very common and explainable example of prediction using ML is searching for something on Google, Amazon or on your favorite YouTube channel. Here the ML algorithm reads and saves the queries made by you and the next time you search for something; it suggests the queries based on your past searches. It’s like these algorithms try to read your mind and guess what you may ask for. Isn’t it amazing? Yes, it is, and that’s why AI is so powerful these days.
And the great thing is it’s not limited to just simple information retrieval and visualization, it can read and store a lot of complex information and find patterns in them. For example, an AI-based project management software can tell you how much work you will be able to complete in the future by analyzing your speed and working pattern using your past and current data.
The role of AI in Software Testing
The rise of test automation has coincided with the adoption of Agile methodologies in software development. This enables teams to deliver robust and bug-free software in small batches. Manual testing is limited to business acceptance testing only. Test Automation along with DevOps helps Agile teams to ship a fail-safe product for SaaS/ cloud deployment via a CI/ CD pipeline.
In software testing, AI is a combination of cognitive automation, reasoning, machine learning, natural language processing and analytics. Cognitive automation leverages various technological approaches like text analytics, semantic technology, data mining, natural language processing and machine learning. For example, RPA (Robotic Process Automation) is one such connecting link between Cognitive Computing and AI.
With the advent of AI, the drive for its use in software development, specifically in software testing, is only natural. Although the role of AI in testing is still in its infancy, thought leaders in this community are talking about self-generating, self-executing, and self-adapting testing frameworks.
So, let’s see how AI has changed the traditional way of testing software.
- Automating Visual Validation
A method of testing that is getting more and more popular every day is image-based testing using automated visual validation tools. There are many ML-based visual validation tools that can detect minor UI anomalies that human eyes are likely to miss.
The main purpose of UI testing is to make sure that each UI element looks good with the right shape, color, size and position and is not physically overlapping with other UI elements. All of these visual bugs can be checked by even a simple ML test without a tester having to intervene.
- Automatically Writing Test Cases
The biggest application of ML/AI in test automation has been in automatically writing test cases for software. In earlier days, we have heard about web crawlers and “spidering” (browsing a software/ web in an automated and methodical manner using an automated script or program) which helped us find 404 dead pages.
Now, AI/ML tools have gone far ahead to learn the business usage scenarios of the application under test. They just need to be pointed to the software. While learning the application, they automatically crawl and collect useful data like screenshots, HTML pages and page loading time. Over time they collect enough data from the application so that they can train the ML model for expected patterns of the app.
When they are run/ executed, the current state of the app is compared with the known or saved patterns. If there is any error, visual difference, slow run time or similar issue, then the system automatically marks it as a potential issue. However, in some cases the differences might be valid. In that case, the tester needs to validate the bug or issue.
- Improving Reliability
Are you one of those whose UFT or Selenium tests fail because of small changes to the application (like renaming or resizing a field) made by the developers? If yes, then don’t worry, this is a problem most testers face.
Now AI can correct the code and make it more reliable and maintainable so that you don’t have to change the test each time developers make a small change.
AI/ ML tools can read the changes made to the application and understand the relationship between them. Such self-healing scripts observe changes in the application and start learning the pattern of changes and then can identify a change at runtime without you having to do anything. As the app evolves the ML scripts adjust automatically, reducing flakiness and fragility of test automation.
- Reduced UI-based Testing
Another change brought by AI/ML to automation testing is automation without user interface. Non-functional tests like Unit Integration, performance, security and vulnerability are also no exception. AI/ML based techniques can be applied for generating tests in these layers. In addition, AI/ML applied on various application logs like source code and production monitoring system logs, helps in developing bug prediction, early notification, self-healing and auto-scaling capabilities in the overall software eco-system.
AI-based testing reduces overall testing cost, error, time and scripting. Isn’t it exactly what we wish for? There is no doubt that AI and ML are game-changers in the software industry and therefore it will become a trend in the market soon. It’s high time software teams move towards an AI-based approach for Software Development, Testing and Management.
If you have any questions or would like to share your experience with AI in software testing, please do get in touch with us.
– Sunita Vyas