An apparatus and a method for automatically extracting a test case based on reinforcement learning
Patent Information
- Application Number
- KR1020230175315
- Authority / Receiving Office
- KR · KR
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2043-12-06
Smart Images

Figure 112023136669268-PAT00004_ABST
Abstract
Description
Technology Field
[0001] The present invention relates to a reinforcement learning-based automatic test case extraction device and method. Background Technology
[0003] Reliability testing to identify defects is currently required in fields such as national defense, aviation, automobiles, railways, and nuclear power, where software defects can cause catastrophic social and economic losses.
[0004] Source code coverage is a type of reliability test that refers to the ratio of code executed through testing to the total source code. Code coverage testing requires statement coverage, branch coverage, and MC / DC coverage.
[0005] DO-178B / C aviation requires coverage testing as follows.
[0006] Grade A: MC / DC Coverage 100%, Grade B: Decision Coverage 100%, Grade C: Statement Coverage 100%
[0007] ISO 26262 (Automotive) requires a corruption test according to the ASIL (Automotive Safety Integrity Levels) grade as shown in the table below (Grade D is MC / DC 100%).
[0008]
[0010] In SW code coverage testing, the most time and cost are incurred in generating test cases where expected input / output values are defined.
[0011] In the existing method, testers analyze the source code to define test cases that satisfy 100% coverage, and then input them collectively into the testing tool. Code coverage is measured based on the input values.
[0012] For reference, a test case is a single sample of test data that defines expected input / output values. Code coverage requires defining many test cases to test the coverage of a function.
[0013] The problem is that the process of generating test cases for dynamic testing tools is performed manually. In code coverage testing, the most time-consuming step is defining the expected input and output values for test cases.
[0014] While some testing tools have automation features, the test case extraction function may operate abnormally if the source code becomes complex.
[0015] In summary, the following problems and necessities exist.
[0016] As software becomes more complex, the importance of testing is increasing.
[0017] Existing coverage testing tools test by manually generating test cases.
[0018] Countless repetitive tests occur during the software development process due to source code modifications.
[0019] A significant amount of effort and cost is incurred in the process of testers manually generating test cases every time. Prior art literature
[0021] Published Patent Application No. 10-2023-0053316 (Title of Invention: Reinforcement Learning-based Test Case Input / Output Value Extraction System for Embedded Software Code Coverage Automation) The problem to be solved
[0022] The purpose of the present invention is to provide a reinforcement learning-based automatic test case extraction device and method capable of solving conventional problems. means of solving the problem
[0024] A reinforcement learning-based automatic test case extraction device according to an embodiment of the present invention for solving the above problem comprises: a parsing unit that parses source code to generate an abstract syntax tree (AST), extracts symbols using the abstract syntax tree (AST), and manages the extracted symbols in a symbol table; a test case suite generation unit that generates a graph through the abstract syntax tree (AST), extracts paths satisfying each coverage based on the generated graph, and generates a test case suite in which the set of extracted paths satisfies the coverage 100%; an input / output value extraction unit configured to extract expected input / output values for each test case through reinforcement learning, and extracts and / or extracts expected input / output values for each test case through a Climb hill algorithm, ensemble, and a separate cost function design based on reinforcement learning; and a verification unit that verifies the extracted expected input / output values for each test case.
[0026] In one embodiment, the input / output value extraction unit includes an agent design unit that designs an agent for finding expected input / output values of a test case, and the agent designed by the agent design unit is characterized by detecting by searching for and changing the values of changeable symbols in a symbol table.
[0028] In one embodiment, the agent receives a cost value based on the action of the current symbol from the environment, and if the cost value is 0, determines that the desired test case expected input / output value has been derived, and is characterized by a configuration in which the cost function is designed to take action in a direction that reduces the cost.
[0030] In one embodiment, the agent design unit is characterized by designing an agent by applying the Climb Hill algorithm to determine actions in a direction that reduces costs when designing the agent.
[0032] In one embodiment, the input / output value extraction unit further includes a reinforcement learning unit that enhances the learning speed by adding a cost value obtained in a previous calculation to the operand along with the predefined operand, in order to prevent the time required to find the interval where the cost converges to 0 when acting only with the operand values of the defined action operators (+, -, *, / ).
[0034] In one embodiment, the input / output value extraction unit further includes an ensemble support unit that supports changing two or more variables simultaneously in order to resolve the problem of falling into a local minimum when changing the value with only one symbol.
[0036] In one embodiment, the environment is characterized by being designed to receive three types of state information (e.g., a target execution path (Test case) of a test target function, an abstract syntax tree, and a symbol table), output a cost according to the action of the agent, and apply a cost function formula to calculate the cost according to the action of the agent.
[0038] In one embodiment, the cost function formula is characterized as being an expression calculated using a depth factor of an unexecuted sub-condition expression, a value difference factor of a comparison expression, and a weight (maximum depth - current depth) assigned to an upper-level condition expression.
[0040] A reinforcement learning-based automatic test case extraction method according to an embodiment of the present invention for solving the above problem comprises: a step of parsing source code in a parsing unit to generate an abstract syntax tree (AST), extracting symbols using the abstract syntax tree (AST), and managing the extracted symbols in a symbol table; a step of generating a graph through the abstract syntax tree (AST) in a test case suite generation unit, extracting paths satisfying each coverage based on the generated graph, and generating a test case suite in which the set of extracted paths satisfies the coverage 100%; a step of extracting expected input / output values for each test case through reinforcement learning in an input / output value extraction unit; and a step of verifying the extracted expected input / output values for each test case in a verification unit.
[0042] In one embodiment, the step of extracting expected input / output values for each test case is characterized by including: a step in which an agent designed to find expected input / output values of a test case in an agent design unit searches for and changes the values of changeable symbols in a symbol table to detect them; a step in which a reinforcement learning unit learns by adding a cost value obtained from a previous calculation to an operand along with a pre-defined operand to enhance the learning speed; and a step in which an ensemble support unit supports changing two or more variables simultaneously to resolve the problem of falling into a local minimum when changing values with only one symbol.
[0044] In one embodiment, the environment is characterized by being designed to receive three types of state information (e.g., a target execution path (Test case) of a test target function, an abstract syntax tree, and a symbol table), output a cost according to the action of the agent, and apply a cost function formula to calculate the cost according to the action of the agent.
[0046] In one embodiment, the cost function formula is characterized as being an expression calculated using a depth factor of an unexecuted sub-condition expression, a value difference factor of a comparison expression, and a weight (maximum depth - current depth) assigned to an upper-level condition expression. Effects of the invention
[0048] Therefore, by using the reinforcement learning-based test case automatic extraction device and method according to one embodiment of the present invention, first, there is an effect of reducing the effort / cost of SW testing through automatic test case extraction.
[0049] In addition, there is the advantage that expected input / output values can be automatically extracted even from complex source code by applying artificial intelligence.
[0050] In addition, there is the advantage of minimizing human error through the automation of test codes. Brief explanation of the drawing
[0052] FIG. 1a is a configuration diagram of a reinforcement learning-based automatic test case extraction device according to one embodiment of the present invention. FIG. 1b is a detailed configuration diagram of the input / output value extraction unit illustrated in FIG. 1a. FIG. 2a is a flowchart of a reinforcement learning-based automatic test case extraction method according to an embodiment of the present invention. Figure 2b is a detailed flowchart of the S730 process shown in Figure 2a. Figure 3 is an overview of the reinforcement learning process. Figure 4 is a conceptual diagram of the example code. Figure 5 is an example of the example code. Specific details for implementing the invention
[0053] Embodiments of the present invention are described below with reference to the attached drawings so that those skilled in the art can easily implement the invention. However, the present invention may be embodied in various different forms and is not limited to the embodiments described herein. Furthermore, in order to clearly explain the present invention in the drawings, parts unrelated to the explanation have been omitted, and similar parts throughout the specification are denoted by similar reference numerals.
[0054] Throughout the specification, when a part is described as being "connected" to another part, this includes not only cases where they are "directly connected" but also cases where they are "electrically connected" with other elements interposed between them. Furthermore, when a part is described as "including" a component, this means that, unless specifically stated otherwise, it does not exclude other components but may include additional components, and it should be understood that this does not preclude the existence or addition of one or more other features, numbers, steps, actions, components, parts, or combinations thereof.
[0055] Terms such as “about,” “substantially,” etc., used throughout the specification, are used to mean at or near the stated value when inherent manufacturing and material tolerances are presented in the stated meaning, and are used to prevent unscrupulous infringers from unfairly exploiting the disclosure in which precise or absolute values are mentioned to aid in understanding the invention. Terms such as “step” or “step of” used throughout the specification of the invention do not mean “step for”.
[0056] In this specification, the term "part" includes a unit realized by hardware, a unit realized by software, and a unit realized using both. Additionally, one unit may be realized using two or more pieces of hardware, and two or more units may be realized by one piece of hardware. Meanwhile, "part" is not limited to software or hardware, and "part" may be configured to reside in an addressable storage medium or configured to run on one or more processors. Accordingly, as an example, "part" includes components such as software components, object-oriented software components, class components, and task components, as well as processes, functions, attributes, procedures, subroutines, segments of program code, drivers, firmware, microcode, circuits, data, databases, data structures, tables, arrays, and variables. The functions provided within the components and "parts" may be combined into a smaller number of components and "parts" or further separated into additional components and "parts." In addition, the components and '~parts' may be implemented to play one or more CPUs within the device or secure multimedia card.
[0057] Some of the operations or functions described herein as being performed by a terminal, device, or device may instead be performed by a server connected to said terminal, device, or device. Likewise, some of the operations or functions described as being performed by a server may also be performed by a terminal, device, or device connected to said server.
[0058] In this specification, some of the operations or functions described as mapping or matching with a terminal may be interpreted as meaning mapping or matching the terminal's unique number or personal identification information, which is the terminal's identifying data.
[0060] Hereinafter, a reinforcement learning-based test case automatic extraction device and method according to an embodiment of the present invention will be described in more detail based on the attached drawings.
[0061] FIG. 1a is a configuration diagram of a reinforcement learning-based automatic test case extraction device according to one embodiment of the present invention, and FIG. 1b is a detailed configuration diagram of an input / output value extraction unit shown in FIG. 1a.
[0062] Figure 3 is an overview of the reinforcement learning process, Figure 4 is a conceptual diagram of the example code, and Figure 5 is an example diagram of the example code.
[0063] First, as illustrated in FIG. 1, a reinforcement learning-based test case automatic extraction device (100) according to one embodiment of the present invention is an invention that automates the existing test case expected input / output definition function using artificial intelligence (reinforcement learning) to reduce the effort and cost of coverage testing and to find input values more accurately even in complex source code.
[0064] More specifically, a reinforcement learning-based automatic test case extraction device (100) according to one embodiment of the present invention includes a parsing unit (110), a test case suite generation unit (120), an input / output value extraction unit (130), and a verification unit (140).
[0065] The above parsing unit (110) may be configured to parse source code to generate an abstract syntax tree (AST), extract symbols using the abstract syntax tree (AST), and manage the extracted symbols in a symbol table.
[0066] The above test case suite generation unit (120) may be configured to generate a graph through an abstract syntax tree (AST), extract paths that satisfy each coverage based on the generated graph, and generate a test case suite in which the set of extracted paths satisfies 100% of the coverage.
[0067] For reference, the test case suite generated by the test case suite generation unit (120) above has only an execution path to satisfy 100% coverage, and the value of the variable to execute the path has not yet been determined. The input value to execute the path is found through the reinforcement learning process of the input / output value extraction unit (130) described later.
[0068] In addition, a test case suite contains multiple test cases. A test case is a test specification in which expected input and output values are defined. When the entire test case suite is executed, the coverage of the corresponding function is measured.
[0069] Next, the input / output value extraction unit (130) is configured to extract expected input / output values for each test case through reinforcement learning, and extracts expected input / output values for each test case through a Climb hill algorithm, ensemble, and a separate cost function design based on reinforcement learning.
[0070] Here, reinforcement learning can be a process of finding the optimal solution through the interaction between the environment and the agent.
[0071] Environment is a term that determines rewards based on the current state and actions, and Agent is a term that determines actions.
[0072] The above input / output value extraction unit (130) includes an agent design unit (131), a reinforcement learning unit (132), and an ensemble support unit (133).
[0073] The above agent design unit (131) is configured to design an agent for finding expected input / output values of a test case, and the agent designed in the above agent design unit (131) detects by searching for and changing the values of changeable symbols in a symbol table.
[0074] In addition, the agent can receive cost values from the environment based on the action of the current symbol.
[0075] For example, if the cost value is 0, the agent determines that it has derived the expected input / output value for the desired test case.
[0076] Therefore, the cost function is designed so that the agent takes action in a direction that reduces costs.
[0077] The above agent design unit (131) may be configured to design an agent by applying the Climb Hill algorithm to determine actions in a direction that reduces costs when designing the agent.
[0078] For reference, the Climb Hill algorithm was named "Climb" because it ascends toward the direction of higher rewards; however, in this invention, the interpretation is applied that the algorithm ascends toward the direction of lower costs.
[0079] The agent receives information about changeable symbols.
[0080] For example, refer to Figure 4 and assume there are two changeable symbols, a and b. The behavioral operators applicable to the variables are broadly classified into +, -, *, and / codes, and each behavioral operator is defined with N operands.
[0081] The operand for each operator can be set as follows. The operand can be set to a different value, or more operands can be set.
[0082] ①+ op code: 0, 1, 2, 5,100, ②op code: 1, 2, 5,100, ③* op code: -1, 0, 2, 10, ④ / op code: 2, 10
[0083] For each episode of the action operator, try all actions and take the action with the lowest cost.
[0084] For example, in Fig. 4, a and b have an initial value of 0.
[0085] In the first episode, when a and b take the action of +10, they obtain the lowest costs of 1 and 10.
[0086] Repeat this process until the cost becomes 0, taking action to reduce the cost.
[0087] In other words, it goes up in the direction of reduced costs.
[0088] Next, the reinforcement learning unit (132) may be configured to enhance the learning speed by adding the cost value obtained in the previous calculation to the operand along with the defined operand, so as not to take a long time to find the range where the cost converges to 0 when acting only with the operand values of the defined action operators (+, -, *, / ).
[0089] For example, if you start by setting the initial value of a to 0 so that the condition a > 100 becomes True, you perform reinforcement learning to output the first calculated cost as 101.
[0090] Therefore, the operand of the next agent action supports exploration by adding +101 and -101 to the existing operand.
[0091] The above ensemble support unit (133) may be configured to support changing two or more variables simultaneously in order to resolve the problem of falling into a local minimum when changing the value with only one symbol.
[0093] The verification unit (140) above may be configured to verify the expected input / output values for each extracted Testcase.
[0094] Meanwhile, the environment presented in the present invention is provided with three types of state information (e.g., the target execution path (Test case) of the function to be tested, an abstract syntax tree, and a symbol table).
[0095] In addition, the Environment outputs costs associated with agent actions.
[0096] In addition, the environment is designed to apply a cost function formula for calculating the cost associated with agent actions.
[0097] [Equation 1]
[0098]
[0099] Here, a is the depth of the unexecuted sub-condition expression, b is the difference in values of the comparison expression, and alpha is the weight assigned to the parent condition expression (maximum depth - current depth).
[0100] For example, in the example code below, if all desired execution paths are true, a > 10 must be true. However, if the value of a is explored as 0, the code on lines 8–11 corresponding to that condition has a depth of 2. Therefore, a has a value of 2.
[0101] When a > 10 and a is 1, b is 10 as shown in the branching distance table below.
[0102]
[0104] Based on the example code, the alpha value is as follows.
[0105] a>10 : 3 - 0 = 3
[0106] b>5 : 3 - 1 = 2
[0107] a=b : 3 - 2 = 1
[0109] FIG. 2a is a flowchart of a reinforcement learning-based automatic test case extraction method according to an embodiment of the present invention, and FIG. 2b is a detailed flowchart of the S730 process shown in FIG. 2a.
[0110] First, referring to FIG. 2, a reinforcement learning-based test case automatic extraction method (S700) according to one embodiment of the present invention first parses source code in a parsing unit (110) to generate an abstract syntax tree (AST), extracts symbols using the abstract syntax tree (AST), and manages the extracted symbols in a symbol table (S710).
[0111] Afterwards, the test case suite generation unit (120) generates a graph through an abstract syntax tree (AST), extracts paths that satisfy each coverage based on the generated graph, and generates a test case suite (S720) in which the set of extracted paths satisfies the coverage 100%.
[0112] For reference, the test case suite generated by the test case suite generation unit (120) above has only an execution path to satisfy 100% coverage, and the value of the variable to execute the path has not yet been determined. Therefore, the input value to execute the path is found through the reinforcement learning process of the input / output value extraction unit (130) described later. In addition, the test case suite has multiple test cases. A test case is a test specification in which expected input / output values are defined. When the test case suite is fully executed, the coverage of the corresponding function is measured.
[0113] When the above S720 process is completed, the input / output value extraction unit (130) extracts the expected input / output values for each test case through reinforcement learning (S730).
[0114] More specifically, the above S730 process detects (S731) an agent designed to find the expected input / output values of a test case in the agent design unit (131) by searching for and changing the values of changeable symbols in the symbol table.
[0115] Here, the agent can receive cost values based on the action of the current symbol from the environment, and if the cost value is 0, the agent determines that it has derived the expected input / output value of the desired test case, and the cost function is designed so that the agent takes action in a direction that reduces the cost.
[0116] In addition, the Climb Hill algorithm is applied to the agent to determine actions that reduce costs.
[0117] In addition, the agent receives information about changeable symbols.
[0118] For example, refer to Figure 4 and assume there are two changeable symbols, a and b. The behavioral operators applicable to the variables are broadly classified into +, -, *, and / codes, and each behavioral operator is defined with N operands.
[0119] The operand for each operator can be set as follows. The operand can be set to a different value, or more operands can be set.
[0120] ①+ op code: 0, 1, 2, 5,100, ②op code: 1, 2, 5,100, ③* op code: -1, 0, 2, 10, ④ / op code: 2, 10
[0121] For each episode of the action operator, try all actions and take the action with the lowest cost.
[0122] For example, in Fig. 4, a and b have an initial value of 0.
[0123] In the first episode, when a and b take the action of +10, they obtain the lowest costs of 1 and 10.
[0124] Repeat this process until the cost becomes 0, taking action to reduce the cost.
[0125] In other words, it goes up in the direction of reduced costs.
[0127] Next, when the above S731 process is completed, the learning speed is enhanced by adding the cost value obtained from the previous calculation to the operand along with the operand defined in the reinforcement learning unit (132) to the learning unit (S732). For reference, the above S732 process may be a step to prevent the time required to find the range where the cost converges to 0 when acting only with the operand values of the defined action operators (+, -, *, / ).
[0128] For example, if you start by setting the initial value of a to 0 so that the condition a > 100 becomes True, you perform reinforcement learning to output the first calculated cost as 101.
[0129] Therefore, the operand of the next agent action supports exploration by adding +101 and -101 to the existing operand.
[0130] When the above S732 process is completed, the ensemble support unit (133) supports changing two or more variables simultaneously (S733) to resolve the problem of falling into a local minimum when changing the value with only one symbol.
[0131] Afterward, when the above S730 process is completed, the expected input / output values for each extracted Testcase are verified (S740).
[0133] Therefore, by using the reinforcement learning-based test case automatic extraction device and method according to one embodiment of the present invention, first, there is an effect of reducing the effort / cost of SW testing through automatic test case extraction.
[0134] In addition, there is the advantage that expected input / output values can be automatically extracted even from complex source code by applying artificial intelligence.
[0135] In addition, there is the advantage of minimizing human error through the automation of test codes.
[0137] The device described above may be implemented as a hardware component, a software component, and / or a combination of a hardware component and a software component. For example, the device and components described in the embodiments may be implemented using one or more general-purpose or special-purpose computers, such as, for example, a processor, a controller, an Arithmetic Logic Unit (ALU), a digital signal processor, a microcomputer, a Field Programmable Gate Array (FPGA), a Programmable Logic Unit (PLU), a microprocessor, or any other device capable of executing and responding to instructions. The processing unit may execute an operating system (OS) and one or more software applications executed on said operating system. Additionally, the processing unit may access, store, manipulate, process, and generate data in response to the execution of the software. For ease of understanding, the processing unit may be described as being used as a single unit, but those skilled in the art will understand that the processing unit may include a plurality of processing elements and / or a plurality of types of processing elements. For example, the processing unit may include multiple processors or one processor and one controller. Additionally, other processing configurations, such as parallel processors, are also possible.
[0138] Software may include computer programs, code, instructions, or a combination of one or more of these, and may configure a processing unit to operate as desired or command the processing unit independently or collectively. Software and / or data may be permanently or temporarily embodied in any type of machine, component, physical device, virtual equipment, computer storage medium or device, or transmitted signal wave so as to be interpreted by the processing unit or to provide instructions or data to the processing unit. Software may be distributed over networked computer systems and may be stored or executed in a distributed manner. Software and data may be stored on one or more computer-readable recording media.
[0139] The method according to the embodiment may be implemented in the form of program instructions that can be executed through various computer means and recorded on a computer-readable medium. The computer-readable medium may include program instructions, data files, data structures, etc., either alone or in combination. The program instructions recorded on the medium may be those specifically designed and configured for the embodiment, or they may be those known and available to those skilled in the art of computer software. Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes; optical recording media such as CD-ROMs and DVDs; magneto-optical media such as floptical disks; and hardware devices specifically configured to store and execute program instructions, such as ROM, RAM, and flash memory. Examples of program instructions include machine code, such as that generated by a compiler, as well as high-level language code that can be executed by a computer using an interpreter, etc. The hardware devices described above may be configured to operate as one or more software modules to perform the operation of the embodiment, and vice versa.
[0140] Although the embodiments have been described above with reference to limited examples and drawings, those skilled in the art can make various modifications and variations from the description above. For example, suitable results can be achieved even if the described techniques are performed in a different order than described, and / or the components of the described system, structure, device, circuit, etc. are combined or assembled in a form different from described, or replaced or substituted by other components or equivalents.
[0141] Therefore, other implementations, other embodiments, and equivalents to the claims also fall within the scope of the claims set forth below. Explanation of the symbols
[0143] 100: Reinforcement learning-based automatic test case extraction device 110: Parsing section 120: Test Case Suite Generation Section 130: Input / Output Value Extraction Unit 140: Verification Department
Claims
Claim 1 A parsing unit that parses source code to generate an Abstract Syntax Tree (AST), extracts symbols using the Abstract Syntax Tree (AST), and manages the extracted symbols in a symbol table; a test case suite generation unit that generates a graph through the said Abstract Syntax Tree (AST), extracts paths satisfying each coverage based on the generated graph, and generates a test case suite in which the set of extracted paths satisfies the corresponding coverage 100%; and an input / output value extraction unit configured to extract expected input / output values for each test case through reinforcement learning, wherein the input / output values for the test case are extracted based on reinforcement learning using the Climb Hill algorithm, ensemble, and a separate cost function design. A reinforcement learning-based automatic test case extraction device comprising a verification unit that verifies expected input / output values for each extracted test case, wherein the input / output value extraction unit includes an agent for searching for expected input / output values of a test case, wherein the agent selects at least one value among a plurality of symbol values included in a symbol table and performs an action of changing the symbol value using a predefined action operator and operand, wherein the agent receives a cost value corresponding to the change of the symbol value from an environment and is learned to select the action in a direction in which the cost value decreases, wherein the environment is configured to calculate a cost corresponding to the agent's action based on the execution path of the test target function, the abstract syntax tree, and the symbol table, and wherein the cost function is configured to calculate the cost based on information regarding an unexecuted condition expression and a value indicating the degree of satisfaction of the condition expression. Claim 2 A reinforcement learning-based automatic test case extraction device according to claim 1, wherein the input / output value extraction unit includes an agent design unit for designing an agent to find expected input / output values of a test case, and the agent designed in the agent design unit detects by searching and changing the values of changeable symbols in a symbol table. Claim 3 A reinforcement learning-based automatic test case extraction device according to claim 2, wherein the agent receives a cost value corresponding to the action of the current symbol from the environment, and if the cost value is 0, determines that the desired test case expected input / output value has been derived and is configured to take action in a direction that reduces the cost, and wherein the action of the symbol means a change in the symbol value included in the symbol table. Claim 4 A reinforcement learning-based automatic test case extraction device according to claim 3, wherein the agent design unit designs the agent by applying the Climb Hill algorithm to determine actions in a direction that reduces costs when designing the agent. Claim 5 A reinforcement learning-based test case automatic extraction device according to claim 4, wherein the input / output value extraction unit further includes a reinforcement learning unit that enhances the learning speed by adding a cost value obtained in a previous calculation to the operand along with the predefined operand, in order to prevent the time required to find the interval where the cost converges to 0 when acting only with the operand values of the defined action operators (+, -, *, / ). Claim 6 A reinforcement learning-based test case automatic extraction device according to claim 5, wherein the input / output value extraction unit further includes an ensemble support unit that supports changing two or more variables simultaneously to resolve the problem of falling into a local minimum when changing a value with only one symbol, and wherein the one symbol is one of a plurality of symbols included in a symbol table. Claim 7 A reinforcement learning-based automatic test case extraction device according to claim 6, characterized in that the environment is designed to receive three types of state information (e.g., target execution path of a test target function (Test case), abstract syntax tree, symbol table), output a cost according to the action of the agent, and apply a cost function formula to calculate the cost according to the action of the agent. Claim 8 A reinforcement learning-based test case automatic extraction device according to claim 7, wherein the cost function formula is an expression calculated using a depth factor of an unexecuted sub-condition formula, a value difference factor of a comparison formula, and a weight (maximum depth - current depth) assigned to an upper-level condition formula, and wherein the cost function formula is configured to calculate the cost using multiple factors. Claim 9 A step of parsing source code to generate an Abstract Syntax Tree (AST) in a parsing unit, extracting symbols using the Abstract Syntax Tree (AST), and managing the extracted symbols in a symbol table; a step of generating a graph through the Abstract Syntax Tree (AST) in a test case suite generation unit, extracting paths satisfying each coverage based on the generated graph, and generating a test case suite in which the set of extracted paths satisfies the coverage 100%; a step of extracting expected input / output values for each test case through reinforcement learning in an input / output value extraction unit; and a step of verifying the extracted expected input / output values for each test case in a verification unit, wherein the step of extracting expected input / output values for each test case comprises: selecting at least one value among a plurality of symbol values included in the symbol table using an agent for searching for the expected input / output values of the test case, and changing the said symbol value using a predefined action operator and operand; receiving a cost value corresponding to the change of the said symbol value from an environment; and training the said agent to change the said symbol value in a direction in which the said cost value decreases. A reinforcement learning-based automatic test case extraction method comprising the step of calculating the cost by applying a cost function formula to calculate the cost based on the execution path, abstract syntax tree, and symbol table of the test target function in the environment. Claim 10 In claim 9, the step of extracting expected input / output values for each test case comprises: a step in which an agent designed to find expected input / output values of a test case in an agent design unit searches for and modifies the values of changeable symbols in a symbol table to detect them; a step in which a reinforcement learning unit adds a cost value obtained from a previous calculation to an operand along with a pre-defined operand to enhance the learning speed and performs learning; and a step in which an ensemble support unit supports changing two or more variables simultaneously to resolve the problem of falling into a local minimum when changing values with only one symbol. Claim 11 A reinforcement learning-based automatic test case extraction method according to claim 10, wherein the environment is designed to receive three types of state information (e.g., a target execution path (Test case) of a test target function, an abstract syntax tree, and a symbol table), output a cost according to the action of the agent, and apply a cost function formula to calculate the cost according to the action of the agent, and wherein the environment is configured to calculate the cost according to the action of the agent based on the execution path of the test target function, the abstract syntax tree, and the symbol table. Claim 12 A reinforcement learning-based automatic test case extraction method according to claim 11, wherein the cost function formula is an expression calculated using a depth factor of an unexecuted sub-condition expression, a value difference factor of a comparison expression, and a weight (maximum depth - current depth) assigned to an upper-level condition expression, and wherein the cost function formula is configured to calculate the cost using multiple factors.
Citation Information
Patent Citations
Method for measuring code coverage and computer readable recording medium having program the same
KR1020160021585A
Method for performing test using test case and apparatus for the same
KR1020180099241A
System, method and apparatus for machine learning
KR1020190087351A
System and method for automating software code coverage for artificial intelligence-based embedded
KR1020230053313A
System for predicting input and output of test case based on artificial intelligence for automation testing of embedded software code coverage test
KR1020230053316A