Editor’s introduction
It finds a strong concentration on quality assurance activities, particularly those involving automated testing and robustness evaluation. Most studies use single-agent reinforcement learning, with limited exploration of multi-agent approaches. The analysis provides a task-oriented overview of RL4SE, outlining both common formulations and persistent difficulties in translating RL to practical software engineering contexts.
Background
Reinforcement learning (RL) is a major area of machine learning that studies how an autonomous agent can make effective decisions in complex and dynamic environments. The central objective of RL is to learn the rules, or policy, of taking a particular action in a specific state, thereby maximizing cumulative reward over a sequence of actions during the state space exploration. This fundamental problem formulation, also known as the Markov decision process (MDP), enables the RL agent to improve its behavior through interaction and feedback from the environment without the need for explicit instructions or labels from human experts.
Traditional RL algorithms typically operate on discrete or low-dimensional state spaces, as seen in classical tabular algorithms such as Q-learning and SARSA, whose performance is often limited by the scale of the problem. A major breakthrough in RL is the advent of deep reinforcement learning (DRL) that leverages deep neural networks (DNNs) to approximate the state-action policy. This allows RL algorithms to model high-dimensional, continuous, or exponentially growing state spaces, greatly enhancing their representational and learning capabilities. Therefore, RL has become well-suited for tasks requiring autonomous strategy discovery in complex and dynamic environments, with successful applications in domains such as robotic control, game playing, and autonomous driving.
Software engineering (SE) focuses on systematic design, development, testing, and maintenance of complex and large-scale software systems. These processes often involve interactions among multiple stakeholders, evolving requirements, and inherent uncertainties in software behavior and execution environments. This combination of complexity and dynamism makes RL suitable for many challenging SE tasks, which require sequential decision-making under uncertainty and continuous change. As a result, numerous research efforts have emerged in reinforcement learning for software engineering (RL4SE) over the past years. These research works address long-standing SE challenges across the entire software lifecycle, including requirements engineering, coding, testing, debugging, and so on.
State-Space Definition
State definition involves specifying the composition of the state space and determining the key GUI information required to represent a state. As mentioned in §5.3, in the early stage of RL-based GUI testing, researchers typically favored simple tabular RL algorithms such as Q-learning. In such studies, state definition focuses on simplifying raw observations and extracting key features to efficiently identify new states and assign them unique indices. This typically involves first defining state representations (how states are encoded) and then calculating similarity between states to group or distinguish them. As research advanced, more sophisticated RL methods emerged, with an increasing number of studies incorporating neural networks. This shift introduced the critical challenge of state embedding, a form of state representation, which involves determining what information to extract and how to map high-dimensional or complex states into compact continuous vector representations compatible with neural network architectures. Effectively addressing this challenge is crucial to enable efficient learning and improve the performance of RL-based GUI testing for complex apps.
③Layout files representing the current page (typically in XML or HTML format), or structural data such as the DOM tree of the page provide more detailed GUI information on interactive elements, including their positions and hierarchical relationships. They can also be used to represent application states. For example, WebExplor proposed a state representation method by converting an HTML document into a sequence of tags and utilizing the gestalt pattern matching algorithm to compute the similarity between two sequences.
Different from DOMnet, Q-Testing introduced an alternative approach that employs a learned state comparison model, where a neural network is trained on an extensive number of collected samples to distinguish states at the granularity of functional scenarios. The model computes inter-page similarity by analyzing and comparing their layouts.
④Screenshots are observable representations of the application’s interactive state. When employing screenshots to represent application states, the key challenges lie in how to differentiate one screenshot image from another and embed the images. To address the challenges, Gerber et al. first evaluate UI state similarity using the Structural Similarity Index Measure (SSIM) and encode states in binary formats, which are then integrated into the overall state embedding. PIRLTest, as a platform-independent approach, embeds states directly from GUI images using deep learning. For widget features, it employs Canny edge detection to extract widgets on a screenshot. Then, it embeds widget images and locations via VGG-16 CNN and classifies widget types into 14 categories. The layout structure, represented as a tree, is converted to a string and embedded using an LSTM model trained to approximate tree edit distances. The final state embedding is the concatenation of the averaged widget features and layout features.
State-Space Definition
①Single State (SS): In this paradigm, researchers model the problem as a multi-armed bandit problem, where there exists only a single global state with multiple actions. Formally, multi-armed bandits are equivalent to a single-state MDP. Therefore, MDP-based algorithms, such as Q-learning, can still be applied to multi-armed bandit problems. However, due to the absence of state transitions inherent in the single-state nature, many specialized algorithms have been developed specifically to address multi-armed bandit problems.
③Target as a State (TaaS): In this paradigm, the testing process is still formulated as an MDP, where the state represents the testing target, such as the current coverage level or system load. Compared with IaaS, this formulation exhibits two distinctive characteristics that influence how the agent learns from interactions.
First, TaaS states often encode an ordered testing objective, such as system load or cumulative coverage. When the objective is to exceed a predefined load threshold, an action that moves the SUT toward that threshold may receive a larger reward. This ordering informs reward design but does not imply one fixed reward function for all TaaS formulations.
Additionally, TaaS can be combined with IaaS to further construct a state representation containing more information. However, the existing literature only includes two papers, and one of the reasons is that the design of the testing task objectives makes the corresponding target results fixed for the same input. Nevertheless, the combination of IaaS and TaaS still requires further exploration.
As discussed above, the definition of state varies considerably across SS, IaaS, and TaaS paradigms, leading to different forms of state information extracted from the testing environment. Since both SS and IaaS derive their state features from the SUT, they share certain commonalities. The corresponding state abstraction methods for each paradigm are discussed in the following subsections.
SS and IaaS related Features: Depending on the availability of the source code, the techniques are generally classified into black-box and white-box testing. White-box testing enables access to program code and internal execution details, thereby providing richer contextual information and resulting in a distinct state abstraction process compared to its black-box counterpart. The state abstraction methods discussed below will be applicable to the state definition of the contextual MAB model, as well as serving as additional supplementary information for the IaaS model beyond the current input.
①Mining Historical Inputs: Historical test input from previous iterations can convey useful information about the testing process. Since code-level and internal state information are inaccessible in black-box testing, leveraging historical inputs becomes a practical alternative. However, most existing black-box testing techniques only consider the previous input (i.e., the basic IaaS model). For complex input structures, such as certificate inputs, historical inputs are further processed and encoded into feature representations of the state. Only one study incorporates historical interaction sequences into the state definition. Exploring the use of longer historical input sequences remains a promising direction for future research.
②Static Code Analysis Data (Whitebox Testing Only): This category of information primarily concerns the structural characteristics of the program, such as its syntax tree. For instance, Paduraru et al. employ symbolic execution to generate the target addresses for each branch along with their corresponding constraint conditions, thereby abstracting the logical structure of the code.
③Dynamic Code Analysis Data (Whitebox Testing Only): This category of information evolves during test execution and primarily reflects runtime coverage characteristics, such as branch coverage and proximity to target points. It may also include historical execution information, as in Romdhana et al.’s work, where the state combines the previous execution’s input parameters with the execution frequencies of program branches.
Action-Space Definition
The key distinction between the two categories lies in whether the input must satisfy strict structural constraints. For example, test cases for functions such as max(a, b,…) fall into the simple-variable category: although correlations among variables may exist, changing any single value rarely invalidates the entire test case, allowing effective and diverse test generation. In contrast, compiler testing belongs to the structured-input category, as the input program must adhere to strict syntactic rules to compile successfully. Randomly generating strings leads to a large proportion of test cases failing at the syntax-checking stage, thereby resulting in low-quality test generation.
In test generation process, the testing tool needs to generate various types of inputs, such as boolean values, integers, floating-point numbers, sets and strings. When RL is adopted, this input-generation step is typically formulated as the agent’s action. For MuCoRest, the action selects an API operation, its parameters, and parameter values to construct an individual API request. However, certain characteristics of input parameters create challenges for defining the action space.
Continuous Value Space Problem. A key difficulty is that parameter domains are often infinite or continuous, which complicates direct action modeling. Among the surveyed test-generation approaches that generate or mutate input parameters, seven papers explicitly mentioned this challenge. To address this, existing studies propose three main strategies for defining actions over input parameters: discretization, probability distribution, and external resource dependence.
①Discretization. The discretization technique defines a set of discrete and finite modification operators that act on the current input parameter values. These modification operators typically include: 1) Initialization operator, which assigns a fixed value to the parameter (e.g., setting it to 0); and 2) Modification operator, which adjusts the parameter based on its current value, such as adding or subtracting a constant.
For numeric input parameters, modification operators used in existing methods are often grouped into three categories: small-value addition/subtraction, large-value addition/subtraction, and multiplication/division. The large-value addition/subtraction operators can significantly change the input parameter values, enabling the agent to adjust to suitable inputs more quickly, thereby accelerating convergence and alleviating the issue of getting trapped in local optima. Meanwhile, multiplication/division serve as more aggressive operators, significantly altering the input parameter values and allowing them to approximate a continuous range.
For string-type input parameters, existing methods primarily involve insertion or deletion operations at the beginning or end of the current input string. These approaches do not analyze the semantic context within the string and therefore struggle to generate meaningful inputs. APIRL similarly discretizes request mutation into a fixed action space of 23 predefined operators, including parameter removal, duplication, type changes, and concrete-value substitutions. Additionally, insertion at random positions or the use of external input sources can help generate semantically meaningful string inputs.
The advantage of discretization techniques lies in their ability to consistently generate concrete input parameter values, enabling the agent to converge quickly toward suitable inputs. This makes them particularly effective in scenarios that require specific constant values. However, this approach remains limited in modeling continuous value ranges. Even with operators such as division introduced to expand the generation range, the method faces the issue of producing uneven distributions in initial scenarios (i.e., unintentionally introducing unexpected and difficult-to-control prior distributions for input parameter values). Therefore, researchers may consider further introducing complex operators and other methods to mitigate these issues.
②Probability Distribution. The probability distribution technique defines input parameters using probability distributions, such that the agent does not directly generate a specific input value. Instead, it generates a probability distribution, from which a specific input value is subsequently selected. In this approach, the agent’s actions are defined as adjustments to the hyperparameters of the probability distribution, such as the mean and variance of a normal distribution.
The advantage of this approach lies in its ability to generate a continuous action space, model complex variations in input parameters, and explore the action space more flexibly. However, there is a gap between producing a probability distribution and selecting based on the probabilities (i.e., the optimal probability distribution does not guarantee that the optimal action is output each time). Consequently, the agent may require extensive learning to generate an effective probability distribution, significantly slowing convergence. This issue is particularly pronounced when specific constant values are required, as a continuous action space may necessitate additional training iterations to identify suitable inputs.
Design of Reward Functions
②Oracle-related Reward. Reward functions in this category are designed based on the results of the test oracles, reflecting the correctness or expected behavior of the SUT. Depending on the testing purposes, we discuss them separately for functional testing and performance testing.
Among the collected studies, even for the same testing task, reward functions may vary due to different considerations. This divergence is common when different reward categories outlined above are adopted. For instance, both Corradini et al. and Kim et al. target generating request parameters for RESTful API testing. Kim et al. reward the agent when SUT responds with a failure, which falls under oracle-related rewards, as the objective is to encourage inputs that trigger system failures. In contrast, Corradini et al. reward successful responses (HTTP code 200). This design aligns with coverage-related rewards: as stated by the authors, a successful response indicates that the SUT transitions to another state. Thus, rewarding successful responses encourages the agent to generate more meaningful inputs and achieve broader state coverage of the SUT.
This example illustrates that different reward function designs may each have their own advantages and disadvantages: emphasizing one objective may cause others to be overlooked. A common strategy is to combine the novelty-based and the oracle-related rewards, such as rewarding only novel inputs that trigger failures or only novel failing executions. Such hybrid designs are frequently applied in performance testing scenarios. However, these combinations can still suffer from issues such as reward sparsity. Existing studies have paid limited attention to this contradiction. Future studies could further evaluate different reward functions to understand the characteristics and distribution of rewards under various designs, thereby identifying effective reward-design principles.
Conclusion
RL is a powerful paradigm for addressing a wide range of challenges in SE. By leveraging its sequential decision-making capability, RL naturally fits many SE problems that require long-term optimization and interaction-driven learning. In this SLR, we systematically analyzed research on RL4SE published between 2006 and June 2025, providing a comprehensive overview of how RL techniques have been adopted across the software development lifecycle. From an algorithmic perspective, most existing studies rely on single-agent RL formulations, while some recent work explores multi-agent collaboration, indicating an important opportunity for future research. Moreover, value-based methods are more prevalent than policy-based ones, with Q-learning and DQN being the most widely adopted approaches. We further conduct a fine-grained methodological analysis of commonly studied subtasks, systematically summarizing how RL is instantiated to address specific SE problems. Our analysis shows that quality assurance tasks dominate existing studies, highlighting RL’s particular suitability for testing scenarios. This analysis emphasizes modeling choices and design patterns, enabling readers to quickly understand how RL can be adapted to different SE contexts. Beyond methodological observations, we identify several key challenges shared across prevalent RL4SE subtasks. By summarizing common RL4SE subtasks and their modeling practices, this SLR provides a practical guide that helps researchers quickly get started and supports the reuse, comparison, and extension of existing methods.


