Software development is evolving day by day and with agile and DevOps the way software is delivered has changed a lot. If you look at software testing history – initially it was just manual testing everywhere. Then came the next phase of testing, automation tools like QTP, SilkTest, etc were used for automating the tests. Automation testing was still a costly affair and was used only to a limited extent. But with the introduction of open source tools like Selenium, software testing moved to the next phase and there was more automation. Now, with agile and DevOps cycles, there is even lesser time for testing with teams having a release every week or even continuously releasing software.
These practices have tremendously cut short the time in which software is delivered. This limited time span for delivery has brought in considerable challenges for software testing and there is a need for the testing processes to evolve in order to catch up with the fast pace of delivery. This has led to shifting left approach of testing, continuous testing, and more and more automation. Automation has become the key to testing smarter. But for automation testing too, still, there is a lot of time needed to identify scenarios, write tests and do the coding. Some of the major pain points for automation testing in this scenario are difficult to ensure 100% test coverage in the limited time and maintenance of the automated tests amidst the new changes. Now, QA teams are exploring tools to become even smarter – and the ultimate solution is to bring in AI to test automation. AI can solve these pain points to a great extent - but how? That is what we will be exploring in this article – How AI can be used to enhance the entire test automation. Test Automation just automates the execution of tests. Now, what if we could automate the test automation process itself? Like writing tests, giving data sets, analyzing test results, etc. That’s where we could potentially use AI to make testing smarter.
What is AI (Artificial Intelligence) and how it can be used for test automation?
Let’s start with what is meant by Artificial Intelligence. The term Artificial Intelligence probably brings to our mind a picture of robots and humanoid cyborgs as in the ‘Terminator’ or ‘Transformers’ movies. But in reality, it is not just machines or robots with human-level intelligence that comes under AI. AI is a much broader term. We may not come across a robot in our daily life often, but we do come across AI very often. When you just Google search something or use Google maps for navigation, you are using nothing but AI. Google uses machine learning algorithms to make predictions in these cases.
Artificial Intelligence could be considered as an umbrella term for the set of algorithms and technologies that enables computer systems to mimic human intelligence and perform tasks that require the use of intelligence. Robotics, Machine learning, Data mining, Speech recognition, Natural Language Processing, Computer Vision, Cognitive computing are all part of Artificial Intelligence.
Coming to our area of interest, that is automation testing, we will be dealing with the machine-learning AI. Machine learning (ML) allows the computers to learn automatically without human intervention. The essence of machine learning is the development of algorithms that can access data, learn from the data by extracting patterns and make decisions or predictions based on it.
Coming to testing, most of the activities are repetitive because you will be doing the same things again and again. It’s all about giving different inputs and checking expected outputs and that’s the main reason it stands out to be the apt candidate for applying machine learning or AI. Inputs and expected outputs are the main things you need to train a Machine learning system (AI bot). If you have collected enough information on how a system should behave given some inputs, you can train the “bots” on this data by showing it the input and output pairs over and over again. Once the systems are trained it can predict outputs for inputs it has never even seen.
To get a better picture of how AI/ML can be implemented for test automation, let us have a look at a few of the automation testing scenarios where AI can be used:
- If you observe carefully, you can notice that while developing test cases for a function or an end to end scenario, most of the objects are static and the only variables are the flow of a sequence of actions and the response to the action. If you can train an AI bot these sequences, action and the response, over the time, the bots can come up with valid test cases for the application.
- In web automation testing using tools like Selenium, object identification is performed using locators such as XPaths, ids, name, etc. In this case, if you can train a bot to build XPath for an object once DOM is loaded in the browser, can guess the “valid actions” it could do to that “DOM object” and could call respective Selenium action method, the bot can take care of the automation coding itself and lots of human effort can be saved.
- AI/ML tools which can crawl your application and collect data having to do with features like taking screenshots, downloading HTML of every page, measuring load times and so forth can be developed. When such tools run the same steps again and again, over the time it builds up data set and train ML models for what the expected patterns of your application are. Later, while it runs, it compares its current state to all the known patterns it has already learned. In case of deviations or a visual difference or if it’s running slower than average, the smart tool can flag it as a potential issue and alert the stakeholders.
- Test cases failing because of developers making changes to the HTML code such as renaming a field name or id is very common in test automation. Your script fails just because it was not able to identify the element it needs to interact with. Now, if you have a machine learning algorithm that has been trained about your application, relationships between the parts of the DOM, and can learn about changes throughout time, it can take decisions automatically at runtime as to what locators it should use to identify an element. In that case, even if your application keeps changing, it will not be a problem, because, with ML, the script can adjust itself. This is called self-healing of the tests. There are a lot of automation tools in the market currently using these kinds of ML models to auto-heal the scripts.
- Another area where AI can come handy is in determining which test cases to run if a piece of code is changed, identify tests that are no longer relevant to the application, which tests need to be fixed, etc in your test suite. This helps to avoid running your entire test suite for small changes in your application. If you are doing continuous testing, you might already be generating a lot of related data regarding this information. But who is really going to dig into these? But ML can be used here to identify patterns and make decisions in these situations. The system can ultimately give you the minimum number of tests to be run for the change you make in the code. Such tools can even identify areas of application with low test coverage.
These are just a few areas where AI could be applied for automated testing. There are even more. Using AI for test automation is a relatively new idea and still in infancy. But it is an area which is gaining a lot of attention these days and more research happening around the topic currently. There are many tools available in the market currently that is leveraging AI and machine learning to help you with automated testing of your web/mobile applications. Here is a list of some of the interesting tools.
A list of intelligent test automation tools
Let me start the list with our tool, Browsee. In Browsee, we use AI to learn your user’s experience on your website and alert you whenever something goes wrong. The AI algorithms can also alert you of any change in the behavior of the application from previous releases so that you can verify if it is a bug or an expected behavior. It is a very simple to use tool which requires a minimum set up. You just launch your website and our intelligent bot will take care of testing your website's user experience continuously and alert you whenever something unusual happens. Sounds interesting right?
Now let’s take a look at some of the other tools using AI/machine learning for automated testing.
This tool is a visual validation automation testing tool. Visual testing is meant to verify that the UI appears correctly to users and that each element appears in right color, shape, position, and size. Applitools is an ML-based tool which leverages image recognition algorithms to visually test your mobile, web or native apps.
Test.Ai is an AI-powered automation testing tool for mobile apps. No programming skills needed to use this tool and you just need to identify a few screens and elements in your app and design a test case so that bots can verify the functionality. AI recognizes the elements and even if your UI elements change, the tests don’t break.
AutonomIQ is a cloud platform that enables testing, releasing and deployment of software. The users can instantly create test cases and generate test scripts and data, and execute tests using this tool. It uses deep learning and AI algorithms to detect changes in application and enable self-healing for test assets and to provide advanced diagnostics.
Functionize is an autonomous testing tool which lets you test fast and release faster with AI enabled cloud testing. You just need to type a test plan in plain English and it will be autonomously converted to a functional test case by Functionize. It also uses AI to self-heal the tests that update autonomously in real time and the AI diagnosis does a root cause analysis which highlights all potential causes for test failure.
Yet another tool which leverages machine learning for test automation. It uses machine learning algorithms or models for auto-healing tests, for visual anomaly detection, etc.
Testim is another automation tool which uses machine learning for test maintenance. It ensures your tests don’t fail even if the UI elements change.
Parasoft SOA test-
Parasoft SOAtest is an API tool powered by AI and machine learning. Its automated API testing mitigates the cost of re-work by proactively adjusting your library of tests as services change. It efficiently transforms your existing test artifacts into security and performance tests, to increase re-usability and reduce redundancy.
Like I already mentioned, implementation of AI in testing is still a new technology. It definitely is an innovation with the immense potential to take testing to new levels as there are more opportunities to be explored in the coming years. Implementing AI in testing can help speed up the testing process right from analyzing requirements and scenarios, writing valid test cases, data generation, executing the test cases to analyzing results. So, now the question is will the AI bots ultimately replace human testers? Well, maybe yes, but that’s a long way to go right now! After all, the fear of AI and machines replacing humans in all fields and layoffs are still a topic under debate. Let’s take it positively. When automation testing took over manual testing, there were not much of layoffs in the testing field, just that the tester's role changed from just executing tests to writing automated test cases. So, if you are automated testers now, you may evolve as testing system trainers in the AI era. Human testers working along with intelligent machines can certainly test modern software applications in a better way that is done today. So, take it as an opportunity and let machines do what they’re good at and let the humans leverage their creativity and judgments to focus on business-specific test inputs that a machine wouldn’t think to try and record it to later train the bots.
Hope you enjoyed the article!