Table of Contents

Scattered to Shielded: Generative AI’s Strategy for Predicting and Strengthening Software Test Coverage

Screenshot 2023-08-29 at 12.11.46 PM

Summary

This article reveals how Generative AI takes a multi-pronged approach to safeguarding software quality by healthy requirements assessment, masterminding intelligent test plan creation, ensuring impenetrable code coverage, elevating test design through automated generation, harnessing defect prediction, and molding a proactive shield through predictive analysis. We will dive deep into unlocking the arsenal of protection.

Introduction

"The trouble with programmers is that you can never tell what a programmer is doing until it’s too late." - Seymour Cray.

Did you know that, on average, developers create 15-50 errors per 1000 lines of code (McConnell, 2022)?  In our hyper-connected world, the consequences of these errors can be surprising, affecting everything from personal data security to global financial systems. But what if there was an innovative guardian, a veritable shield, that could predict and reinforce the walls of software testing?
In this article, we unravel the power of Generative AI as it embarks on a quest to revolutionize software testing. We shall traverse through how Generative AI is not just another tool, but a skilled conductor orchestrating a symphony of strategies including fortifying requirements assessment, inventively devising test plans, ensuring dense code coverage, creating dynamic test designs, and proactively identifying potential defects.

Why is this information a gold mine for you? Whether you are a software developer, QA engineer, project manager, or a curious enthusiast, understanding and utilizing Generative AI for software test coverage is a vital skill in the modern landscape. It is like having a crystal ball that can see into the depths of the code, spotting the hint of a bug or flaw, and guiding you to create more reliable and robust software.
Your mission for answers ends here. Join us as we unlock the bastion of protection with Generative AI in software test coverage. Let’s get started!

Understanding the Battleground: What is Test Coverage?

Screenshot 2023-08-29 at 12.12.26 PM

Before applying the power of Generative AI, it is crucial to understand what software test coverage involves. It is a metric used in software testing to describe the degree to which the source code of a program is executed during a testing process.

“A high coverage indicates that a larger portion of the code has been evaluated, thus reducing the probability of unexplored bugs.”

Why is it Important?

Understanding the areas of code that have been tested helps in identifying the parts that might need additional testing. It is helpful in improving software quality, minimizing risks, and ensuring that the final product meets the desired expectations. 

“High test coverage indicates a lower chance of undetected bugs in production, ensuring a high-quality product.”

For instance, imagine launching a banking app without adequately testing the fund transfer feature. Any undetected bugs could result in monetary losses for customers.

Know Your Ally - Generative AI

Screenshot 2023-08-29 at 12.13.03 PM

What Makes Generative AI Special

Generative AI is not just any AI. It is a class that can generate new data resembling input data. These models learn patterns, structures, and characteristics from existing data and create new data that is similar but not identical. Common examples include text, images, and videos.

Applying Generative AI to Software Test Coverage

Screenshot 2023-08-29 at 12.13.35 PM

  • Bridge the requirement gaps: Forecast bugs by analyzing the requirement gaps or missing requirements.
  • Proactive Defect Identification: Analyze the requirement to identify potential defects in the application.
  • Trend Analysis: Identify the software sensibility.
  • Test case review for Defect Prediction: Forecast the defects by reviewing the test cases and identifying coverage issues.
  • Improving Automation Coverage: Forecast the defects due to automation coverage issues. 

Let’s dive into each one of these scenarios to understand the insights of Generative AI for improving the coverage of Software testing.

Forecast bugs by analyzing the requirement gaps or missing requirements – Bridge the requirement gaps

Generative AI plays a crucial role in identifying the missing requirements by analyzing the requirements given. This can be achieved in multiple ways as follows.

1. Document Analysis:

AI can be used to analyze the system's requirements documents. The AI could be trained to understand the technical language used in these documents and identify any areas where the requirements are not well defined, inconsistent, or missing altogether.

For example, assume that we have a requirement document for a banking application. It may contain specifications like, "The application should allow transferring funds between user's own accounts." By feeding this info to “Generative AI,” it can read such specifications and analyze for ambiguous or poorly defined areas.

For instance, it might flag the above statement, asking for clarity on whether there are any limits to the transfer amount, frequency of transfers, or what types of accounts can be involved. 

2. Gap Analysis:

AI can perform a gap analysis, comparing the actual application’s behavior to the expected behavior based on the requirements. Any discrepancies could indicate a leakage in the requirements.
Consider a scenario for developing a secure file-sharing application. The requirements include: "Users must be able to upload files, users must be able to download files and users must be able to share download links to their files.
In this scenario, the requirement is missing detailed specifications on access controls or permissions for shared links. For instance, the document doesn't answer questions like: 

  • Who can access a file once the link is shared?
  • Should the link work indefinitely, or should it expire after a certain period?
  • Can the user who shares the file revoke access at any time?

In this case, an AI system trained to identify comprehensive requirements might flag this omission for attention, highlighting that additional details are needed around file access control to create a secure and reliable application.

3. Anomaly Analysis:

AI will help in identifying the missing or unclear requirements by comparing system behavior against typical or expected patterns. This will enhance the system by making the requirements more precise and the software more aligned with user expectations.

Let’s take an example where we have a non-functional requirement state, "The app should respond to user input within 2 seconds." When this requirement is fed to Generative AI, it will analyze the input with similar requirements or apps or domains and raise the anomalies where the app takes longer than 2 seconds to respond, indicating a leakage in performance requirements.

Natural Language Processing

AI can use natural language processing to understand the intent behind requirements, and identify ambiguities, inconsistencies, and missing information, potentially revealing requirement leakages. AI with NLP could analyze the relations between different requirements. If two features are dependent, the requirements related to them should be coherent and complement each other.

For example, in an e-commerce app, one requirement states, "Users should be able to review products," and another says, "Product reviews should be displayed to potential buyers." An AI using NLP could flag a gap, as there is no requirement to define how user reviews are linked to their respective products, which is crucial for the system to function correctly. This highlights the importance of analyzing inter-requirement relations.

Example:

I have a requirement for an improved checkout process as follows, and I want to do a requirement gap analysis to identify the ambiguous requirements or missing requirements. 

User Story 5: Improved Checkout Experience

  • 5.1 As a customer, I want to see a summary of my order before finalizing the purchase, so that I can review and confirm the details of my purchase. 
    • Acceptance Criteria: 
      • Display an order summary page during the checkout process, including item details, quantities, prices, and any applied discounts.
      • Allow users to review and edit their order, shipping address, and payment information before submitting. 
      • Provide a clear call-to-action for users to finalize their purchase. 
  • 5.2 As a customer, I want the option to use a guest checkout, so that I can complete my purchase without creating an account. 
    • Acceptance Criteria: 
      • Offer a guest checkout option for users who do not wish to create an account. 
      • Collect the necessary shipping and payment information during the guest checkout process. 
      • Provide a prompt for users to create an account or sign in after completing the guest checkout if they wish to save their information for future purchases. 
  • 5.3 As a customer, I want to be able to choose from multiple payment options, so that I can select the most convenient and secure method for me.
    • Acceptance Criteria: 
      • Integrate with multiple payment gateways, including credit cards, digital wallets, and bank transfers.

PROMPT: 
Act as a defect forecaster, the most advanced AI forecasting tool. As a forecaster, you can answer any forecasting question and provide real-world examples using requirements or input blocks. Even if you are not aware of the answer, use your extreme intelligence to find the answer from your domain or historical experience. I want you to analyze the above requirements and forecast the defects due to inadequate requirement coverage. 

Output: Here generative AI proposed gaps or ambiguity in requirements with detailed pointers. This will help us to enhance our requirements before the development begins.

Screenshot 2023-08-29 at 12.14.49 PM

Analyze the requirement to identify potential defects in application – Proactive Defect Identification.

Generative AI also demonstrates its ability to proactively identify potential defects within the application by thoroughly examining the given requirements. This can be achieved through the following methods:

1. Historical Data Analysis:

AI can leverage historical data, encompassing previous projects, and domain experience to forecast potential challenges.

For instance, imagine we are in the process of creating a fresh social media application. Given the historic track record, social media platforms often wrestle with privacy and security concerns related to user data. Using this historical insight, an AI system could pinpoint this as a probable area of high defect risk. It could recommend applying additional efforts to build robust security protocols to prevent potential data breaches.

2. Pattern Recognition:

By feeding the historical defect information to the generative AI, it will try to identify the patterns of defects or issues in each component or module to generate a heat map on the buggiest area. Based on this knowledge, AI can forecast the defects in application modules' functional areas, or requirements.    

Example:

I want generative AI to review my requirements and find the probability of bug occurrences and notify me of the areas to be taken care of in my testing. 

Note: Here User Story 5 was updated based on the suggestion shared by Generative AI in the previous example.

User Story 5:  Improved Checkout Experience.

  • 5.1 As a customer, I want to see a summary of my order before finalizing the purchase, so that I can review and confirm the details of my purchase.
    • Acceptance Criteria:
      • Display an order summary page during the checkout process, including item details, quantities, prices, and any applied discounts.
      • Allow users to review and edit their order, shipping address, and payment information before submitting.
      • Provide a clear call-to-action for users to finalize their purchase.
      • Implement cart persistence to handle cases where the user's session expires or when the user leaves the page without completing the purchase.
      • Handle errors or failed transactions during the checkout process with appropriate error messages and user guidance. 
    • Acceptance Criteria:
      • Offer a guest checkout option for users who do not wish to create an account.
      • Collect the necessary shipping and payment information during the guest checkout process.
      • Provide a prompt for users to create an account or sign in after completing the guest checkout if they wish to save their information for future purchases.
      • Handle cases where a guest user has previously made a purchase with the same email address by prompting them to log in or merge their information.
      • Implement security and privacy measures for guest checkout, including data retention and protection policies. 5.2 As a customer, I want the option to use a guest checkout, so that I can complete my purchase without creating an account.

 

  • 5.3 As a customer, I want to be able to choose from multiple payment options, so that I can select the most convenient and secure method for me.
    • Acceptance Criteria:
      • Integrate multiple payment gateways, including credit cards, digital wallets, and bank transfers.
      • Handle cases where a payment gateway is temporarily unavailable or experiences issues by providing an appropriate error message and offering alternative payment methods.
      • Implement currency conversion for international customers and display relevant tax information during the checkout process
PROMPT:

As a defect forecaster, predict the top 5 possibilities of defects by thoroughly analyzing User Story 5 and its child user stories, drawing upon your knowledge of common issues in e-commerce websites. Forecast the defects from the perspective of a software tester, please provide a comprehensive list of the top potential defects for an e-commerce website enhancement, covering edge cases, front end, backend, API scenarios, as well as browser and device compatibility issues. Organize the information in a table with columns for defect ID, defect title, description, steps to reproduce, priority, module, defect type (functional, regression, UI, integration, or backend), and probability% based on requirement data, emphasizing integration and compatibility issues.

Output:

Here Generative AI found the top 5 potential bugs that may occur due to new features or requirements along with the probability % prediction.

Screenshot 2023-08-29 at 12.16.54 PM

Identify Software Sensibility- Trend Analysis

Software sensibility refers to how changes in one part of the software affect other parts. Understanding this helps in predicting potential cascading bugs. Generative AI, with its pattern recognition capability, can analyze software sensibility trends and predict such bugs. Let us see how this can be achieved.

1. Historical Data Analysis: 

Generative AI can be leveraged to study past software versions or similar software or by reading your project's historical bugs. This will enable us to identify how changes in one part affect others. If changes in a database schema have previously caused unexpected UI issues, AI can predict a similar scenario in the current project.

For instance, an e-commerce company made changes to its customer database schema in the past, which unexpectedly led to problems in the user interface. Here, changes to the database schema might have affected the way customers' purchase history was displayed on their profile pages.

With generative AI, this historical data can be studied to understand how changes in one area (the database schema) led to problems in another (the UI). So, if the company plans another schema change in its upcoming software update, the AI can alert the team to potential UI issues that may arise, enabling proactive mitigation strategies.

2. Model-based Analysis: 

AI can create models of software to better understand the relationships between its different components. By analyzing these models, it can predict which components might be sensitive to changes in others.

For example, an e-commerce platform comprises several components including user management, product catalog, shopping cart, and payment processing systems.

The generative AI creates a model of this platform, representing how all these different components interact. Suppose there is a new requirement to introduce a gift-wrapping feature. While it might seem that this only affects the shopping cart system, the AI can predict that it also impacts other components. For instance, the product catalog needs to indicate which items are eligible for gift wrapping, and the payment system needs to add the cost of gift wrapping if a user opts for it.

With this model-based analysis, the AI can help the development team foresee and address these potential cross-component issues before they cause problems.

3. Cross-Project Analysis:

Generative AI can learn from the trends in different projects and apply that knowledge to predict the software sensibility of a new project. If moving to a microservices architecture in other projects has resulted in specific integration bugs, the AI can alert the team to these potential problems.

For example, an e-commerce company has previously launched multiple country-specific websites. During these projects, they found that integrating local payment gateways often caused specific bugs or challenges, such as handling different currencies or addressing country-specific transaction laws.

The generative AI can learn from these cross-project trends. If the company plans to launch another country-specific website, the AI can alert the team to these potential payment gateway integration challenges ahead of time. The development team can then proactively plan to tackle these issues, resulting in smoother project implementations.

Example:
By examining our historical list of defects, I want Generative AI to conduct trend analysis and determine the sensitivity of various modules along with technical suggestions to the developer.

PROMPT:

  • Act as a defect forecaster, After analyzing the following list of defects provided, please suggest detailed technical action items for developers to be considered during the design process to avoid the issues. Analyze the trends to prevent these issues from occurring in future releases. Also, provided me with the software sensibility for the analyzed patterns. Organize the information in a table with columns for Component name, Description, Priority, Quick action for tester and Technical Action Items for Developers, and Software Sensibility %. 

Defect ID    Defect Title    Description    Steps to Reproduce    Priority    Module

011 Edge Case: Currency Conversion Error    Incorrect currency conversion rate applied during checkout

1. Change the website currency 2. Add items to the cart 3. Proceed to checkout 4. Review the order summary    Low Checkout

012 Edge Case: Unusual Character Input    The system crashes or behaves unexpectedly when unusual characters are entered in address or payment fields    1. Add items to the cart 2. Proceed to checkout 3. Enter unusual characters in the address or payment fields 4. Submit the order    Low    Checkout

11013 Edge Case: Unexpected Browser Extension Interaction    A browser extension interferes with the checkout process or UI    1. Install a specific browser extension 2. Open the website 3. Add items to the cart 4. Proceed to check Low Compatibility

014 Edge Case: High Load during Checkout    The system experiences performance issues or crashes under high load during the checkout process    1. Simulate high load on the website 2. Add items to the cart 3. Proceed to checkout 4. Submit the order    Low    Backend

015 Edge Case: Session Timeout during Checkout    The user's session times out during the checkout process, resulting in data loss or errors    1. Add items to the cart 2. Wait for an extended period before proceeding to checkout 3. Complete the checkout process  Lo Backend

Screenshot 2023-08-29 at 12.17.35 PM

 

Forecast the defects by reviewing the test cases and identifying coverage issues- Test case Review for defect prediction

Test case review is a crucial part of the software testing process. Generative AI can take this a notch higher by not only reviewing the test cases but also predicting potential defects based on test coverage issues.

1. Test Case Analysis: 

AI can analyze the test cases to identify areas not adequately evaluated. This can be achieved by feeding your requirement and the list of new test cases designed for Generative AI.

For example, consider a scenario where the e-commerce site allows customers to apply discount codes during checkout. If there aren't any test cases covering scenarios where multiple discount codes are applied simultaneously, or where expired discount codes are used, the AI could predict potential issues in these untested areas. It might suggest that the checkout process could fail, or incorrect discounts could be applied under these conditions, leading to revenue losses.

2. Test Coverage Estimation:

Generative AI can also estimate the test coverage based on the requirements and existing test cases.

For example, let's assume that the e-commerce platform provides multiple shipping options, like standard, express, and same-day delivery, as outlined in the requirements. However, upon reviewing the test cases, the

AI finds that only standard and express shipping have been evaluated. In this situation, the AI could highlight this coverage gap and predict potential issues with the untested same-day delivery feature. Problems might include incorrect shipping fees, inaccurate delivery estimates, or the feature not showing up at checkout.

3. Predictive Modeling:

Generative AI can analyze the results of previous test cases to anticipate potential issues in new ones. This can be done by feeding the AI with a combination of existing test cases and their associated bug details, current requirements paired with proposed feature changes, and newly crafted test cases. This comprehensive dataset empowers the Generative AI to foresee potential defects resulting from test coverage gaps, based on historical defect trends or areas known to be sensitive to bugs. This will help QA to increase the coverage of test cases based on suggested defects.

For example, an e-commerce platform has a history of defects related to its complex product recommendation engine, a feature that suggests products based on user's browsing history and preferences. If similar complex features are being introduced in a new update - say, a feature to suggest products based on the customer's past purchases - the AI might predict that this new feature could also be bug-prone. It could recommend enhanced testing for this feature to prevent potential defects in the live environment.

Example:

I want Generative AI to serve as a test case reviewer, predicting bugs that may arise due to insufficiently designed test cases. Additionally, I want it to automatically design test cases for any scenarios we may have overlooked. To accomplish this, we need to provide the Generative AI with both the requirements and the currently designed test cases.

PROMPT:

  • As a defect forecaster, predict the defect by acting as a test case reviewer. Forecast the bugs that may occur due to inadequate test cases designed by reviewing the following test cases and suggest a few test cases that can be added to the existing test suite. - Can I get test cases designed for the same in a tabular format with Test case ID, Test case title, Scenario, Description, pre-requisite, Test Steps, Priority, Module, Test type as functional, regression, Integration, backend,UI, Compatibility, Probability of failure for below requirements and test cases Requirements- User Story5 from above examples along with test case designed.

 

Screenshot 2023-08-29 at 12.18.36 PM

Lack of automation coverage can often lead to undetected bugs, particularly in large, complex systems where manual testing may not reach every corner. However, Generative AI can help improve this situation by automating the test coverage process by reviewing your test script and the requirements, therefore increasing the likelihood of uncovering latent defects. Here is how it could work.

1. Automated Test Generation:

The Generative AI can understand the software requirements and then generate automated test cases that satisfy those requirements. For instance, given the requirement "The user should be able to add a product to their cart from the product page," the AI could generate an automated test case that simulates a user adding a product to their cart and then checks if the product has been successfully added. This could significantly enhance the depth and breadth of the test coverage, leading to more robust software. 

2. Analyzing Automation Scripts:

Besides creating test cases, the AI can also analyze existing automation scripts. If the AI is fed the new requirements along with the existing automated scripts, it can identify gaps in automation coverage. For instance, if the e-commerce website adds a new payment method but the existing automated scripts do not cover assessing this method, the AI would flag this as a potential source of defects.

3. Risk-based Prioritization:

Generative AI can also leverage historical data and pattern analysis to prioritize test cases based on risk. If, for example, features related to the checkout process on the e-commerce site are more prone to defects, the AI could prioritize creating test cases for any latest changes in these areas. This would ensure that high-risk areas are thoroughly tested and any potential defects are caught early.

Example:

I want Generative AI to forecast the bugs due to a lack of coverage in my automation script.

Input:

Screenshot 2023-08-29 at 12.19.26 PM

Output:

Screenshot 2023-08-29 at 12.19.51 PM

Limitations: 

  • Quality of Data: The performance of Generative AI depends on the quality and quantity of data provided to it. Insufficient or incorrect data can lead to inaccurate predictions.
  • Dependence on Historical Data: Generative AI's ability to forecast bugs, perform trend analysis, and do risk-based prioritization depends heavily on past data. In the absence of substantial historical data, these predictions might not be accurate.
  • Interpretability: AI systems often function as a black box, making it difficult for users to understand how they reached a specific conclusion or prediction.
  • Over Dependent: There's a risk of overreliance on AI, potentially causing human testers to overlook certain aspects, by assuming that the AI has covered everything.

Conclusion:

The future of software testing lies in controlling the power of Generative AI. From understanding requirement gaps to predicting potential defects, automating test case generation, and enhancing automation coverage, AI holds the potential to revolutionize the way we approach software testing. While the practical application of these strategies comes with its challenges, the advantageous impacts are predominant. The chase for more reliable, robust software is leading us to smarter, more proactive testing approaches with AI at the wheel, promising a future where bugs or defects can be detected and mitigated even before they arise. As we continue to explore and exploit the capabilities of Generative AI, we are not just predicting the future of software testing — we are actively defining or shaping it.

About Encora:

Encora specializes in providing software engineering services with a Nearshore advantage especially well-suited to established and start-up software companies, and industries. We have been headquartered in Silicon Valley for over 20 years, and have engineering centers in Latin America (Costa Rica, Peru, Bolivia, and Colombia). The Encora model is highly collaborative, Agile, English language, same U.S. time-zone, immediately available engineering resources, and economical and quality engineering across the Product Development Lifecycle. 

Contact Us

References:

  • Code-complete book written by Steve McConnel 

Author Bio 

AUTHOR –1 

⦁    Name: Keerthi Vaddi
⦁    Position at Encora: Sr. QA Manager
⦁    Education- B.Tech(Computer Science & Engineering)
⦁    Experience - 12 Years
⦁    LinkedIn Profile:  https://www.linkedin.com/in/keerthi-vaddi-730a9a1b9/

 AUTHOR –2

 ⦁    Name: Mohsin Khan
⦁    Position at Encora: QA-Lead
⦁    Education-B.Tech (Computer science & Engineering)
⦁    Experience- 8 Years
⦁    LinkedIn Profile: https://www.linkedin.com/in/mohsin-khan-%D9%85%D8%AD%D8%B3%D9%86-%D8%AE%D8%A7%D9%86-65408b140/

 

 

 

 

 

Learn More about Encora

We are the software development company fiercely committed and uniquely equipped to enable companies to do what they can’t do now.

Learn More

Global Delivery

READ MORE

Careers

READ MORE

Industries

READ MORE

Related Insights

The Role of Multi-Omics in Precision Medicine: A Transformative Approach to Healthcare

Explore the transformative role of multi-omics in precision medicine, revolutionizing healthcare ...

Read More

Digital Twins: Reimagining the Future of Energy & Utilities

From smart grids to green transitions, learn how digital twins revolutionize energy management and ...

Read More

Online Travel Agencies: Some Solutions to changes in booking and commission attributions

Discover how we can simplify travel changes for both travelers and OTAs using blockchain and ...

Read More
Previous Previous
Next

Accelerate Your Path
to Market Leadership 

Encora logo

Santa Clara, CA

+1 669-236-2674

letstalk@encora.com

Innovation Acceleration

Speak With an Expert

Encora logo

Santa Clara, CA

+1 (480) 991 3635

letstalk@encora.com

Innovation Acceleration