"Artificial Intelligence" is the latest buzzword that has captured the attention of people working in many diverse fields in the past year. While the current wave of AI can be credited to the popularity of ChatGPT, the concepts and methods of artificial intelligence have existed long in the software industry in both development and testing areas. A popular example of this is self-healing test automation tools that can detect UI changes automatically and make appropriate changes in the test cases. AI is today implemented in almost all engineering fields and beyond that to help engineers, users, and make important business decisions for the future.
The software industry is no exception in this regard and this is the area we are most concerned with in this post. AI in software testing and development not only provides data-related outcomes but shares the responsibilities of a tester and a developer to accomplish a part of their tasks. This helps in early software release and quicker feedback cycles. However, discussing this area would mean jumping ahead and missing critical information about AI, its evolution, and its association with software testing.
What is artificial intelligence (AI) - A brief introduction
The most simple definition of AI is possessing an intelligence but artificial in nature i.e. not natural. By natural intelligence, we refer to the intelligence developed by humans and animals on their own with their evolution. We incorporate this intelligence into a machine and depending on the type of AI involved, the machine can provide outputs based on inputs just like a human would but in a highly restricted way (at least currently).
The field of artificial intelligence has been in development since the time of Alan Turing and as you might assume, it started with extremely basic actions. For instance, providing output for checkers and speaking the written sentence in English. For almost fifty years, the focus on artificial intelligence remained in mathematics until in 2010 it shifted towards creating intelligent machines (which was the initial aim when AI was created). A farmer monitoring his crop using AI on a mobile device
In recent years, artificial intelligence can be seen applied in a very vast variety of domains. A few of the examples are as follows:
- Crop monitoring - Agriculture field.
- Hospital staff management and environment controlling - Healthcare field.
- Risk identification and mitigation - Construction and Civil Engineering field.
- Content curation and Personalised learning experience - Education field.
- Fraud detection and prevention - Finance (Banking) field.
With these wide applications, AI seems to have seeped into every corner and making its mark. In the list above, we have left applications in the software industry intentionally as from the next section onwards, that will solely be our point of focus.
AI in the software industry
The most powerful impact AI had in any industry is the software industry. Not only in the area of end-applications (which is definitely a big chunk) but also in adopting it in their own software. The most recent example is Microsoft's Edge browser integrating ChatGPT directly into their search engine to provide search results in a conversing format. When we talk about AI in terms of software, we combine multiple technologies under a single umbrella- Machine learning and deep learning are not new terms either but if we are applying any of the two in our application, we are essentially dealing with AI in software development. Today, the software industry has an outreach of a wide range of domains that include mobile applications, web applications, IoT devices, Unix-based machine devices, and a lot more. It is surprising to see that AI has been able to penetrate all of these domains so easily in a very short period of time. Filtering out the most used areas (from an end user's perspective), you can witness the power of artificial intelligence in any of the following applications with just a Google search:
- Chatbots: A bot conversing with the user, taking inputs from them, and providing necessary outputs is a very common feature on web applications today. The usage and work of the chatbot depend on the type of application in which it is installed. Some chatbots may be planted just to provide information while some can register requests, raise queries and resolve issues without ever concerning the support team.
- Predictions: There are numerous applications appearing in the market that works on the foundation of "prediction". The type of prediction depends on the nature of the application. For example, stock market prediction applications can predict a stock price in the near future depending on past performance.
- Suggestions and Recommendations: Suggesting what could be the most "probable" choice for the user and recommending them on their profile based on their inputs (interactions or past purchases, etc) is a common element of websites especially those working in eCommerce and online streaming department. This is fairly visible while shopping on Amazon or scrolling around on Netflix (the most popular example).
- Voice assistants: Speech recognition and generating output based on speech is another popular application of artificial intelligence commonly used today. In this application, the user can provide audio inputs and interact with the voice assistant using speech. A popular example is Alexa which can converse as well as perform various tasks all by analyzing what the user is saying.
- Natural Language Processing: Detecting the input language, understanding grammar, and replying based on text is done using AI. Currently, NLP-based algorithms have moved a step ahead and can recognize two mixed languages, handwriting, and Romanized forms of languages as well.
Apart from these common applications of AI in software, there are numerous other examples and the list is increasing every day. Why do we spend so much time and effort to implement algorithms that can detect, analyze, respond, and whatnot! It's definitely user-friendly but does it bring any benefits that lure engineers and business owners to adopt it in their model as well?
Benefits of having an AI-powered software development cycle
Setting aside the applications of AI in software, there are numerous benefits that help the actual software development process and the business as a complete unit:
- Data Analysis: AI applications are extremely efficient in gathering data for the organization. Getting a recommendation automatically would help the algorithm explore your interests more clearly than you as a user searching for that product (which in a lot of cases you would not have thought to order!). This data can be gathered automatically and analyzed for making future decisions.
- Takeover development activities: AI can be implemented into actual development activities to fix minor issues without the engineers. This can also be done using predictive algorithms to predict any bugs before merging the code to the main base.
- Cost saver: AI in the applications saves a lot of costs as the business needs minimum hiring as possible. The work of hundreds of support engineers can be done by AI applications in minimum time.
- Helps in business growth: AI algorithms can predict based on past and current trends of the application and user behavior towards it. With this data, we can make future decisions, create new strategies and implement them to grow the business.
- Software testing enhancements: Apart from development, software testing has seen an equal implementation of AI into their process trying to make the tester's work easier and eliminating scripted programming for the most part. Software testing can now be done by manual testers and sometimes even business analysts as AI can take care of most of the work.
In the complete software development lifecycle, software testing has made marvelous progress toward implementing AI for the benefit of testers in a new way to shape the complete testing phase from a new start. This has helped change the priorities of an organization for the betterment and optimize their testing phase to reduce stress and effort than before.
AI in software testing - Putting a lens on test automation
Software testing is a very big domain of software engineering with multiple sub-sections exploring different aspects of software. While AI can be (and is) applied to all domains, the most visible and magnified effect can be seen in the field of test automation.
Test automation is a process of automating the test execution on the application under test without any manual interventions. For this purpose, we write test scripts that contain the actions we need to perform on the application. These test scripts then connect to multiple other processes such as test result analysis, report generation, data gathering, data manipulation, data creation, and a lot more. These many tasks when done manually do take a lot of extra time and implementing AI in all of these fields has proved to be magical for everyone.
To illustrate a bit about AI in software testing, let's consider the process of writing test scripts. This is the core step in any test automation process and artificial intelligence seems to modify it and devise an entirely new method out of it. This is called natural language processing, a branch of AI, that can understand the natural language, analyze it, and convert it to test scripts automatically. For example, if we take Selenium, we need to initialize a WebDriver first:
WebDriver driver = new WebDriver();
Then, we can open a web URL using the get method:
driver.get("http://www.demoqa.com");
To execute these two lines, we need a browser driver and a tester who knows a language supported by Selenium. This can be converted to NLP using AI to this:
Open www.demoqa.com
Or, we can directly write a test script to click a button as:
click "Submit" button
This is, however, not a standard but a hypothetical example taking motivation from the tools that are already doing it. On the other hand, AI is capable of generating the programming script also if we give it a scenario from ourselves.
Another example of AI can be data generation. Data generation is required in data-driven testing which used to be done manually and took days to come up with practical data. With AI in software testing, we can input our requirements and AI can source out real-life practical data with hundreds of rows within seconds. What took days to accomplish could now be achieved within one minute. A similar marvel is seen in other parts of software testing as well. Discussing all those, however, is not possible in a single post. Therefore, to give you a clear perspective on how AI works in software testing, we can pick up a tool that has already achieved this integration and served its testers with AI-enabled technologies aiming towards better testing in all dimensions.
Katalon's AI-powered Automation - A case study
Katalon is a test automation platform that has always tried to incorporate the best testing technologies into its platform. For instance, Selenium and Appium which are widely used for web test automation and mobile automation respectively are integrated well into the foundation of Katalon. Today, Katalon serves as a single solution for all the test automation domains including API test automation and CI/CD integration.
In recent times, owing to the strength of AI, Katalon has clearly set a vision to use those strengths to the advantage of testers and make the process smoother. Therefore, Katalon is a good option to start with a tool that works with AI technologies and get yourself ready for the future. The only pre-requisite here is to know testing as a concept and in reality.
Automatic test case development
The first AI-powered feature we see on Katalon is GPT-powered manual test generation which would be one of the first things that will be triggered in testing as this process is integrated into the JIRA eco-space. Once a ticket is raised on JIRA, you can click on the ticket: Select Generate manual test case and the test case scenarios will be generated automatically based on the ticket description: This utilizes the enhanced natural language and contextual understanding capabilities of GPT-4 to process Jira ticket descriptions accurately and efficiently.
StudioAssist - Code generation based on context
StudioAssist is a helpful assistant in Katalon Studio that again leverages GPT's power to understand the context and generate test cases accordingly. This is done automatically and just requires an open.ai key from the tester's side.
- Generate code: StudioAssist can generate automation test code suggestions by analyzing the given prompt.
- Explain code: Testers can ask StudioAssist to provide a comprehensive explanation of the highlighted code.
TrueTest (formerly known as ATG) - Code generation based on user interaction
TrueTest is a new offering from Katalon that captures user interaction and creates a map of a user. In short, TrueTest maps how an app is actually used and then automatically creates and maintains the regression tests needed to ensure coverage. This map is then used to curate tailor-made test scenarios specific to that user. This is extremely efficient in raising user satisfaction and test coverage of the suite as the more users we map, the more types of scenarios we get, and the more code we can generate.
Advanced code generation techniques are a great way to start your testing career with artificial intelligence. These save a lot of time and minimize a tester's effort on things that are repetitive or intuitive in nature. This time can then be invested in a lot more high-priority tasks such as strategizing future steps or optimizing the pipelines. Similar characteristics are reflected in this case study of AI in software testing using Katalon.
Explore Katalon's AI Capabilities
Future of AI in software testing
Currently, AI in software testing means detecting UI changes and making adjustments, test case generations, test scenarios generation, etc. Since the adoption has just started to pick up, there are still a lot of areas that need to be served through AI that is currently being worked upon through manual work or automated process which is monitored manually. Considering the current research, the following features can soon be integrated into STLC by various testing tools and organizations.
Thinning the line between development and testing
One of the most visible effects of inducting AI in software testing is that the testing process has started to shift left in the graph. This means we can now start way sooner than we would earlier and eventually saving time and wrapping things quicker than expected. In the future, this gap is seen to be reduced even furthermore where testing and development can be connected together by developing test cases as soon as a feature is written. If anything, we can even generate automatic test cases on each code save and keep modifying that test case until the developer is modifying the code. This will eliminate the time gap between code submission and testing and we can start the testing process on the same day that we start development.
Generate device-specific test cases
In our case study related to Katalon, we saw multiple test case generation scenarios based on different conditions. However, the work to extend it even further is underway to target devices as well in this process. Devices, both mobile and desktop, are released in very small intervals today as compared to ten years earlier. With so many different types of devices in the market, we may never know what our user operates on. Compare this with fifteen-day release cycles of browsers and an annual major release of OS versions, this combination stands as a huge challenge in front of us. Writing test cases for each of them is a nightmare and we generally do not analyze each one of them due to time constraints.
AI can solve this problem by targeting devices, browsers, resolutions, and operating systems while creating test cases. If there is an element developed on the web page, AI can create all the test cases there and save them in the suite. The target devices and their specifications can be saved before starting the testing process.
Creating smarter pipelines
What's inducted into the test case creation for a smarter process is ready to be included in the pipelines for the same reasons. Pipelines in test automation are automated today but need constant monitoring. There are no self-healing capabilities and once a pipeline fails, it needs to be sent to the queue again for initiation. This can extend the time to one day in most cases depending upon the queue. AI can reduce this time to continue execution, adjust test cases and let the tester know about the adjustments for further actions. If approved, we can save a lot of man-hours for testers.
Visual testing
The GUI of an application is a very important part of the process. If the user notices a slight anomaly in the UI, there is a high probability that they will exit the application and try to find alternatives that are just a Google search away. Visual testing is a testing domain that deals with such anomalies and catches the errors in UI by comparing it with a screenshot of a stable version. The current visual testing process does that with the help of a pixel-matching technique where each pixel is matched with the screenshot to find the difference. But do we need to match each pixel practically?
The answer to this is negative. The human eye cannot find the difference in minor shades of color. The future of AI in software testing deals with scenarios where AI can understand that the difference it is catching can also be caught by the end-user or not. If it is approved, the errors are not raised. The same process can be followed for element alignments as well. Inducting AI can change this process to be conducted from a user's point of view rather than a computer's point of view.
Summary
"Our intelligence is what makes us human, and AI is an extension of that quality.", said Turing award winner Yann LeCun when asked about his summary of AI which is a good one-liner to get the gist of this post as well. Testing has been a manual job for a long time and the modifications have been at a slower pace. While the impact and adoption of AI are visible in almost every field today, testing has taken good advantage of it for the betterment of the testers and, obviously, for the user as well.
The introduction of AI in testing has brought out changes such as automatic test case generators, self-healing tests, and analyzing applications as a user not as a tester. These not only deliver projects in a short time but eliminate the need to restrict your selection criteria which were earlier based on programming knowledge, framework knowledge, and how well you could write scripts in the language. Now, all you need is a good tester with good observation skills to point out defects in the application rather than a programming language. This post highlights the ongoing AI implementations and the future of AI in software testing with a case study on Katalon that is making sure all the testers using the software can leverage the powers of AI and be familiar with it. We hope this post helps you with AI-related tasks in future projects.