Test support systems, test support methods, test support programs
The test support system addresses the challenge of generating high-coverage test data for legacy systems by normalizing and searching control flow graphs to determine valid path patterns as test cases, enhancing system migration efficiency.
Patent Information
- Application Number
- JP2026109371
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2026-06-23
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2046-06-23
AI Technical Summary
Generating test data with high coverage for legacy software systems during migration to modern programming languages is difficult due to differences in programming language specifications, making maintenance and expansion challenging.
A test support system that generates a first control flow graph from legacy source code, normalizes it to a second control flow graph, and searches for path patterns while ensuring constraint conditions are met, determining valid path patterns as test cases.
Enables efficient generation of test data that covers execution paths in legacy systems, facilitating system migration by reducing search costs and improving readability and maintainability.
Smart Images

Figure 0007954922000001_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a test support system, method, and program for generating program test data.
Background Art
[0002] Conventionally, in software development, test processes are indispensable for improving program quality and ensuring reliability. In particular, in test support technology based on generating program test data, there is a demand for efficiently creating test cases that comprehensively verify processing structures and conditional branches inside the program. Since manually creating test cases requires significant effort and time, in recent years, development has progressed on technologies that automatically generate test data and test cases based on source code analysis.
[0003] Patent Document 1 discloses a technology that extracts necessary additional test cases for software under test and automatically outputs their pass / fail judgment. This technology generates a control flow graph from the input software under test, which graphically represents all paths that may be traversed when the program is executed. Then, existing test cases are executed on the control flow graph to record the paths that are traversed. If the existing test cases alone do not meet the predetermined coverage criteria of the control path testing method, additional test cases are generated to satisfy those coverage criteria. Furthermore, expected results that should be obtained when the program is executed under the conditions specified in the additional test cases are generated, and the test results of the additional test cases are calculated based on the execution results obtained by executing the additional test cases in the test case execution unit and the expected results.
Prior Art Documents
Patent Documents
[0004]
Patent Document 1
Summary of the Invention
[0005] Incidentally, in large-scale information systems of companies and government agencies, a large amount of software developed using so-called legacy programming languages such as COBOL is still in operation, and this software has been running for many years. While this legacy source code was optimized for the hardware and business requirements of the time, it deviates from current platforms and development standards, making maintenance and expansion difficult. Consequently, attempts are being made to improve readability, maintainability, and portability by converting these legacy assets to modern programming languages (such as Java and C#).
[0006] In such system migrations, verifying whether the migrated program correctly meets the specifications of the pre-migration system requires generating test data that covers the execution paths latent in the original legacy source code with high coverage. However, generating test data with high coverage has been difficult due to differences in the specifications of the programming languages before and after the migration.
[0007] In light of these circumstances, this disclosure aims to address the problem of providing a technology for generating test data for programs associated with system migration. [Means for solving the problem]
[0008] To solve the above problems, the test support system according to this disclosure comprises: a graph generation unit that generates a first control flow graph by parsing source code; a normalization unit that normalizes the first control flow graph and generates a second control flow graph; a search unit that, in the process of searching for path patterns from a start node to an end node in the second control flow graph, determines whether or not the constraint conditions of the branch nodes included in the path pattern are met and stops searching for path patterns that do not meet the constraint conditions; and a case determination unit that determines the path patterns that have reached the end node through the search as test cases. [Effects of the Invention]
[0009] According to the present invention, it is possible to provide a technology for generating test data for programs associated with system migration. [Brief explanation of the drawing]
[0010] [Figure 1] System Configuration Diagram According to This Embodiment [Figure 2] Block diagram of the test support device according to this embodiment [Figure 3] Processing flowchart of the test support method according to this embodiment [Figure 4] Diagram illustrating the normalization of the control flow graph according to this embodiment. [Figure 5] Diagram illustrating the normalization of the control flow graph according to this embodiment. [Figure 6] Diagram illustrating the normalization of the control flow graph according to this embodiment. [Figure 7] Overview diagram of data generated by the search according to this embodiment. [Figure 8] Overview diagram of the search termination determination according to this embodiment [Figure 9] Schematic diagram of the dynamic generation method for path patterns according to this embodiment. [Figure 10] Overview diagram of SSA conversion and SMT conversion according to this embodiment. [Modes for carrying out the invention]
[0011] The following describes a test support system, method, and program relating to embodiments of this disclosure with reference to the drawings. Note that the embodiments shown below are examples of the present invention, and this disclosure is not limited to these embodiments; various configurations can be adopted.
[0012] In this embodiment, the configuration and operation of the test support system will be described, but similar configurations, computer programs, and program recording media on which the program is stored will produce similar effects. Using a program recording medium, the program can be installed on a computer. The series of processes according to this embodiment, described below, are provided as a program executable on a computer and can be provided via non-transient computer-readable recording media such as CD-ROMs and flexible disks, as well as via communication lines.
[0013] A test support system consists of one or more computer devices. Each computer device includes a processing unit such as a CPU (Central Processing Unit) and a memory device. The computer device can function as a test support device by executing a program stored in the memory device using its processing unit. The test support method is implemented through the processing of the test support system and the device itself.
[0014] The test data in this embodiment includes test cases and input data. A test case is data that indicates the execution procedure from the start to the end of a program (source code), test conditions, and the like. Since the program includes branch conditions and the like in the process of the execution procedure, there are a plurality of execution procedures (paths) corresponding to each branch from the start to the end of the program. Therefore, it is desirable that the test cases be generated corresponding to each execution path so as to satisfy a predetermined coverage criterion set in the target program. In addition, the input data indicates variables and parameters input in each processing instruction in the test case. The branch condition of the test case is determined whether or not the condition is satisfied according to the input data or a parameter calculated from the input data, thereby determining a path to be executed.
[0015] 1. System Configuration FIG. 1 shows a configuration diagram of a test support system. As shown in FIG. 1, the test support system 1 includes a test support device 100 and a user terminal 200. The test support device 100 is connected to the user terminal 200 via a communication network NW. The test support system 1 executes the test support method as a whole through cooperation of methods executed by each component. In the illustrated example, only one user terminal 200 is illustrated, but a plurality of user terminals 200 may be present.
[0016] The test support device 100 is configured by a server device, a personal computer, or the like, and includes a processor 110, a memory 120, and a communication interface 130. The test support device 100 may further include an input / output interface (such as a keyboard or a monitor). In addition, the test support device 100 may be configured by one or a plurality of computers.
[0017] The processor 110 is composed of a CPU capable of executing an instruction set, a GPU (Graphics Processing Unit), or the like. The processor 110 executes a computer program for executing the test support method, or at least a part of a plurality of computer programs executed in cooperation, as well as an OS (Operating System) and other applications, thereby controlling the overall operation processing of the test support apparatus 100. The test support apparatus 100 may include one or more processors 110.
[0018] The memory 120 includes volatile memory such as RAM (Random Access Memory) capable of storing an instruction set, and a non-volatile recording medium such as an HDD (Hard Disk Drive) or SSD (Solid State Drive) capable of recording the OS and the above-described computer programs. The test support apparatus 100 includes one or more memories 120, and at least one of the one or more memories stores a database management system.
[0019] The communication interface 130 has an interface for connecting to a communication network, and performs communication control to input and output information. The test support apparatus 100 includes one or more communication interfaces 130. When the test support apparatus 100 is operated as a server and does not have a physical input / output interface, operations are performed from a client via a communication network such as a LAN (Local Area Network) or WAN (Wide Area Network). Similarly, when a plurality of test support apparatuses 100 cooperate to execute the test support method, communication is performed between the plurality of test support apparatuses 100 via the communication network.
[0020] The user terminal 200 is comprised of a personal computer, tablet, or smartphone, and includes a processor 210 such as a CPU, memory 220 such as RAM, HDD, SSD, or flash storage, a communication interface 230 for connecting to a communication network via wireless communication or wired LAN, an input interface 240 such as a mouse, keyboard, touch panel, or microphone, and an output interface 250 such as a display or speaker. Multiple user terminals 200 may exist, and they are operated by the user who generates the test data. The memory 220 stores browser applications and various data. The processor 210, for example, executes a browser application and accesses web services provided by the test support device 100 via a web browser, thereby enabling data communication with the test support device 100.
[0021] In this embodiment, if the test support device 100 is equipped with an input / output interface, it can directly receive operations from a client (user). In this case, the test support system 1 may consist only of the test support device 100, without the intervention of a user terminal 200.
[0022] 3. Functional Components Figure 2 shows a block diagram of the test support device 100. The processor 110 of the test support device 100 functions as a functional component including a source code acquisition unit 111, a graph generation unit 112, a normalization unit 113, a search unit 114, a case determination unit 115, and an input data generation unit 116 by executing a computer program stored in the memory 120. The memory 120 functions as a database including a first repository 121 and a second repository 122.
[0023] The first repository 121 stores various data of the legacy program before migration. The second repository 122 stores various data of the modern program after migration. The test support device 100 generates test data for the modern program based on the data, including the source code of the legacy program, stored in the first repository 121, and stores it in the second repository 122. This disclosure describes an example where the legacy program is COBOL and the modern program is Java, but the programming languages are not limited to these.
[0024] The source code acquisition unit 111 acquires the source code of the legacy program before the migration via the user terminal 200 and stores it in the first repository 121.
[0025] The graph generation unit 112 generates a first control flow graph by parsing the source code. The target source code is automatically selected from the source code stored in the first repository 121, or by instructions via the user terminal 200. The first control flow graph represents data in a graph structure where processing instructions or sets of processing instructions in the source code are nodes, and the transitions in the execution order between them are edges. In this embodiment, the graph generation unit 112 can generate the first control flow graph by parsing each of the special control instructions (branch instructions, call instructions, jump instructions, termination instructions, etc.) contained in the COBOL source code.
[0026] The normalization unit 113 normalizes the first control flow graph and generates a second control flow graph. In the first control flow graph, certain nodes may not have information about the next node in the execution of the source code, making it difficult to search for a path from the start node to the end node of the source code. The second control flow graph is normalized so that the path from the start node to the end node of the source code has a linear structure, allowing for efficient path searching.
[0027] The search unit 114 searches for path patterns from the start node to the end node in the second control flow graph. In the process of searching for path patterns, the search unit 114 determines whether or not the constraint conditions of the branch nodes included in the path pattern are met. The search unit 114 stops searching for path patterns that it determines do not meet the constraint conditions and excludes those path patterns from the search target. Specifically, the constraint conditions include constraint expressions, and the transition destination from a branch node to the next node is determined by determining the truth value of these constraint expressions. Here, when searching for path patterns in the forward direction (from the start node to the end node), there may be cases where, upon reaching a branch node, a transition to some or all of the candidate nodes for the transition destination is not possible. In this case, the search unit 114 stops searching for path patterns that include nodes that are not valid as transition destinations and excludes those path patterns from the search target, for example by using a data dependency graph or SMT structure, which will be described later. If the search unit 114 determines that the constraint conditions are met, it continues searching for paths that can reach the end node. The search unit 114 generates multiple path patterns that reach the end node through the search and stores them in the second repository 122.
[0028] Specifically, the search unit 114 generates a data dependency graph while searching for path patterns. The data dependency graph is data that graphs the dynamic changes in values due to the execution results of control commands for each node included in the path pattern. Based on this data dependency graph, the search unit 114 can determine, at the point of reaching a branch node, which nodes cannot be considered as destinations (nodes that do not satisfy the constraint conditions) based on the data dependency graph at that branch node.
[0029] More specifically, the search unit 114 converts the processing instructions of each node included in the path pattern into an SSA (Static Single Assignment) structure, and then into an SMT (Satisfiability Modulo Theories) structure. An SSA is one of the intermediate representations in compiler design, defined so that each variable is assigned only once. An SMT is an extension of the satisfiability problem of propositional logic into the context of advanced mathematical theory. Specifically, the search unit 114 converts each processing instruction into an SSA structure. The search unit 114 converts to an SMT structure based on multiple SSA nodes corresponding to the SSA structures included in the path pattern.
[0030] The case determination unit 115 determines the path patterns that have reached the end node through the search as test cases and stores them in the second repository 122. In this embodiment, unreachable path patterns are eliminated in advance, significantly reducing the cost of the search and enabling efficient generation of test cases.
[0031] The input data generation unit 116 generates input data corresponding to each test case and stores it in the second repository 122. Specifically, the input data generation unit 116 selects input data items based on the data dependency graph generated along with the path search. For example, at a branch node, it selects multiple input data items necessary to establish each branch. Based on the input data items and the test case, the input data generation unit 116 generates specific parameters as input data necessary to establish the test case from the start node to the end node. These test cases and input data can be used as test data after the migration of the target program.
[0032] 4. Test support methods Figure 3 shows the processing flowchart of the test support method. The test support method is implemented by each functional component of the test support device 100.
[0033] In step S101 (source code acquisition step), the test support device 100 acquires the source code via the user terminal 200 and stores it in the first repository 121. In process S102 (graph generation process), the test support device 100 generates a first control flow graph by syntactically analyzing the source code. In process S103 (normalization process), the test support device 100 normalizes the first control flow graph and generates a second control flow graph. In process S104 (search process), the test support device 100 searches for a path pattern from the start node to the end node in the second control flow graph. In the process of searching for a path pattern, if the test support device 100 determines that the constraint conditions are met, it continues searching for a path that can reach the end node and generates multiple path patterns that reach the end node. In the process of searching for a path pattern, the test support device 100 stops searching for a path pattern that does not satisfy the constraint conditions of the branch nodes included in that path pattern and excludes that path pattern from the search target. In process S105 (case determination process), the test support device 100 determines the path pattern that reached the end node through the search in process S104 as a test case and stores it in the second repository 122. In process S106 (input data generation process), the test support device 100 generates input data corresponding to each test case and stores it in the second repository 122.
[0034] 5.Normalization part The specific processing of the normalization unit 113 will be described in detail with reference to Figures 4 to 6. In Figures 4 to 6, graphs G101 to G109 show the first control flow graph. Graphs G201 to G209 show the second control flow graph corresponding to graphs G101 to G109. Also, in Figures 4 to 6, nodes are shown as circular shapes and edges as solid lines.
[0035] In this embodiment, the first control flow graph generated based on the COBOL source code has a nonlinear execution procedure for nodes, making path searching difficult. Factors contributing to this nonlinear graph structure include the inclusion of special control instructions such as call instructions (PERFORM) and jump instructions (GOTO) in the COBOL source code, which do not return to the original instruction after transitioning to a predetermined instruction within the program, and the lack of explicit keywords indicating the end of branch instructions (such as IF). Therefore, the first control flow graph generated directly from the COBOL source code has a nonlinear structure because it cannot structure the connection relationships. The normalization unit 113 can generate a second control flow graph that is linearly normalized from such a nonlinear first control flow graph.
[0036] As shown in Figure 4, the execution procedure of the nodes in graph G101 is nonlinear, making pathfinding difficult. The normalization unit 113 first generates the start node N201 and the end node N202 in graph G201.
[0037] Graph G102 has a main section node N101. The normalization unit 113 generates a section start node N203 and a section end node N204 corresponding to the main section node N101, and connects the start node N201 and the section start node N203 with an edge.
[0038] Graph G103 has a control instruction list node N102 connected to the main section node N101. Specifically, the control instruction list node N102 represents a set list of STATEMENTs, which are the smallest units of COBOL control instructions. Graph G103 has control instruction nodes N103 to N105 corresponding to each control instruction included in the set list of the control instruction list node N102, and these nodes are connected to the control instruction list node N102 by edges. The numbers of the control instruction nodes N103 to N105 represent the execution order of the processing instructions. The normalization unit 113 generates control instruction nodes N205 to N207 corresponding to these control instruction nodes N103 to N105 and connects them sequentially to the section start node N203 by edges according to the execution order of the control instructions.
[0039] The control instruction list node N102 may have nodes related to special control instructions that are distinct from general control instructions (control instruction nodes N103 to N105). In this embodiment, special control instructions include, but are not limited to, branch instructions (such as IF), call instructions (such as PERFORM), jump instructions (such as GOTO), and termination instructions (GOBACK).
[0040] Graph G104 includes a call command node N106 related to a call command and a section node N107 related to section SEC101 which is called by the call command. After completing the control commands for section SEC101, graph G104 executes the control commands of the control command node N108 that follows the call command node N106. A call command is an instruction statement that calls a predetermined section to which the user will transition and executes the control commands in that section. The normalization unit 113 generates a corresponding call command node N208, a section start node N209 indicating the start of a call, and a section end node N210 indicating the end of a call, based on the call command node N106 included in the first control flow graph (graph G104). The normalization unit 113 connects the node immediately preceding the call command (section start node N203 in the illustrated example) to the call command node N208, and connects the call command node N208 to the section start node N209 of the called node. The normalization unit 113 places a node corresponding to the processing within the call command (section SEC201) between the section start node N209 and the section end node N210 and connects them. Furthermore, the normalization unit 113 can generate a second control flow graph (graph G204) corresponding to the first control flow graph (graph G104) which includes the call command node, by connecting the called section end node N210 to the control command node N211 which corresponds to the control command node N108.
[0041] Graph G105 has a jump instruction node N109 related to a jump instruction. A jump instruction is an instruction that transitions control to a specified section or paragraph. In the illustrated example, the jump instruction node N109 has the section ID of the main section node N101 as the section to which it transitions (jumps). In this case, the procedure for graph G105 is to execute the jump instruction node N109 and then execute the control instruction node N108, which is a control instruction that follows the call instruction node N106 of the main section. The normalization unit 113 generates a jump instruction node N212 in the second control flow graph that corresponds to the jump instruction node N109 in the first control flow graph. The normalization unit 113 generates graph G205 by connecting the jump source node N209, located immediately before the jump instruction node N212, the jump instruction node N212, and the jump destination node or the jump source section end node N210. As shown in the illustrated example, if the jump source section (section start node N209) and the jump destination section (section start node N203) are different, the normalization unit 113 generates graph G205 by connecting the jump instruction node N212 and the section end node N210, and then connecting the section end node N210 to the jump destination node N211, which corresponds to the section or paragraph specified by the jump instruction. In other words, even if another control instruction node N213 (corresponding to control instruction node N110 in graph G105) exists within the section of jump instruction node N212, it is possible to generate a graph that skips that control instruction and transitions to the specified node or section.
[0042] Graph G106 has a termination instruction node N111 related to a termination instruction. A termination instruction indicates an instruction that terminates the program. The normalization unit 113 generates a corresponding termination command node N214 based on the termination command node N111 of the first control flow graph. The normalization unit 113 generates a second control flow graph (graph G206) by connecting the generated termination command node N214 and the termination node N202.
[0043] Graph G107 has a branch node N112 related to a branch instruction. Graph G107 also has control instruction nodes N103, N104, N105, N113, and N114, and shows a procedure in which control instruction nodes N103, N104, and N105 are executed in order, and then either control instruction node N113 or N114 is executed depending on the branch condition of branch node N112. The normalization unit 113 generates a branch start node N216 indicating the start of a branch and a branch end node indicating the end of a branch, based on the branch node N112 of the first control flow graph. The normalization unit 113 generates control command nodes N218 and N219 in the second control flow graph (G207), which correspond to the control command nodes N113 and N114, which are the first nodes of each branch path branching from branch node N112 in the first control flow graph (G107), and connects them to the branch start node N216. Furthermore, by connecting the last node of each branch path (control command nodes N218 and N219 in the illustrated example) to the branch end node N217, the normalization unit 113 generates a second control flow graph (G207) having a linear structure.
[0044] When the normalization unit 113 completes the normalization process up to the last node of the main section, it connects that last node to the section end node N204. Furthermore, when the normalization unit 113 completes the normalization process up to the last section in the source code, it connects the section end node N204 of the last section to the end node N202.
[0045] According to the processing of the normalization unit 113 described above, a non-linear first control flow graph can be normalized and a linear second control flow graph can be generated.
[0046] 6.Exploration Department Next, the specific processing of the search unit 114 will be described in detail with reference to Figures 7 to 9. The search unit 114 searches for a path from the start node to the end node in the normalized second control flow graph and generates multiple path patterns that can reach the end node. In this embodiment, the path patterns represent patterns based on each path that branches off from the branching nodes included in the second control flow graph.
[0047] In Figure 7(a), the second control flow graph G300 has nodes N301 to N308. Of these, nodes N301, N302, and N304 represent branching nodes where the path branches based on branching conditions. In the illustrated example, the branching node branches into different paths depending on whether the branching condition is true "T" or false "F". Note that the branching condition is not limited to a binary branch of true or false, but may also be a branch with three or more values.
[0048] The search unit 114 extracts branch information, including branch nodes, branch conditions, and branch condition expressions, from the second control flow graph G300. Figure 7(b) shows an example of the data structure of the branch information. A branch node has one or more branch conditions. A branch condition expression is a condition expression that represents one or more branch conditions.
[0049] As shown in Figure 7(c), the search unit 114 generates multiple path patterns from the start node to the end node based on the second control flow graph and branching conditions. In the illustrated example, the control flow graph G300 generates four path patterns according to each branching condition. For example, path 1-1 shows a path pattern where branching nodes N301 and N304 are true, and the path goes through branching node N301, node N303, branching node N304, nodes N307 and N308. Figure 7(d) shows the detailed branching condition values for the path pattern. According to this, path 1-1 has multiple truth values for branching conditions A and B included in the branching node. In the illustrated example, path 1-1 indicates that branching condition A is true, branching condition B is true, and branching condition D is true.
[0050] In this embodiment, the search unit 114 achieves efficient path pattern searching by discontinuing the search for path patterns that do not satisfy the constraints (branching conditions) of branching nodes during the process of searching for path patterns. Figure 8 shows an overview diagram of the search discontinuation determination. The second control flow graph G400 in Figure 8 has nodes N401 to N410. Of these nodes, nodes N401, N404, and N407 represent branching nodes, and branch to the destination node based on the truth value (T / F) of the branching condition.
[0051] First, the search unit 114 searches in a forward direction for paths that can reach the starting node N401 to the ending node N410. For example, as shown in Figure 8(a), the search unit 114 starts the search from the starting node N401 and generates a data dependency graph while searching for paths of path patterns in the order of nodes N402, N404, N405, and N407. Figure 8(b) shows the constraints (branching conditions) for nodes N401, N402, N404, and N407. According to the searched path in Figure 8(a), since nodes N401 and N404 both selected true (T) and transitioned, the data dependency graph at the point of reaching node N407 has accumulated all of the constraints "w1<5", "w2=w1-db1", and "db1>0", which represent the history of variable processing. Mathematically working backward from the context of these accumulated data dependency graphs, the range of possible values for the variable w2 when reaching node N407 is "w2 < 5". On the other hand, the true (T) branching condition for node N407 is defined as the constraint equation "w2 > 10", as shown in Figure 8(b). Therefore, it is determined that the constraint equation of the data dependency graph and the true branching condition for node N407 cannot logically be satisfied at the same time. The search unit 114 can, in accordance with this determination, stop searching for a path transitioning from node N407 to node N408 and exclude that path pattern from the search target.
[0052] When the search for a path from node N407 to node N408 is terminated, the search unit 114 continues searching for another path, the path from node N408 to node N409, as shown in Figure 8(c), and reaches the final node N410. In this way, by searching for a path while generating a data dependency graph, it is possible to eliminate the search for paths that are determined not to satisfy the constraints at an early stage and reduce the search cost.
[0053] Figure 9 is a schematic diagram of the dynamic route pattern generation method. In the generation method according to this embodiment, route patterns can be efficiently generated by performing dynamic early elimination of routes based on the data dependency graph described in Figure 8 during the process of executing the route search shown in Figure 9. The second control flow graph G600 in Figure 9 is the same as the second control flow graph G600 in Figure 7(a).
[0054] First, as shown in Figure 9(a), the search unit 114 determines one path that can reach the end node N608 from the start node (branch node) N601 in the second control flow graph G600. This generates path pattern 1-1, which consists of the paths of nodes N601, N603, N604, N607, and N608. Next, as shown in Figure 9(b), the search unit 114 searches the generated path pattern 1-1 in reverse from the termination node N608 to identify the branch node N604 closest to the termination node N608, and deletes the already searched path from that branch node N604 to the termination node N608. If there is only one node that can be connected from the branch node N604, the search unit 114 updates the branch node N604 as a normal node. If there are multiple nodes that can be connected from the branch node N604, the search unit 114 performs a search on any of them, determines one path that can reach the termination node N608, and then repeats the process described above. As shown in Figure 9(c), the search unit 114 searches for unexplored reachable paths from node N604, which has been updated to a normal node, to the termination node N608. This allows the search unit 114 to generate a new path pattern 2-1 using the paths of nodes N601, N603, N604, and N608. As shown in Figure 9(d), the search unit 114 deletes the path from the last branch node N601 to the termination node N608 in the generated path pattern 2-1. If there is only one node that can be connected from branch node N601, the search unit 114 updates branch node N601 as a normal node. As shown in Figure 9(e), the search unit 114 generates a new path pattern by searching for a path that can reach the normal node N601 to the termination node N608. By repeating the process described above, the search unit 114 can comprehensively generate multiple path patterns in the second control flow graph G600.
[0055] The search unit 114 can search for path patterns while generating a data dependency graph in the search method shown in Figure 9. The search unit 114 generates a data dependency graph for the path to a predetermined node and stores it in the second repository 122. After searching for path patterns that can reach the end node, the search unit 114 returns to the last branch node and, when searching for unexplored paths, can efficiently perform path searching based on the data dependency graph by referring to the data dependency graph up to that branch node stored in the second repository 122.
[0056] 7. Transformation process in constraint condition determination Next, the process by which the search unit 114 determines specific constraint conditions using SSA and SMT structures will be explained. In the process of searching for a path in the second control flow graph, the search unit 114 converts the processing instructions of each node included in the path pattern into an SSA structure. The search unit 114 can convert the processing instructions of the source code into the corresponding SSA structure by referring to an SSA conversion table that defines the corresponding SSA structure for each processing instruction. Furthermore, for source code in which the same variable is assigned multiple times, the search unit 114 generates an SSA structure as an intermediate representation format in which a different index is assigned to the variable for each processing instruction, so that each variable is processed only once.
[0057] The search unit 114 converts the generated SSA structure processing instructions into SMT structure mathematical formulas (equations) that can be interpreted as propositional logic equations. The search unit 114 can convert an SSA structure to a corresponding SMT structure by referring to an SMT conversion table that defines the corresponding SMT structure for each SSA structure. Furthermore, the search unit 114 repeatedly performs SMT conversion each time a node is transitioned as part of the path pattern search, thereby representing a set of processing instructions for multiple nodes on the path as an SMT structure representing a series of simultaneous equations.
[0058] The search unit 114 determines constraints by deriving a theoretical understanding of the SMT structure based on the data dependency graph generated along with the search for path patterns and the SMT structure. Specifically, the search unit 114 searches for paths while accumulating mathematical formulas for the SMT structure, and when it reaches a branch node, it applies the analysis results of the data dependency graph generated in parallel (such as the range of variables) to the mathematical formulas for the SMT structure. The search unit 114 can derive a theoretical understanding of the SMT structure, in which variables have been interpolated based on the data dependency graph, using an SMT solver. In the derivation of the theoretical understanding, if it is determined that there is no theoretical understanding that satisfies both the range of values derived from the dependency relationships of variables in the search process and the branching conditions (constraint formulas) of the branch path to which the user intends to transition at that branch node (i.e., it does not satisfy), the search unit 114 stops searching for path patterns after that branch node and excludes that path pattern from the search target. Furthermore, if the search unit 114 determines that a logical understanding exists (is valid), it can continue searching for the path pattern, assuming that the constraints of the branch node are satisfied.
[0059] Figure 10 is an overview diagram illustrating specific examples of SSA and SMT conversion by the search unit 114. Figure 10 illustrates an example of converting source code C100 to SSA structure C200 and SMT structure C300. The illustrated example focuses on processing instructions related to the input variables IN_X and IN_Y, and the internal variables WK_X and WK_Y. C101, C102, C103, and C104 of source code C100 correspond to nodes N501, N502, N503, and N504 of the SSA structure, respectively.
[0060] When the search unit 114 reaches the first node N501, it converts the processing instructions contained in node N501 into the following SSA expression by referring to the SSA conversion table. WK_X(1) = IN_X(1) + IN_Y(1) WK_Y(1) = IN_X(1) - IN_Y(1) Furthermore, the generated SSA formulas are dynamically converted into formulas for the corresponding SMT structures and stored.
[0061] The search unit 114 searches for the next path and reaches a branch node containing a branch condition (an IF statement representing WK_X>0). At this time, the search unit 114 converts the true branch condition set at that branch node into an SSA expression "WK_X(1)>0" which inherits the index representing the state (value) of the variable WK_X at the time that node was reached on that path.
[0062] Furthermore, upon reaching a branch node, the following series of SMT constraint equations are constructed by combining the constraints of the initial input values (IN_X(1), IN_Y(1)) obtained from the data dependency graph along the traversed path, with the accumulated SMT structure equations and the branching conditions for transitioning to the true side. WK_X(1) = IN_X(1) + IN_Y(1) WK_Y(1) = IN_X(1) - IN_Y(1) WK_X(1) > 0 Furthermore, if we are searching for the false path (the path from branch node N501 to node N503), the last equation of the series of SMT constraints is constructed as "WK_X(1)≦0".
[0063] The search unit 114 uses an SMT solver to derive the possibility of a logical understanding of the constructed SMT constraint equation. For example, if a relationship where WK_X(1)=0 is determined by the combination of input values determined from the data dependency graph on the path already traversed, and there is no logical understanding that satisfies the true branching condition "WK_X(1)>0", the SMT solver will obtain a solution indicating non-satisfaction. If the search unit 114 obtains such a solution indicating non-satisfaction, it can determine that the path pattern proceeding from branching node N501 to node N502, which branches off to the true side, is logically impossible, and can stop searching for that path pattern.
[0064] The disclosures herein include the following test support systems, apparatus, methods, and programs.
[0065] (Item 1) A graph generation unit that generates a first control flow graph by parsing the source code; a normalization unit that normalizes the first control flow graph and generates a second control flow graph; and a search unit that, in the process of searching for path patterns from a start node to an end node in the second control flow graph, determines whether or not the constraint conditions of the branch nodes included in the path pattern are met, and stops searching for path patterns that do not meet the constraint conditions. A test support system comprising: a case determination unit that determines a path pattern reached to the termination node by the aforementioned search as a test case. (Item 2) The test support system according to item 1, wherein the search unit searches for a path in the reverse direction from the end node in the second control flow graph, identifies the branch node closest to the end node, deletes the already searched path from the branch node to the end node, and searches for an unsearched path from the branch node to the end node to generate the plurality of path patterns. (Item 3) The test support system according to item 1 or item 2, wherein the search unit generates a data dependency graph while searching for the path of the path pattern, and if it determines that the constraint conditions are not met based on the data dependency graph at the branch node, it stops searching for the path pattern and excludes the path pattern. (Item 4) The search unit converts the processing instructions for each node included in the path pattern into an SSA structure, then into an SMT structure, and determines the constraint conditions by deriving an understanding of the SMT structure based on the data dependency graph and the SMT structure, as described in item 3. (Item 5) The test support system according to any one of items 1 to 4, wherein the normalization unit generates a branch start node indicating the start of a branch and a branch end node indicating the end of a branch based on the branch nodes of the first control flow graph, connects the first node of each branch path branching from the branch node to the branch start node, and connects the last node of each branch path to the branch end node to generate the second control flow graph having a linear structure. (Item 6) The normalization unit generates a call command node in the second control flow graph, a section start node indicating the start of a call, and a section end node indicating the end of a call, based on the call command node included in the first control flow graph, connects the node immediately preceding the call command node to the section start node via the call command node, and connects nodes corresponding to the processing within the call command between the section start node and the section end node to generate the second control flow graph, thereby generating the second control flow graph, according to any one of items 1 to 5. (Item 7) The normalization unit generates the second control flow graph by connecting the jump source node or section, the jump instruction node, and the jump destination node or section, based on the jump instruction nodes included in the first control flow graph, according to any one of items 1 to 6 of the test support system. (Item 8) The normalization unit generates the second control flow graph by connecting the termination command node and the termination node, based on the termination command node included in the first control flow graph, according to any one of items 1 to 7 of the test support system. (Item 9) The normalization unit generates the second control flow graph by connecting one or more general instruction nodes included in the instruction list included in the first control flow graph with the preceding node, according to any one of items 1 to 8 of the test support system. (Item 10) A test support method comprising: a graph generation step in which a computer generates a first control flow graph by parsing source code; a normalization step in which the computer normalizes the first control flow graph and generates a second control flow graph; a search step in which, in the process of searching for path patterns from a start node to an end node in the second control flow graph, the computer determines whether or not the constraint conditions of the branch nodes included in the path pattern are met and stops searching for path patterns that do not meet the constraint conditions; and a case determination step in which the path patterns that have reached the end node through the search are determined to be test cases. (Item 11) A test support program that causes a computer to execute the test support methods described in item 10.
[0066] This disclosure is not limited to the embodiments described above, and various modifications, improvements, and variations are possible without departing from the spirit and scope of this disclosure. [Explanation of Symbols]
[0067] 1. Test support system 100 Test Support Devices 110 processors 111 Source Code Acquisition Section 112 Graph Generation Unit 113 Normalization section 114 Search Department 115 Case Decision Section 116 Input Data Generation Unit 120 memory 121 First Repository 122 Second Repository 130 Communication Interfaces 200 user terminals 210 processors 220 memory 230 Communication Interfaces 240 Input Interfaces 250 output interfaces
Claims
1. A graph generation unit generates a first control flow graph by parsing the source code, A normalization unit that normalizes the first control flow graph and generates a second control flow graph, In the process of searching for a path pattern from a start node to an end node in the second control flow graph, the search unit determines whether or not the constraint conditions of the branch nodes included in the path pattern are met, and stops searching for path patterns that do not meet the constraint conditions. A test support system comprising: a case determination unit that determines a path pattern reached to the termination node by the aforementioned search as a test case.
2. The test support system according to claim 1, wherein the search unit searches for a path in the reverse direction from the end node in the second control flow graph, identifies the branch node closest to the end node, deletes the already searched path from the branch node to the end node, and searches for an unsearched path from the branch node to the end node to generate the plurality of path patterns.
3. The test support system according to claim 1 or 2, wherein the search unit generates a data dependency graph while searching for the path of the path pattern, and if it determines that the constraint conditions are not met based on the data dependency graph at the branch node, it stops searching for the path pattern and excludes the path pattern.
4. The test support system according to claim 3, wherein the search unit converts the processing instructions for each node included in the path pattern into an SSA structure, then into an SMT structure, and determines the constraint conditions by deriving an understanding of the SMT structure based on the data dependency graph and the SMT structure.
5. The normalization unit generates a branch start node indicating the start of a branch and a branch end node indicating the end of a branch, based on the branch node of the first control flow graph. The test support system according to claim 1 or 2, which generates the second control flow graph having a linear structure by connecting the first node of each branch path branching from the branch node to the branch start node and connecting the last node of each branch path to the branch end node.
6. The normalization unit generates a call command node in the second control flow graph, a section start node indicating the start of a call, and a section end node indicating the end of a call, based on the call command node included in the first control flow graph. The test support system according to claim 1 or 2, wherein the node immediately preceding the call command node is connected to the section start node via the call command node, and the node corresponding to the processing within the call command is placed and connected between the section start node and the section end node to generate the second control flow graph.
7. The test support system according to claim 1 or 2, wherein the normalization unit generates the second control flow graph by connecting the jump source node, the jump instruction node, and the jump destination node or the section end node of the jump source, based on the jump instruction nodes included in the first control flow graph.
8. The test support system according to claim 1 or 2, wherein the normalization unit generates the second control flow graph by connecting the termination command node and the termination node based on the termination command node included in the first control flow graph.
9. The test support system according to claim 1 or 2, wherein the normalization unit generates the second control flow graph by connecting one or more general instruction nodes included in the instruction list included in the first control flow graph with the preceding node.
10. Computers A graph generation process that generates a first control flow graph by parsing the source code, A normalization step that normalizes the first control flow graph and generates a second control flow graph, In the process of searching for a path pattern from the start node to the end node in the second control flow graph, the search process includes determining whether or not the constraint conditions of the branch nodes included in the path pattern are met, and stopping the search for path patterns that do not meet the constraint conditions. A case determination step, in which a path pattern that reaches the termination node through the aforementioned search is determined as a test case, and a test support method, which is executed.
11. A test support program that causes a computer to execute the test support method described in claim 10.
Citation Information
Patent Citations
Sequence diagram creation device, sequence diagram creation method, and computer program
JP2009295021A
Software module test method and system
JP2011248887A
Software test apparatus and software test program
JP2016115175A
Stub object determination device, method, and program
JP2017041196A
Method and apparatus for performing testing using test cases
JP2020510925A
