iRaven

Paper · Agents and tools · Version v1

Standing on the Shoulders of Giants: Bug-Aware Automated GUI Testing via Retrieval Augmentation

First published: arXiv, . Original

Copyright the authors. Licensed under Creative Commons Attribution 4.0 International.

This page holds the text of the paper, converted to HTML; figures may be left out.

In software development, similar apps often encounter similar bugs due to shared functionalities and implementation methods. However, current automated GUI testing methods mainly focus on generating test scripts to cover more pages by analyzing the internal structure of the app, without targeted exploration of paths that may trigger bugs, resulting in low efficiency in bug discovery. Considering that a large number of bug reports on open source platforms can provide external knowledge for testing, this paper proposes BugHunter, a novel bug-aware automated GUI testing approach that generates exploration paths guided by bug reports from similar apps, utilizing a combination of Large Language Models (LLMs) and Retrieval-Augmented Generation (RAG). Instead of focusing solely on coverage, BugHunter dynamically adapts the testing process to target bug paths, thereby increasing bug detection efficiency. BugHunter first builds a high-quality bug knowledge base from historical bug reports. Then it retrieves relevant reports from this large bug knowledge base using a two-stage retrieval process, and generates test paths based on similar apps' bug reports. BugHunter also introduces a local and global path-planning mechanism to handle differences in functionality and UI design across apps, and the ambiguous behavior or missing steps in the online bug reports. We evaluate BugHunter on 121 bugs across 71 apps and compare its performance against 16 state-of-the-art baselines. BugHunter achieves 60% improvement in bug detection over the best baseline, with comparable or higher coverage against the baselines. Furthermore, BugHunter successfully detects 49 new crash bugs in real-world apps from Google Play, with 33 bugs fixed, 9 confirmed, and 7 pending feedback.

DOI: 10.1145/3715755Journal: PACMSEVolume: 2FSEFSE0387CCS: Software and its engineering Software testing and debugging

Abstract.

In software development, similar apps often encounter similar bugs due to shared functionalities and implementation methods. However, current automated GUI testing methods mainly focus on generating test scripts to cover more pages by analyzing the internal structure of the app, without targeted exploration of paths that may trigger bugs, resulting in low efficiency in bug discovery. Considering that a large number of bug reports on open source platforms can provide external knowledge for testing, this paper proposes BugHunter, a novel bug-aware automated GUI testing approach that generates exploration paths guided by bug reports from similar apps, utilizing a combination of Large Language Models (LLMs) and Retrieval-Augmented Generation (RAG). Instead of focusing solely on coverage, BugHunter dynamically adapts the testing process to target bug paths, thereby increasing bug detection efficiency. BugHunter first builds a high-quality bug knowledge base from historical bug reports. Then it retrieves relevant reports from this large bug knowledge base using a two-stage retrieval process, and generates test paths based on similar apps’ bug reports. BugHunter also introduces a local and global path-planning mechanism to handle differences in functionality and UI design across apps, and the ambiguous behavior or missing steps in the online bug reports. We evaluate BugHunter on 121 bugs across 71 apps and compare its performance against 16 state-of-the-art baselines. BugHunter achieves 60% improvement in bug detection over the best baseline, with comparable or higher coverage against the baselines. Furthermore, BugHunter successfully detects 49 new crash bugs in real-world apps from Google Play, with 33 bugs fixed, 9 confirmed, and 7 pending feedback.

Keywords:

Mobile App, Large language model, GUI testing

1. Introduction

Throughout human history, similar events have occurred repeatedly, yet people often fail to recognize and learn from the mistakes of the past. History tends to repeat itself as the lessons it offers are frequently overlooked. Similarly, in software development, similar software with common features and functionalities often share similar bugs due to design ideas and programming habits. For instance, TikTok has faced multiple instances where users experienced a bug that reset their follower counts to zero (, 2024). That bug was also seen in other social-media Apps such as Instagram, Facebook (Meta), and Twitter (X), where follower counts dropped unexpectedly or engagement metrics were misreported (, 2024; , 2024; , 2024). By failing to learn from the “bug history” of other software, developers risk repeating these bugs. By quoting Huxley (Huxley, 2023), we are reminded that in software development, testing should learn from bug history. Just as human progress is built on an understanding of past mistakes, software testing should also improve its efficiency in discovering bugs by learning from (history) bugs encountered and fixed in other software.

The foundation of “learning from history” lies in the fact that different applications often share the same or similar features, such as the follower count mentioned earlier. These similar features are frequently implemented in similar ways, making them prone to encountering similar issues (Lin et al., 2019; Behrang and Orso, 2019; Liu et al., 2023c). In existing research, some have adopted a similar paradigm of learning from historical bugs. They build a knowledge graph and generate new test cases by analyzing the historical test reports of the same app (Su et al., 2024; Su et al., 2022; Wang et al., 2024a). However, constructing a knowledge graph requires a significant amount of manual effort, and the resulting knowledge graph is only applicable to one specific app, limiting the method’s robustness. We aim to design a more generalized approach that can learn from a wider range of historical bugs, aka “standing on the shoulders of giants”, thereby improving the efficiency of bug discovery in testing.

Recent advancements in Retrieval-Augmented Generation (RAG) in pre-trained Large Language Models (LLMs) have made the realization of this idea possible. With the support of RAG, relevant bug reports can be retrieved, allowing LLMs to plan testing paths based on more targeted bug knowledge and their own reasoning and understanding capabilities.

This paper delves into the feasibility of this idea within the context of mobile app Graphical User Interface (GUI) testing. Currently, automated GUI testing techniques (Mirzaei et al., 2016; Yang et al., 2018; Yang et al., 2013; Machiry et al., 2013; Zeng et al., 2016; Mao et al., 2016) have been widely applied to both open-source and commercial apps, uncovering numerous previously undetected bugs and playing a crucial role in improving and ensuring mobile app quality. However, whether it’s random-based (Developers, 2012; Li et al., 2017; Dong et al., 2020), model-based (Su et al., 2021; Kong et al., 2018; Rubinov and Baresi, 2018), or learning-based methods (Li et al., 2019; Yasin et al., 2021; Pan et al., 2020; Romdhana et al., 2022; Yang et al., 2023; Liu et al., 2024a), the primary focus has been on maximizing page coverage, with exploration paths generated based on the app’s own characteristics. These non-bug-guided automated GUI testing methods are not specifically designed to target potential bug-prone paths, which leaves significant room for improvement in bug discovery efficiency.

Considering that bug reports on open-source platforms provide a wealth of external knowledge, this paper proposes a novel bug-aware automated GUI testing approach that generates the exploration path (with multimodal LLMs, short for MLLMs) guided by popular apps’ historical bug reports (with RAG). Unlike existing GUI testing techniques that primarily aim to increase coverage, BugHunter aims at standing on the shoulders of external bug knowledge, and facilitates the GUI testing focusing more on the potential bugs to increase the bug detection capability which has been considered as one of the most crucial objectives for software testing. Furthermore, BugHunter has another benefit of achieving relatively high coverage considering the large number of utilized bug reports that have covered various aspects of the app under testing, and this guidance from previous wisdom can be more targeted than solely optimizing the coverage.

Despite the intuitive design of BugHunter, several challenges remain in enhancing its effectiveness in generating bug-triggering paths. Challenge 1: Building a high-quality knowledge base from historical bug reports. We extract information from open-source apps and bug reports, mapping these reports to the app’s activity transformation graph (ATG) to form a structured knowledge base. Challenge 2: Retrieving relevant bug reports from a large candidate pool. We design a two-stage retrieval method, which first identifies similar candidates using embedding-based retrieval, and then refines the results using cross-encoder-based re-ranking techniques. Additionally, we construct a testing cognitive map that links the ATG with relevant bug reports for each activity, guiding the overall path exploration. Challenge 3: Generating the exploration path with other app’s bug reports. We propose a GUI screenshot annotation method that visually demonstrates the app components’ properties, facilitating the MLLMs’ better understanding of the GUI semantics. We also design a local path-planning mechanism to address ambiguous behaviors and missing steps, alongside a global path-planning mechanism to ensure efficient testing of multiple reports while avoiding redundant steps.

We evaluate the effectiveness of BugHunter on 121 bugs of 71 apps. Compared with 16 common-used and state-of-the-art baselines, BugHunter can achieve more than 60% in bug detection rate compared with the best baseline, resulting in 64% recall. The activity and code coverage of BugHunter is also higher than the baselines. To further understand the role of each sub-module of the approach, we conduct ablation experiments to further demonstrate its effectiveness. We also evaluate the usefulness of BugHunter by detecting unseen crash bugs in real-world apps from Google Play. Among 273 apps, BugHunter detects 49 new crash bugs with 33 of them being fixed, 9 of them being confirmed by developers and 7 of them being pending (none of them rejected).

The contributions of this paper are as follows:

  • A novel bug-aware automated GUI testing approach BugHunter We release the source code, dataset, and experimental results on our website https://github.com/IcyFeather233/BugHunter. that combines Large Language Model (LLM) with Retrieval-Augmented Generation (RAG) techniques to test apps through the external bug knowledge from historical bug reports of similar apps. Unlike traditional methods that focus on coverage and internal structure of apps, BugHunter utilizes external bug data to dynamically guide the exploration towards bug-prone paths, facilitating the effective and efficient detection of potential bugs. (Section 2)
  • We construct a comprehensive bug knowledge base with 131,581 bug reports of 1,259 mobile apps from 2018 to 2024, which organizes and consolidates bug reports into the app’s Activity Transition Graph (ATG). It standardizes and structures bug data, and provides support for subsequent research. (Section 2.1)
  • Effectiveness and usefulness evaluation of the BugHunter in real-world apps with practical bugs detected and confirmed (Section 4).

Figure

Figure 1. Overview of BugHunter

2. Approach

This paper proposes a bug-aware automated GUI testing technique BugHunter, which leverages similar bug reports of other apps to guide the path exploration. As demonstrated in Fig. 1, it has three modules: knowledge base construction, similar bug retrieval, and bug augmented path generation.

The first module extracts the information about open-source apps and their corresponding bug reports, and converts unstructured data into structured data by mapping the bug reports to the activity transformation graph (ATG) of the app. The second module generates the app description, retrieves similar apps, and constructs the testing cognitive map by connecting the bug reports with each activity in the ATG of the app under test. The retrieval employs a two-stage process, which identifies similar apps using embedding-based retrieval and refines the results using cross-encoder-based re-ranking techniques. The first module executes only once, and the second module executes once for each app.

The third module continuously explores GUI pages, generating actions based on MLLM for each GUI page. In detail, it designs an annotation method that labels the properties of app components directly on GUI screenshots, which allows MLLM to interpret the GUI elements accurately. Through local and global path planning, BugHunter dynamically adapts the bug-triggering steps to the specific GUI layout of the target app, ensuring that the generated test paths are aligned with the app’s unique structure, and optimizing the overall exploration path to avoid missing or repetition.

2.1. Bug Knowledge Base Construction

To effectively generate testing paths aligned with actual bug-triggering sequences, we construct a structured knowledge base, that maps the bug report to ATG. Specifically, we extract detailed static information from the app, including its name, activities, and app-specific details, to understand the structural and functional features of the app under test (in Section 2.1.1). Simultaneously, we extract bug information, including bug descriptions, reproduction steps, screenshots, and logs, and map this information to the Activity Transition Graph (ATG) of the tested app (in Section 2.1.2).

2.1.1. Information Extraction

The first step in constructing a bug knowledge base involves extracting various information from open-source apps and their related document. These extracted data are essential for creating a detailed representation of the app’s structure and operational context, which are critical for subsequent testing path generation.

App Textual Information Extraction. To obtain a high-level understanding of the app’s functionality, we extract the app’s textual information from its README file. Given the diverse ways that the app’s textual information can be presented, we design a rule-based approach to identify and extract relevant information. Specifically, we scan the README file for keywords “Description”, “Overview”, “About” and “Summary”. It then extracts the subsequent text until a different heading is detected.

Activity Name Extraction. The AndroidManifest.xml file provides critical information about the app’s components, including the activity names. We perform XML parsing to extract all declared activities by identifying <activity> tags. This process ensures that we have a comprehensive list of all activities defined within the app, which is vital for understanding its structure and potential interaction paths.

Activity Transition Graph (ATG) Extraction. To model the navigation paths between different activities within the app, we construct an Activity Transition Graph (ATG) (Yang et al., 2018; Yan et al., 2020; Liu et al., 2022b; Liu and Xiao, 2022). We achieve this through static analysis, which examines the app’s code to identify explicit intents and their target activities. By analyzing the call graphs and intent filters, we can map out the possible transitions between activities, creating a directed graph that represents the flow of control within the app. Specifically, we retrieve the activity label (e.g., activity android:name=.AccountActivity) to get the activity name (AccountActivity) of the app. For transitions between activities, BugHunter first transforms each XxxActivity.java file to an abstract syntax tree (AST). As the transition between activities is achieved through the intent() method, e.g., intent(CurrentActivity, TargetActivity) means CurrentActivity transit to TargetActivity, BugHunter then traverses AST and analyzes the intent() method calling relation to get the transition. First, if the setOnClickListener() of a component (such as a button) directly calls the intent() method, BugHunter will directly obtain the transition that calls the intent method. Second, if the component calls the intent() method when calling other methods, BugHunter locates the component that calls intent() by traversing the method name. After completing the above analysis, we obtain the app ATG.

Algorithm 1 Activity Transition Graph (ATG) Extraction

Input: Android application source code

Output: Activity Transition Graph (ATG_{action})


                1
              Transform source code to Abstract Syntax Tree (AST);


                2
              Initialize empty graph ATG;


                3
              foreach intent() method in AST do

    
                4
              if setOnClickListener() directly calls intent() then

        
                5
              component_id \leftarrow Locate component calling intent();

        
                6
              TargetActivity \leftarrow Match intent parameter in AndroidManifest.xml;

        
                7
              Add edge to ATG (component_id, TargetActivity);

    
                8
              else

        
                9
              Traverse AST to locate method calling intent();

        
                10
              component_id \leftarrow Extract component ID from caller method;

        
                11
              TargetActivity \leftarrow Match intent parameter in AndroidManifest.xml;

        
                12
              Add edge to ATG (component_id, TargetActivity);

    
                13
              end if


                14
              end foreach


                15
              Return ATG;

Bug Steps and Description Extraction To capture bug reproduction steps and related descriptions, we extract this information from GitHub bug reports. Similar to the app description extraction, we utilize a rule-based method, which scans bug reports for specific sections labeled as “Steps to Reproduce”, and “Reproduction Steps”, followed by extracting the subsequent ordered or unordered list that details the steps. Additionally, the bug description is extracted from the main body of the bug report, typically the first paragraph or any section titled “Description”.

2.1.2. Knowledge Base Construction

As shown in Fig. 2, the Bug Knowledge Base is a structured repository that stores and organizes extracted app and bug-related information, facilitating efficient retrieval in Section 2.2.

App Description Generation. The first step in constructing the Bug Knowledge Base is generating a consistent and comprehensive description of each app. While we extract textual information such as app name, activity names, and the Activity Transition Graph (ATG) from the app, this information is often incomplete or inconsistently formatted. Different apps may describe similar functionalities in different ways, leading to discrepancies in their descriptions. To overcome this challenge, we standardize the extracted information by generating a unified app description.

Using the extracted app information, we leverage a Large Language Model (LLM) to complete and structure the app description in a uniform format. This step ensures that all apps are represented in a consistent manner, allowing for more effective retrieval. The method for generating the app description is detailed in Section 2.2.1, where we explain how the LLM is guided to synthesize a coherent and informative description based on textual and structural data.

Bug Report Structuration. Once we have retrieved bug reports from similar apps, the next step is to structure these reports and map them to the corresponding activities in the ATG of the app under test. We map each bug report to a specific activity in the app’s ATG by comparing the activity names with the first step of the bug reproduction sequence. Each activity name serves as a unique identifier for its corresponding GUI. From the bug reports, we extract the first step of the reproduction process, which typically describes the initial interaction with the app. To match the activity names with the bug steps, we compute the semantic similarity between the activity names and the first bug steps in the bug report. We use BERT (Devlin et al., 2018) to generate embeddings for both the activity names and the bug steps. The cosine similarity between the embeddings is then calculated to quantify their similarity. Based on empirical analysis, we set the similarity threshold at 0.75, meaning that if the cosine similarity score between the activity name and the bug step exceeds this value, the bug report is mapped to that activity. (in Section 2.2.3)

Figure

Figure 2. Example of bug knowledge base construction

2.2. Similar Bug Retrieval

Inspired by the observation that apps with similar functionalities often encounter similar bugs, we propose a similar app retrieval method based on app description, which leverages both textual information (activity names, app name) and structural information (ATG) of the app. These elements are combined to generate a detailed app description using a Large Language Model (LLM), which ensures that both the functional aspects and the underlying app structure are accurately captured (details are in Section 2.2.1). The generated description, enriched with both types of information, is then used to perform similarity-based retrieval against a Bug Knowledge Base, identifying apps which are likely to share similar bug occurrences (details are in Section 2.2.2).

To efficiently and accurately retrieve similar apps from the large Bug Knowledge Base, We design a two-stage retrieval method. It first uses embedding-based retrieval to identify similar apps, and then uses a cross-encoder-based re-ranking to refine the results, by which we can obtain all the relevant bug reports from these similar apps. We then construct a testing cognitive map that links each activity of the app’s ATG with relevant bug reports. It can serve as a guide for global path planning exploration (in Section 2.3.3), helping to more efficiently guide testing.

2.2.1. App Description Generation

In this section, we outline the process of generating an app description using LLM, which serves as the foundation for the subsequent retrieval process. The description generation is based on static information extracted from the app.

App Static Information Extraction. We use the information extraction method in Section 2.1.1 to extract the static information of the app, including app textual information, app name, activity names, and the Activity Transition Graph (ATG). This information forms the basis for constructing a prompt to guide the LLM in generating a concise and informative app description.

Figure

Figure 3. Example of the app description generation prompt

LLM-based Prompt Construction Using the extracted static information, we construct a prompt to guide the LLM in generating a comprehensive app description. As shown in Fig. 3, the prompt typically includes the following components: (1) App Name is used to identify the app in the prompt. (2) Activity Name usually includes the functionality of the application, providing LLM with a clear understanding of the application’s functionality. (3) ATG represents the transition between different activities within an app, used to provide structural context. Guide LLM to consider the relationships between different activities and generate app descriptions that include the structure of the app. (3) App textual information is the app functionalities descriptions from the README file. This information provides context for the LLM to generate more detailed descriptions of the app’s purpose and features. It allows the model to output a description that is not only functionally accurate but also captures the app’s overall goal and use cases. (4) Query for App Description. The prompt explicitly asks the LLM to generate an App description, ensuring that the output is structured and informative.

2.2.2. Query Construction and Two-stage Retrieval

In this section, we detail the process of Query Construction and the execution of the Retrieval-Augmented Generation (RAG). Our objective is to retrieve and rank similar apps based on the descriptions generated in the previous step.

Query Construction involves creating a search query that encapsulates the core functionalities and attributes of the app under testing. This query is constructed from the “App description” generated earlier. The query is designed to maximize the relevance of retrieved results by focusing on the most distinctive features of the app.

In the context of our work, we implement a two-stage RAG process to identify the most functionally similar apps and their associated issues for testing.

Stage 1: Embedding-Based Retrieval (lines 1-11). The initial stage leverages an embedding model E to transform app descriptions into vectors within a dense vector space, enhancing the ability to quickly identify semantically similar descriptions. This is done by encoding both the query q, derived from the static information of the new app, and the candidate descriptions from the Bug Knowledge Base into vectors, and then computing the cosine similarity between these vectors (lines 7-8). The primary advantage of this method is its efficiency, allowing for rapid filtering of numerous potential matches based on average embedding similarity.

Stage 2: Cross-Encoder-Based Re-ranking (lines 11-19). To overcome the limitations of the first stage, the second stage employs a cross-encoder model X, which provides a more granular assessment by directly modeling the interactions between the query q and each candidate description. This process, executed per candidate, assesses contextual relevance, offering a more precise measure of similarity and ensuring that the most relevant apps are prioritized for further testing (lines 15-16). While this method is more computationally intensive than the first stage, it yields a significantly more accurate similarity assessment.

Algorithm 2 Two-Stage Retrieval

Input: Static info of new app (Q), Bug Knowledge Base (B)

Output: Ranked list of similar apps (R)


                1
              Stage 1: Embedding-Based Retrieval;


                2
              E\leftarrow Initialize embedding model;


                3
              q\leftarrow E(\text{encode}(Q));  // Encoding the query


                4
              S\leftarrow\emptyset;  // Initialize similarity scores set


                5
              foreach b\in B do

    
                6
              d\leftarrow E(\text{encode}(b));  // Encoding candidate descriptions

    
                7
              sim\leftarrow\text{cosine}(q,d);  // Compute cosine similarity

    
                8
              S\leftarrow S\cup\{(b,sim)\};  // Store descriptions with their similarity scores


                9
              end foreach


                10
              C\leftarrow Select top N from S based on sim;  // Select candidates based on similarity


                11
              Stage 2: Cross-Encoder-Based Re-ranking;


                12
              X\leftarrow Initialize cross-encoder model;


                13
              R\leftarrow\emptyset;


                14
              foreach c\in C do

    
                15
              score\leftarrow X(Q,c);  // Scoring with cross-encoder

    
                16
              R\leftarrow R\cup\{(c,score)\};  // Store candidates with scores


                17
              end foreach


                18
              Sort R by score in descending order;


                19
              Return R;

2.2.3. Cognitive Map Construction

In this section, we outline the process of constructing a testing cognitive map using LLM. This process involves mapping bug reports from the Activity Transition Graph (ATG) of a similar app to the ATG of the app under test. Although the apps may be functionally similar, their ATGs and activity names often differ, making direct mapping non-trivial. The LLM is employed to bridge this gap by analyzing both ATGs and determining the best mapping between bug reports and the activities of the app under test as shown in Fig. 4.

Prompt Construction. Once we retrieve the most similar app and its ATG, we need to map the bug reports associated with each activity in the similar app’s ATG to the corresponding activities in the app under test. The challenge lies in the fact that the structure and naming conventions of activities in the two apps may differ. To address this, we use LLM to semantically match activities between the two ATGs and map the relevant bug reports accordingly as shown in Fig. 5.

Figure

Figure 4. Example of cognitive map construction from BugHunter

Using the static information from both the similar app’s ATG and the app under test, we construct a prompt that guides the LLM in generating a cognitive map between the two ATGs. The LLM is tasked with comparing the activities and identifying the most likely mapping based on activity functionality and bug report details.

Figure

Figure 5. Example of the testing cognitive map construction prompt

2.3. Bug Augmented Path Generation

We focus on generating test paths by utilizing bug reports from similar apps and mapping them to the tested app, proposing a visual-driven method based on retrieval result augmentation. To ensure that these bug reproduction paths accurately adapt to the target application, we first propose a custom annotation method that enables the LLM to understand the properties of UI components based on GUI screenshots. Based on the search results in Section 2.2, the BugHunter local path planning mechanism is used to dynamically adjust interactions based on specific widgets and elements on each page, thereby generating corresponding test paths. In addition, the BugHunter also includes a global path planning mechanism to monitor the testing status of bugs in real-time. After completing the testing of a bug report, the BugHunter will guide automated testing based on the current tested page and ATG to continue testing the next nearest activity-related bugs.

2.3.1. GUI Page Annotation

The first step in testing involves annotating the app’s user interface components using a Large Language Model (LLM). This method allows us to automatically identify and highlight the actionable elements on each page, which is essential for guiding the testing process.

To begin, we extract the view hierarchy file of the current page, which provides a structured representation of all UI components and their properties. This file includes essential details such as component IDs, types, positions, and possible interactions (e.g., clickable, long-pressable, input fields). Based on this information, we identify the components that can be interacted with and mark them visually with red bounding boxes. Each actionable component is also annotated with a unique identifier (e.g., 1, 2, 3) directly on the UI, enabling the MLLM to easily reference and select specific elements during the testing process.

The MLLM is then employed to interpret these annotations and generate prompts that describe potential interactions with the annotated components. For example, if a button is marked with a red box and labeled ‘1’, the MLLM might generate a prompt suggesting that this button should be clicked as the next step in the testing sequence. This method ensures that the MLLM’s outputs are directly aligned with the app’s current state, allowing for precise and context-aware guidance during the testing process.

This annotation step is critical as it bridges the gap between the app’s visual interface and the automated testing procedure, ensuring that the MLLM has a clear and structured understanding of the possible interactions on each page. By doing so, we enable more accurate and targeted testing, focusing on components most likely to affect the app’s behavior.

2.3.2. Local Path Planning

After we retrieve the current active bug report from similar apps in Section 2.2, we further enter the augmentation generation (AG) phase of RAG. The goal here is to dynamically adapt the bug steps from the retrieved reports to the app being tested. However, two main challenges arise. First, since these retrieved bug reports come from open-source communities, they may be of low quality, containing ambiguous behavior or missing steps, making it difficult to execute even within the same app. Second, there are often significant differences between the app under test and the retrieved similar apps in terms of functionality, page design, layout, and component naming, complicating direct matching. To address this, we design a local planning mechanism that provides detailed information about the structure of the app under test, the relevant bug reports, and the testing context to the MLLM (details are in Fig. 6), enabling it to infer and determine the appropriate actions to take on the current page. Specifically, we provide MLLM with the testing context of the app, allowing it to infer functionally equivalent operations and dynamically adjust the testing path, rather than strictly following the steps in the bug report. This method enables the approach to handle situations where steps are unclear or inconsistent with the application layout.

Figure

Figure 6. Example of the testing path planning prompt

2.3.3. Global Path Planning

For a retrieved set of similar bug reports, a straightforward manner would be to plan and execute the paths for each report individually, returning to the main page after each execution to start the next one. However, this is highly inefficient due to the redundant exploration of the same paths. To address this, we designed a testing cognitive map (in Section 2.2.3) that represents the app’s logical structure and its associated bug reports, reflecting the execution order of these reports to some extent. Based on this cognitive map, we develop a global path-planning mechanism to facilitate comprehensive and efficient testing across all pages and issue reports, minimizing redundant steps. Specifically, after completing the execution of a bug report, the BugHunter checks if the current activity has any remaining untested bug reports. If there are additional reports, the BugHunter continues testing within the same activity. If no reports remain, the BugHunter transitions to the next or previous activity based on the app’s flow, checking for untested or unresolved bugs in those areas. This facilitates that testing follows a logical and efficient progression through the app’s activities, minimizing backtracking and redundant steps.

To enhance the effectiveness of the global planning mechanism, we also design a memory that tracks which pages have been tested, what UI elements were interacted with, and the outcomes of those interactions. This ensures that previously tested components are not revisited unnecessarily, allowing the approach to focus on untested paths or unresolved bugs. Additionally, the memory records which bugs have been successfully reproduced and which still require further exploration, providing critical information to feed into the global path planning process for more efficient and targeted testing.

2.4. Implementation

In our implementation, we utilize the GPT-4 Vision model1 (gpt-4-vision-preview) as MLLM to handle both textual and visual information during the testing process. It obtains the view hierarchy file of the current GUI page through UIAutomator (UIAutomator, 2021) to extract text information of the input widgets. In the two-stage retrieval process in Section 2.2.2, we use the EmbeddingModel and RerankerModel of BCEmbedding (NetEase Youdao, 2023) for similarity search and matching. BugHunter is implemented as a fully automated GUI testing tool, which uses or extends the following tools: VirtualBox and the Python pyvbox (, 2023) for running and Android Debug Bridge (ADB) (, 2020) for interacting with the app.

3. Experiment Design

  • RQ1: (Bugs detection performance and coverage) How effective is BugHunter in detecting bugs and achieving testing coverage?

For RQ1, we first present the effectiveness of BugHunter for bug detection, and we also compare BugHunter with commonly used and state-of-the-art baseline approaches.

  • RQ2: (Ablation Study) What is the contribution of the (sub-) modules of BugHunter for coverage and bug detection performance?

For RQ2, We conduct ablation experiments to evaluate the impact of each (sub-) module on the performance.

  • RQ3: (Usefulness Evaluation) How does our proposed BugHunter work in real-world situations?

For RQ3, we use BugHunter to automatically explore the app from Google Play, and detect unseen bugs, and issue the detected bugs to the development team.

3.1. Dataset

For RQ1 and RQ2, the experimental dataset comes from two sources. The first is from the apps in the Themis benchmark (Su et al., 2021), which contains 20 open-source apps with 34 bugs in GitHub. Meanwhile, we notice that these apps are updated around 2020, and some of them are now incompatible with the latest systems. Considering the small number of apps in the benchmark, we collect a second dataset following similar procedures as the benchmark.

In detail, we crawl the 20 most popular apps of each category from F-Droid, and we keep the ones with at least one update after May. 2024, resulting in 273 apps in 15 F-Droid categories. Then we manually review each issue report and app, and filter them according to the following criteria: (1) the app wouldn’t constantly crash on the emulator; (2) it can run all baselines; (3) UIAutomator (UIAutomator, 2021) can obtain the view hierarchy file and its GUI screenshot; (4) the issue report involve crash bug and it can be manually reproduced for validation; (5) the app is not used in the bug knowledge base. Please note that we follow the name of the app to ensure that there is no overlap between the datasets. Finally, 51 apps with 87 crash bugs remain for further experiments.

In total, there are 71 apps with 121 bugs (34 + 87) remaining for this effectiveness evaluation. Note that, like the benchmark, all bugs are crash bugs. Specifically, for each app, we select the version in which the bugs are confirmed by developers (merged GitHub pull requests) as our experimental data, following the practice of the benchmark. The details of all 71 experimental apps (20 + 51) and related bugs are shown on our website.

For RQ3, we further evaluate the usefulness of BugHunter in detecting unseen bugs. We randomly selected 237 popular apps from Google Play based on app type and download number. We use the same configurations as the previous experiments. Once a bug is spotted, we create an issue report by describing the bug, and report them to the app development team through the issue reporting system or email.

3.2. Baselines

To demonstrate the advantage of BugHunter, we compare it with 16 commonly used and state-of-the-art automated GUI testing techniques. We roughly divide them into random-/rule-based, model-based, and learning-based methods, to facilitate understanding. For random-/rule-based methods, we use Monkey (Developers, 2012) and Droidbot (Li et al., 2017), Time-Machine (Dong et al., 2020). For model-based methods, we use WCTester(Zheng et al., 2017; Zeng et al., 2016), Stoat (Su et al., 2017), Ape (Gu et al., 2019), Fastbot (Cai et al., 2020), ComboDroid (Wang et al., 2020). For learning-based methods, we use Humanoid (Li et al., 2019) and Q-testing (Pan et al., 2020). Humanoid (Li et al., 2019) trains an action generation model based on user interaction data. Q-testing (Pan et al., 2020) utilizes reinforcement learning techniques to generate test paths. For LLM-based methods, we use GPTDroid (Liu et al., 2023b) and AppAgent (Yang et al., 2023).GPTDroid (Liu et al., 2024a) is asking LLM to chat with the mobile apps by passing the GUI page information to LLM to elicit testing scripts. AppAgent (Yang et al., 2023) is a novel LLM-based multimodal agent framework, that enables the agent to operate apps through a simplified action space, mimicking human-like interactions.

For the combinational approach of LLM and automated GUI testing, we employ. QTypist (Liu et al., 2023a) is used to generate test text for input components. For a more thorough comparison, we include 2 other baselines, in which the originally proposed techniques aim at enhancing the automated GUI testing, and can be utilized by integrating with the testing tools. Toller (Wang et al., 2021a) is a tool consisting of infrastructure enhancements to the Android operating system. Vet (Wang et al., 2021b) is used to identify exploration tarpits by recognizing their patterns in the UI traces, to optimize the exploration sequences. We use the experimental setup as their original paper to derive the following 4 baselines, i.e, QTypist is integrated with APE (APE+QT), Toller is integrated with Stoat (Stoat+TO), Vet is integrated with WCTester and Ape (WCTester+VE, Ape+VE).

3.3. Experimental Setup

We implement BugHunter based on the gpt-4-vision-preview API which is released on the OpenAI website. We deploy the baselines and BugHunter on a 64-bit Ubuntu 18.04 machine and evaluate them on Google Android 7.1 emulators. Following common practice (Gu et al., 2019; Li et al., 2017), we register separate accounts for each app that requires login and write the login scripts, and during testing reset the account data before each run to avoid possible interference. To ensure fair and reasonable use of resources, we set up the running time of each tool in one app to 60 minutes, which is widely used in other GUI testing studies (Su et al., 2021; Fan et al., 2018; Li et al., 2017; Gu et al., 2019). For RQ2, we manually optimized the automated testing tools based on the configuration suggestions provided by the method and applied them. We run each tool three times and obtain the average performance to mitigate potential bias.

3.4. Evaluation Metrics

We measure the performance from bug detection and testing coverage of our BugHunter and baselines. For bug detection, we use the number of bugs detected(#Bugs) by automated GUI testing tools and the recall rate (Recall) to assess the effectiveness of BugHunter in identifying true bugs. Recall measures the ability of BugHunter to identify all relevant bugs present within the app. To calculate recall, we compare the number of bugs detected by BugHunter with the total number of bugs confirmed by developers in the issue reports. A higher recall indicates that BugHunter is more successful in detecting a larger proportion of the bugs.

For testing coverage, we obtain the activity coverage and code coverage (He et al., 2020; Liu et al., 2017; Arnatovich et al., 2018; Wang et al., 2020; Wang et al., 2021b; Li et al., 2019), in which we treat the activities defined in the AndroidManifest.xml file of an Android app as the whole set of activities (Pan et al., 2020; , 2022; Su et al., 2017).

4. Results and Analysis

4.1. Performance of Bug Detection (RQ1)

We first present the bug detection performance of BugHunter and baselines in Table 1. The recall of BugHunter in 71 apps with 121 bugs achieves 64%. It achieves 60% (0.64 vs. 0.40) recall higher even compared with the best baseline (GPTDroid) across these apps. In terms of the number of detected bugs, BugHunter can still achieve a higher detection rate. We also compare the similarities and differences of the bugs between the best baselines (GPTDroid) and our approach, and the results show that all bugs detected by them are also detected by BugHunter. This indicates the effectiveness of BugHunter in detecting bugs and helps to ensure app quality.

Table 1. Performance of BugHunter and baselines

Automated GUI testingBug detectionAverage coverage
#BugsRecallActivity coverageCode coverage
Random-based method
Monkey290.240.350.33
Droidbot350.290.370.35
Time-Machine370.310.370.35
Model-based method
WCTester390.320.410.38
Stoat370.310.380.36
Fastbot410.340.410.38
Ape450.370.420.39
ComboDroid460.380.430.41
Combinational method
APE+QT490.400.460.44
Stoat+TO450.370.410.39
WCTester+VE420.350.450.43
Ape+VE440.360.480.46
Learning-based method
Humanoid410.340.420.39
Q-testing370.310.450.41
LLM-based method
GPTDroid510.400.510.47
AppAgent410.340.410.39
BugHunter770.640.530.52
  • Notes: “#Bugs” is the number of the detected bugs from automated GUI testing tools.

Figure

Figure 7. Bug detection of BugHunter and baselines

Fig. 7 also shows the overall number of detected bugs of BugHunter and baselines with varying times. We can also see that after 10 minutes, BugHunter detects more bugs than the baselines, and reaches the highest value in about 32 minutes, saving 43% (32 vs. 46) of the testing time compared with the best baseline (also with more detected bugs). Please note that the reason why BugHunter does not find any bugs 10 minutes ago is because it needs to retrieve similar bugs in the bug knowledge base in Section 2.2. After completing the bug retrieval, BugHunter can quickly find bugs This again proves the effectiveness and efficiency of BugHunter, which is valuable for saving more time for follow-up bug fixing.

Table 1 also shows the average activity coverage and code coverage of BugHunter and the baselines. We can see that BugHunter covers more activities and codes, which achieves 53% and average code coverage achieves 52% across the 71 apps. The testing coverage of BugHunter is comparable to the best baseline (GPTDroid) in activity coverage (0.53 vs. 0.51) and code coverage (0.52 vs. 0.47). Considering that the goal of the BugHunter is to detect more bugs, our BugHunter can still achieve and exceed the optimal baseline in terms of testing coverage. This also indicates the effectiveness of BugHunter in covering more activities and codes.

Figure

Figure 8. Example of the bug detected by BugHunter

The advantages of BugHunter are due to three aspects. First, BugHunter identifies bugs by leveraging common patterns in input validation errors, such as creation processes where no input or illegal input is provided. Second, as shown in Fig. 8, BugHunter excels at detecting bugs in app settings, particularly when toggling settings leads to unexpected behaviors like crashes or incorrect configurations. While the baselines often explore the UI without understanding the app’s business logic, BugHunter uses a combination of page semantics and exploration history to plan paths that are function-aware, significantly improving its ability to find issues in configuration changes.

Table 2. Contribution of different modules (RQ2)

Module#BugsRecallActivity coverageCode coverage
BugHunter770.640.530.52
w/o similar bug retrieval390.320.470.45
w/o augmented path generation370.310.450.44

4.2. Ablation Study (RQ2)

Table 2 shows the performance of BugHunter and its 2 variants. In detail, for BugHunter w/o similar bug retrieval (Section 2.2), we replace the App description based similar bug retrieval with a random selection bug report method. For BugHunter w/o augmented path generation (Section 2.3), we remove the cross-app bug report in cross-app bug report augmented path generation.

We can see that BugHunter’s bug detection recall, activity and code coverage are much higher than all other variants, indicating the necessity of the designed modules and the advantage of BugHunter. Compared with BugHunter, BugHunter w/o augmented path generation results in the largest performance decline, i.e., 51% drop (0.31 vs. 0.64) in the recall. This further indicates that the bug reports from other apps can help MLLM understand the bug path and make reasonable judgments. BugHunter w/o similar bug retrieval also undergoes a performance decrease, i.e., 50% drop (0.32 vs. 0.64) in the recall. This implies the bug retrieval method can help find similar bugs.

Table 3. Contribution of different sub-modules (RQ2)

Sub-module#BugsRecallActivity coverageCode coverage
BugHunter770.640.530.52
w/o app description430.360.490.48
w/o re-ranking390.320.470.46
w/o testing cognitive map410.340.470.45
w/o GUI page annotation430.360.440.43
w/o global path planning410.340.440.42

Table 3 further demonstrates the performance of BugHunter and its 5 variants. For BugHunter w/o app description, we directly use the extracted information for embedding and retrieval. For BugHunter w/o re-ranking, BugHunter w/o testing cognitive map and BugHunter w/o global path planning, we remove them. For BugHunter w/o GUI page annotation, we remove the component information. The experimental results demonstrate that removing any of the sub-modules would result in a noticeable performance decline, indicating the necessity and effectiveness of the designed sub-modules. Removing the re-rank (BugHunter w/o-re-rank) has the greatest impact on the performance, reducing the bug detection recall by 50% (0.32 vs. 0.64). Removing the global path planning and testing cognitive map also impacts the bug detection performance. This indicates that the two-stage retrieval method can effectively improve the performance of the retrieval. The testing cognitive map and global path planning also can help to plan and explore routes as a whole, improving the efficiency of automated testing.

4.3. Usefulness Evaluation (RQ3)

Based on the results of RQ1 in Section 4.1, we select the baselines with the best bug detection performance in each category (Time-Machine, ComboDroid, APE+QT, Humanoid, GPTDroid) to run these 237 apps. BugHunter and baseline methods set the same running time, with each app running for 60 minutes.

For the 237 apps, BugHunter detects 93 crash bugs in 88 apps, of which 49 bugs in 45 apps are never discovered before. Furthermore, as shown in Table 4 only 7 of these new bugs are detected by the best baseline GPTDroid, and the bugs detected by these baselines are all subsets of BugHunter. We submitted these 49 bugs to developers, and 42 of them have been fixed/confirmed so far (33 fixed and 9 confirmed, none of them rejected), and 7 of them are pending. This further indicates the effectiveness of BugHunter in bug detection. Due to space limit, Table 4 presents a part of fixed bugs, and the full lists can be found on our website1. We also collect feedback from developers regarding the bugs we submitted. “We initially overlooked this bug, but it’s clear that it can significantly degrade the user experience”.“This bug comes from an outdated library we’re using. Thanks for your report, we will prioritize repairing it .”

Table 4. Information of the fixed bugs. (RQ3)

IDApp nameCategoryDownloadVersionTimeMCombAPE+QTHumanoidGPTDroid
1Musixmatchmusic50M+7.10.1
2Time Plannerproductivity5M+3.22✓✓✓✓
3DailyLifelifestyle5M+4.3.0.2
4Carousellshopping10M+2.370.4
5Hungerstationfood10M+8.0.19
6Karrotsocial10M+24.33.0
7Khan Academyeducation10M+8.1.0
8Klooktravel10M+7.3.1✓✓✓✓
9Money Managerfinance10M+4.9.18
10Musicoletmusic10M+11.3
11Notionproductivity10M+0.6.2419
12Ringtonesentertain10M+3.7.1✓✓
13School Plannereducation10M+8.2.1✓✓✓✓
14ShortMaxentertain10M+1.9.1
15Step Trackerhealth10M+1.4.7
16To-Do Listproductivity10M+3.7.1✓
17Transitmap10M+5.15.1
18Zeppsport10M+8.12.3
19BetterMehealth1M+4.54.0
20Cathayfinance1M+5.14.1✓✓
21Coupangshopping1M+8.3.1✓✓
22Drink Waterhealth1M+1.102.19
23eSoundmusic1M+4.11.1
24Fortune Cityfinance1M+4.6.1
25Home Assistanthouse1M+4.3.0✓✓
26MTR Mobiletravel1M+20.39.1
27Rabitproductivity1M+4.1.362
28Zenmoneyfinance1M+7.9.0
29MyTranslinkmap500K+3.7.12345
30New Scientistnews500K+4.9
31Turbo Alarmtool500K+17.3✓
32CodeSnackeducation100K+5.5.1
33FilterBoxtool100K+3.3.3

5. Discussion

5.1. Generality Across Platforms

Although we only experiment with Android mobile apps, since other platforms have similar types of information, BugHunter can be used to generate the test path for other platforms. We conduct a small-scale experiment for another two popular platforms, and experiment on 10 iOS apps with 14 bugs and 10 HarmonyOS apps with 13 bugs, with details on our website. Results show that BugHunter’s bug detection recall is 80% for iOS apps and 78% for Web apps within 30 minutes of testing time. This further demonstrates the generality and usefulness of BugHunter, and we will conduct more thorough experiments in the future.

5.2. Advantages over Test Case Migration and Bug Replay Techniques

The third module of BugHunter (bug augmented path generation) is somewhat related to test case migration (e.g., AppTestMigrator (Behrang and Orso, 2019), Craftdroid (Lin et al., 2019), TEMdroid (Zhang et al., 2024)) and bug replay techniques (e.g., RecDroid+ (Zhao et al., 2022), ScopeDroid (Huang et al., 2023), AdbGPT (Feng and Chen, 2024)). Therefore, we conduct a comparison with these techniques to further demonstrate the superiority of our approach. The reason why we did not include this comparison in the results section is because they cannot fully address the task of automated GUI testing, and thus cannot be directly compared with our approach.

Specifically, for a given app under test, we use the bug reports retrieved in the second module of BugHunter (similar bug retrieval) as inputs to these techniques to evaluate their bug detection performance. Since many of these techniques only take reproduction steps as input (while bug reports often contain additional details like descriptions and summaries), we manually extract the reproduction steps to ensure these techniques receive optimal input conditions for achieving their best possible performance. As shown in Table 5, the experimental results show that the recall of BugHunter is 300% (0.64 vs. 0.16) higher than the best test case migration and bug replay techniques, which further indicates the advantages of our approach.

Table 5. Performance of different test case migration and bug replay methods

MetricRecDroid+ScopeDroidAdbGPTAppTestMigratorCraftdroidTEMdroidBugHunter
#Bugs119913191977
Recall0.090.070.070.110.160.160.64

5.3. Threats of Validity

The first threat concerns the representativeness of the experimental apps. In RQ1 and RQ2, we used a set of open-source apps to evaluate the performance of BugHunter, while in RQ3, we tested popular apps from Google Play. Although these apps represent a diverse range of real-world scenarios, there is still the possibility that certain types of apps or bugs, particularly those in less common or niche categories, might not be fully covered by our experiments.

The second threat relates to the potential overlap between the apps or bug reports in the LLM’s training data and those used in experiments. Since LLMs are trained on large-scale datasets, including open-source repositories, some of the apps’ bug reports may have been seen during training, potentially influencing the results. To mitigate this threat, we specifically selected apps that were updated after May 2024 for RQ3. This ensures that the apps and their associated bug reports are likely new and unseen by the LLM, providing a more robust evaluation of BugHunter.

6. Related Work

Automated GUI testing. Ensuring the quality of mobile apps has been a long-standing challenge in software engineering (Xie and Memon, 2007; Liu et al., 2022b; Liu et al., 2020; Liu et al., 2022a). Monkey (Developers, 2012) is the popular random-based automated GUI testing tool, which emits pseudo-random streams of UI events and some system events. To improve the test coverage, researchers propose model-based (Mirzaei et al., 2016; Yang et al., 2018; Yang et al., 2013; Zeng et al., 2016; Mao et al., 2016; Su et al., 2017; Dong et al., 2020; Gu et al., 2019; Wang et al., 2020; Liu et al., 2023c) automated GUI testing methods, design corresponding models through the research and analysis of large-scale apps. These methods incorporate structural information from the app, but still fail to understand the semantics of the app’s GUI elements. Researchers further proposed human-like testing strategies and designed learning-based (Li et al., 2019; Pan et al., 2020) automated GUI testing methods. Several methods are proposed using LLMs to generate GUI actions. QTypist (Liu et al., 2023a) focused on generating semantic inputs to enhance GUI testing. GPTDroid (Liu et al., 2024a) extracted GUI page information and functionality to generate human-like interactions. AppAgent (Yang et al., 2023), Mobile-Agent (Wang et al., 2024c) and AutoDroid (Wen et al., 2023) used LLMs to translate natural language descriptions into GUI actions. However, these methods are not specifically designed to target potential bug-prone paths. This paper aims to design a bug-aware approach that learns from external bug knowledge, which improves the efficiency of bug discovery.

LLM for Software Testing. For software testing, using LLMs to enhance software engineering has become a prominent research area (Alagarsamy et al., 2023; Schäfer et al., 2023a; Xie et al., 2023; Siddiq et al., 2023; Yuan et al., 2023; Tufano et al., 2022; Kang et al., 2023; Wang et al., 2024b; Liu et al., 2024a; Liu et al., 2024c; Liu et al., 2024b). In software testing, LLMFuzz (Deng et al., 2022) used LLMs to generate input programs for fuzzing Deep Learning libraries. Dakhel et al. (Dakhel et al., 2024) developed a method to enhance LLM-generated test cases with mutation testing. Chen et al. (Chen et al., 2024) proposed ChatUniTest, an LLM-based unit test generation framework. Yu et al. (Yu et al., 2023) utilize LLMs for generating mobile app test scripts, addressing limitations in current methods. Schafer et al. (Schäfer et al., 2023b) conducted a large-scale evaluation of LLMs for automated unit test generation. Lemieux et al. (Lemieux et al., 2023) leveraged LLM in escaping the coverage plateaus in test generation. Kang et al. (Kang et al., 2022) explored the LLM-based bug reproduction. Different from its sole focus on test case generation, BugHunter is a complete bug-aware GUI testing tool. It makes this work more generalized for wild app testing.

Test Migration and Bug Replay. Nowadays, GUI test migration has attracted significant attention. AppFlow (Hu et al., 2018) designed a machine-learning method to map app-specific events. AppTestMigrator (Behrang and Orso, 2019) determined the relationships of widgets by calculating the edit distance. CraftDroid (Lin et al., 2019) used the Word2Vec model to compute the similarity of widget textual information. TEMdroid (Zhang et al., 2024) incorporated contextual information of widgets and employed a two-stage training strategy to handle hard-negative samples. For bug replay, Yakusu (Fazzini et al., 2018) is a program analysis and natural language processing tool to generate executable test cases from bug reports. Zhao et al. (Zhao et al., 2022; Zhao et al., 2019) leveraged the lexical knowledge in the bug reports to automatically reproduce crashes. ScopeDroid (Huang et al., 2023) used a pre-trained LLM for crash reproduction from nature language. Feng et al. (Feng and Chen, 2024) propose a lightweight approach using prompt engineering to reproduce bugs from reports. However, these methods heavily rely on the quality of bug reports and are primarily targeted at a single app, which limits their deployment in the real world. In contrast, BugHunter doesn’t need complex manual construction and enhances automated testing to discover bugs by the external bug knowledge.

7. Conclusion

Learning from historical bug reports offers a valuable yet often overlooked opportunity to improve software testing. In this paper, we propose BugHunter, a novel approach to automated GUI testing that emphasizes cross-app bug-driven test path generation. Inspired by the idea of “learning from history”, BugHunter retrieves and adapts relevant bug reports from other apps, allowing it to predict and uncover potential bugs in the app under test. BugHunter first builds a high-quality bug knowledge base from historical bug reports. Then it retrieves relevant reports from the large bug knowledge base using a two-stage retrieval process, and generates test paths based on other apps’ bug reports. BugHunter also designs a local and global path-planning mechanism to handle differences in functionality, UI design, and bug report quality across apps.

In the future, we plan to extend BugHunter to other platforms such as web and desktop apps, and further refine the path-planning mechanisms to handle more complex app architectures.

8. Data Availability

We release the source code, dataset, and experimental results on our website https://github.com/IcyFeather233/BugHunter.

Acknowledgements.

This work was supported by the National Natural Science Foundation of China Grant No. 62232016, 62402483, 62072442, 62402484, Youth Innovation Promotion Association CAS, Basic Research Program of ISCAS Grant No. ISCAS-JCZD-202304, Major Program of ISCAS Grant No. ISCAS-ZD- 202302 and ISCAS-ZD-202401, Innovation Team 2024 ISCAS (No. 2024-66).

References

  • Alagarsamy et al. (2023) S. Alagarsamy, C. Tantithamthavorn, and A. Aleti A3Test: assertion-augmented automated test case generation. arXiv preprint arXiv:2302.10352.
  • [2] (2020) Android debug bridge (adb). Note: https://developer.android.com/studio/command-line/adb
  • [3] (2022) Android. Note: https://developer.android.google/topic/
  • Arnatovich et al. (2018) Y. L. Arnatovich, L. Wang, N. M. Ngo, and C. Soh Mobolic: an automated approach to exercising mobile application guis using symbiosis of online testing technique and customated input generation. Software: Practice and Experience 48 (5), pp. 1107–1142.
  • Behrang and Orso (2019) F. Behrang and A. Orso Test migration between mobile apps with similar functionality. In 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 54–65.
  • Cai et al. (2020) T. Cai, Z. Zhang, and P. Yang Fastbot: a multi-agent model-based test generation system beijing bytedance network technology co., ltd.. In Proceedings of the IEEE/ACM 1st International Conference on Automation of Software Test, pp. 93–96.
  • Chen et al. (2024) Y. Chen, Z. Hu, C. Zhi, J. Han, S. Deng, and J. Yin Chatunitest: a framework for llm-based test generation. In Companion Proceedings of the 32nd ACM International Conference on the Foundations of Software Engineering, pp. 572–576.
  • Dakhel et al. (2024) A. M. Dakhel, A. Nikanjam, V. Majdinasab, F. Khomh, and M. C. Desmarais Effective test generation using pre-trained large language models and mutation testing. Information and Software Technology 171, pp. 107468.
  • Deng et al. (2022) Y. Deng, C. S. Xia, H. Peng, C. Yang, and L. Zhang Fuzzing deep-learning libraries via large language models. arXiv preprint arXiv:2212.14834.
  • Developers (2012) A. Developers Ui/application exerciser monkey.
  • Devlin et al. (2018) J. Devlin, M. Chang, K. Lee, and K. Toutanova Bert: pre-training of deep bidirectional transformers for language understanding. NAACL-HLT 2019.
  • Dong et al. (2020) Z. Dong, M. Böhme, L. Cojocaru, and A. Roychoudhury Time-travel testing of android apps. In 2020 IEEE/ACM 42nd International Conference on Software Engineering (ICSE), pp. 481–492.
  • [13] (2024) Facebook 0 followers glitch.. Note: https://www.reddit.com/r/facebook/comments/1b8szmc/follower_count_not_seen_on_facebook_profile_any/
  • Fan et al. (2018) L. Fan, T. Su, S. Chen, G. Meng, Y. Liu, L. Xu, G. Pu, and Z. Su Large-scale analysis of framework-specific exceptions in android apps. In 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE), pp. 408–419.
  • Fazzini et al. (2018) M. Fazzini, M. Prammer, M. d’Amorim, and A. Orso Automatically translating bug reports into test cases for mobile apps. In Proceedings of the 27th ACM SIGSOFT International Symposium on Software Testing and Analysis, pp. 141–152.
  • Feng and Chen (2024) S. Feng and C. Chen Prompting is all you need: automated android bug replay with large language models. In Proceedings of the 46th IEEE/ACM International Conference on Software Engineering, pp. 1–13.
  • Gu et al. (2019) T. Gu, C. Sun, X. Ma, C. Cao, C. Xu, Y. Yao, Q. Zhang, J. Lu, and Z. Su Practical gui testing of android applications via model abstraction and refinement. In 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE), pp. 269–280.
  • He et al. (2020) Y. He, L. Zhang, Z. Yang, Y. Cao, K. Lian, S. Li, W. Yang, Z. Zhang, M. Yang, Y. Zhang, et al. TextExerciser: feedback-driven text input exercising for android applications. In 2020 IEEE Symposium on Security and Privacy (SP), pp. 1071–1087.
  • Hu et al. (2018) G. Hu, L. Zhu, and J. Yang AppFlow: using machine learning to synthesize robust, reusable ui tests. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pp. 269–282.
  • Huang et al. (2023) Y. Huang, J. Wang, Z. Liu, S. Wang, C. Chen, M. Li, and Q. Wang Context-aware bug reproduction for mobile apps. In 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), pp. 2336–2348.
  • Huxley (2023) A. Huxley Complete essays: aldous huxley, 1938-1956. Rowman & Littlefield.
  • [22] (2024) Instagram 0 followers glitch.. Note: https://www.reddit.com/r/Instagram/comments/12sjp31/why_does_my_acc_say_0_followers/
  • Kang et al. (2023) S. Kang, B. Chen, S. Yoo, and J. Lou Explainable automated debugging via large language model-driven scientific debugging. arXiv preprint arXiv:2304.02195.
  • Kang et al. (2022) S. Kang, J. Yoon, and S. Yoo Large language models are few-shot testers: exploring llm-based general bug reproduction. CoRR abs/2209.11515.
  • Kong et al. (2018) P. Kong, L. Li, J. Gao, K. Liu, T. F. Bissyandé, and J. Klein Automated testing of android apps: a systematic literature review. IEEE Transactions on Reliability 68 (1), pp. 45–66.
  • Lemieux et al. (2023) C. Lemieux, J. P. Inala, S. K. Lahiri, and S. Sen CODAMOSA: escaping coverage plateaus in test generation with pre-trained large language models.
  • Li et al. (2017) Y. Li, Z. Yang, Y. Guo, and X. Chen Droidbot: a lightweight ui-guided test input generator for android. In 2017 IEEE/ACM 39th International Conference on Software Engineering Companion (ICSE-C), pp. 23–26.
  • Li et al. (2019) Y. Li, Z. Yang, Y. Guo, and X. Chen Humanoid: a deep learning-based approach to automated black-box android app testing. In 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 1070–1073.
  • Lin et al. (2019) J. Lin, R. Jabbarvand, and S. Malek Test transfer across mobile apps through semantic mapping. In 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 42–53.
  • Liu and Xiao (2022) C. Liu and X. Xiao ProMal: precise window transition graphs for android via synergy of program analysis and machine learning. In International Conference on Software Engineering,
  • Liu et al. (2017) P. Liu, X. Zhang, M. Pistoia, Y. Zheng, M. Marques, and L. Zeng Automatic text input generation for mobile testing. In 2017 IEEE/ACM 39th International Conference on Software Engineering (ICSE), pp. 643–653.
  • Liu et al. (2023a) Z. Liu, C. Chen, J. Wang, X. Che, Y. Huang, J. Hu, and Q. Wang Fill in the blank: context-aware automated text input generation for mobile gui testing. In 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), pp. 1355–1367.
  • Liu et al. (2023b) Z. Liu, C. Chen, J. Wang, M. Chen, B. Wu, X. Che, D. Wang, and Q. Wang Chatting with gpt-3 for zero-shot human-like mobile automated gui testing. arXiv preprint arXiv:2305.09434.
  • Liu et al. (2024a) Z. Liu, C. Chen, J. Wang, M. Chen, B. Wu, X. Che, D. Wang, and Q. Wang Make llm a testing expert: bringing human-like interaction to mobile gui testing via functionality-aware decisions. In Proceedings of the IEEE/ACM 46th International Conference on Software Engineering, pp. 1–13.
  • Liu et al. (2024b) Z. Liu, C. Chen, J. Wang, M. Chen, B. Wu, Y. Huang, J. Hu, and Q. Wang Unblind text inputs: predicting hint-text of text input in mobile apps via llm. In Proceedings of the CHI Conference on Human Factors in Computing Systems, pp. 1–20.
  • Liu et al. (2020) Z. Liu, C. Chen, J. Wang, Y. Huang, J. Hu, and Q. Wang Owl eyes: spotting ui display issues via visual understanding. In ASE, Link
  • Liu et al. (2022a) Z. Liu, C. Chen, J. Wang, Y. Huang, J. Hu, and Q. Wang Nighthawk: fully automated localizing ui display issues via visual understanding. pp. 1–16. Document
  • Liu et al. (2023c) Z. Liu, C. Chen, J. Wang, Y. Su, Y. Huang, J. Hu, and Q. Wang Ex pede herculem: augmenting activity transition graph for apps via graph convolution network. In 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), pp. 1983–1995.
  • Liu et al. (2022b) Z. Liu, C. Chen, J. Wang, and Q. Wang Guided bug crush: assist manual gui testing of android apps via hint moves. In CHI 2022, Link
  • Liu et al. (2024c) Z. Liu, C. Li, C. Chen, J. Wang, B. Wu, Y. Wang, J. Hu, and Q. Wang Vision-driven automated mobile gui testing via multimodal large language model. arXiv preprint arXiv:2407.03037.
  • Machiry et al. (2013) A. Machiry, R. Tahiliani, and M. Naik Dynodroid: an input generation system for android apps. In Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering, pp. 224–234.
  • Mao et al. (2016) K. Mao, M. Harman, and Y. Jia Sapienz: multi-objective automated testing for android applications. In Proceedings of the 25th International Symposium on Software Testing and Analysis, pp. 94–105.
  • Mirzaei et al. (2016) N. Mirzaei, J. Garcia, H. Bagheri, A. Sadeghi, and S. Malek Reducing combinatorics in gui testing of android applications. In 2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE), pp. 559–570.
  • NetEase Youdao (2023) Inc. NetEase Youdao BCEmbedding: bilingual and crosslingual embedding for rag. Note: https://github.com/netease-youdao/BCEmbedding
  • Pan et al. (2020) M. Pan, A. Huang, G. Wang, T. Zhang, and X. Li Reinforcement learning based curiosity-driven testing of android applications. In Proceedings of the 29th ACM SIGSOFT International Symposium on Software Testing and Analysis, pp. 153–164.
  • [46] (2023) Pyvbox. Note: https://pypi.org/project/pyvbox/
  • Romdhana et al. (2022) A. Romdhana, A. Merlo, M. Ceccato, and P. Tonella Deep reinforcement learning for black-box testing of android apps. TOSEM.
  • Rubinov and Baresi (2018) K. Rubinov and L. Baresi What are we missing when testing our android apps?. Computer 51 (4), pp. 60–68.
  • Schäfer et al. (2023a) M. Schäfer, S. Nadi, A. Eghbali, and F. Tip Adaptive test generation using a large language model. arXiv preprint arXiv:2302.06527.
  • Schäfer et al. (2023b) M. Schäfer, S. Nadi, A. Eghbali, and F. Tip An empirical evaluation of using large language models for automated unit test generation. IEEE Transactions on Software Engineering.
  • Siddiq et al. (2023) M. L. Siddiq, J. Santos, R. H. Tanvir, N. Ulfat, F. A. Rifat, and V. C. Lopes Exploring the effectiveness of large language models in generating unit tests. arXiv preprint arXiv:2305.00418.
  • Su et al. (2017) T. Su, G. Meng, Y. Chen, K. Wu, W. Yang, Y. Yao, G. Pu, Y. Liu, and Z. Su Guided, stochastic model-based gui testing of android apps. In Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, pp. 245–256.
  • Su et al. (2021) T. Su, J. Wang, and Z. Su Benchmarking automated gui testing for android against real-world bugs. In Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pp. 119–130.
  • Su et al. (2022) Y. Su, Z. Han, Z. Xing, X. Xia, X. Xu, L. Zhu, and Q. Lu Constructing a system knowledge graph of user tasks and failures from bug reports to support soap opera testing. In Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering, pp. 1–13.
  • Su et al. (2024) Y. Su, D. Liao, Z. Xing, Q. Huang, M. Xie, Q. Lu, and X. Xu Enhancing exploratory testing by large language model and knowledge graph. In Proceedings of the IEEE/ACM 46th International Conference on Software Engineering, pp. 1–12.
  • [56] (2024) Tiktok 0 followers glitch.. Note: https://www.dexerto.com/entertainment/tiktok-0-followers-glitch-fix-for-account-bug-as-profiles-show-no-followers-1566312/
  • Tufano et al. (2022) M. Tufano, D. Drain, A. Svyatkovskiy, and N. Sundaresan Generating accurate assert statements for unit test cases using pretrained transformers. In Proceedings of the 3rd ACM/IEEE International Conference on Automation of Software Test, pp. 54–64.
  • [58] (2024) Twitters 0 followers glitch.. Note: https://medium.com/@max-fowler/how-to-fix-twitters-0-following-bug-a-step-by-step-guide-07e90ca65dd9
  • UIAutomator (2021) UIAutomator Python wrapper of android uiautomator test tool.. Note: https://github.com/xiaocong/uiautomator
  • Wang et al. (2020) J. Wang, Y. Jiang, C. Xu, C. Cao, X. Ma, and J. Lu Combodroid: generating high-quality test inputs for android apps via use case combinations. In ICSE, pp. 469–480.
  • Wang et al. (2024a) J. Wang, Y. Li, Z. Chen, L. Chen, X. Zhang, and Y. Zhou Knowledge graph driven inference testing for question answering software. In Proceedings of the IEEE/ACM 46th International Conference on Software Engineering, pp. 1–13.
  • Wang et al. (2024b) J. Wang, Y. Huang, C. Chen, Z. Liu, S. Wang, and Q. Wang Software testing with large language models: survey, landscape, and vision. IEEE Transactions on Software Engineering.
  • Wang et al. (2024c) J. Wang, H. Xu, J. Ye, M. Yan, W. Shen, J. Zhang, F. Huang, and J. Sang Mobile-agent: autonomous multi-modal mobile device agent with visual perception. arXiv preprint arXiv:2401.16158.
  • Wang et al. (2021a) W. Wang, W. Lam, and T. Xie An infrastructure approach to improving effectiveness of android ui testing tools. In Proceedings of the 30th ACM SIGSOFT International Symposium on Software Testing and Analysis, pp. 165–176.
  • Wang et al. (2021b) W. Wang, W. Yang, T. Xu, and T. Xie Vet: identifying and avoiding ui exploration tarpits. In FSE, pp. 83–94.
  • Wen et al. (2023) H. Wen, Y. Li, G. Liu, S. Zhao, T. Yu, T. Jia-Jun Li, S. Jiang, Y. Liu, Y. Zhang, and Y. Liu Empowering llm to use smartphone for intelligent task automation. arXiv e-prints, pp. arXiv–2308.
  • Xie and Memon (2007) Q. Xie and A. M. Memon Designing and comparing automated test oracles for gui-based software applications. ACM Transactions on Software Engineering and Methodology (TOSEM) 16 (1), pp. 4–es.
  • Xie et al. (2023) Z. Xie, Y. Chen, C. Zhi, S. Deng, and J. Yin ChatUniTest: a chatgpt-based automated unit test generation tool. arXiv preprint arXiv:2305.04764.
  • Yan et al. (2020) J. Yan, H. Liu, L. Pan, J. Yan, J. Zhang, and B. Liang Multiple-entry testing of android applications by constructing activity launching contexts. In 2020 IEEE/ACM 42nd International Conference on Software Engineering (ICSE), pp. 457–468.
  • Yang et al. (2018) S. Yang, H. Wu, H. Zhang, Y. Wang, C. Swaminathan, D. Yan, and A. Rountev Static window transition graphs for android. Automated Software Engineering 25 (4), pp. 833–873.
  • Yang et al. (2013) W. Yang, M. R. Prasad, and T. Xie A grey-box approach for automated gui-model generation of mobile applications. In International Conference on Fundamental Approaches to Software Engineering, pp. 250–265.
  • Yang et al. (2023) Z. Yang, J. Liu, Y. Han, X. Chen, Z. Huang, B. Fu, and G. Yu Appagent: multimodal agents as smartphone users. arXiv preprint arXiv:2312.13771.
  • Yasin et al. (2021) H. N. Yasin, S. H. A. Hamid, and R. J. Raja Yusof Droidbotx: test case generation tool for android applications using q-learning. Symmetry.
  • Yu et al. (2023) S. Yu, C. Fang, Y. Ling, C. Wu, and Z. Chen Llm for test script generation and migration: challenges, capabilities, and opportunities. In 2023 IEEE 23rd International Conference on Software Quality, Reliability, and Security (QRS), pp. 206–217.
  • Yuan et al. (2023) Z. Yuan, Y. Lou, M. Liu, S. Ding, K. Wang, Y. Chen, and X. Peng No more manual tests? evaluating and improving chatgpt for unit test generation. arXiv preprint arXiv:2305.04207.
  • Zeng et al. (2016) X. Zeng, D. Li, W. Zheng, F. Xia, Y. Deng, W. Lam, W. Yang, and T. Xie Automated test input generation for android: are we really there yet in an industrial case?. In Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 987–992.
  • Zhang et al. (2024) Y. Zhang, W. Zhang, D. Ran, Q. Zhu, C. Dou, D. Hao, T. Xie, and L. Zhang Learning-based widget matching for migrating gui test cases. In Proceedings of the 46th IEEE/ACM International Conference on Software Engineering, pp. 1–13.
  • Zhao et al. (2022) Y. Zhao, T. Su, Y. Liu, W. Zheng, X. Wu, R. Kavuluru, W. G. Halfond, and T. Yu ReCDroid+: automated end-to-end crash reproduction from bug reports for android apps. TOSEM.
  • Zhao et al. (2019) Y. Zhao, T. Yu, T. Su, Y. Liu, W. Zheng, J. Zhang, and W. G. Halfond Recdroid: automatically reproducing android application crashes from bug reports. In 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE), pp. 128–139.
  • Zheng et al. (2017) H. Zheng, D. Li, B. Liang, X. Zeng, W. Zheng, Y. Deng, W. Lam, W. Yang, and T. Xie Automated test input generation for android: towards getting there in an industrial case. In 2017 IEEE/ACM 39th International Conference on Software Engineering: Software Engineering in Practice Track (ICSE-SEIP), pp. 253–262.
  1. https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4 ↩