Test case generation method and system based on finite-state machine homomorphic graph

Through the test case generation method based on finite state machine homomorphic graph, the problems of high investment in software testing resources and low test coverage in the existing technology are solved, and efficient and low-cost test case generation and software test coverage are achieved. .

CN119473891APending Publication Date: 2025-02-18BEIJING SHENZHOU AEROSPACE SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411559419.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the prior art, software testing requires high resource investment, high cost of building and maintaining the test environment, and manual testing depends on experience and assumptions, resulting in low test coverage.

Method used

The test case generation method based on finite state machine homomorphic graph is adopted, and the test case generation module is automatically generated to improve the test coverage through finite state machine graph generation module, homomorphic graph generation module, test path generation module and test case generation module.

Benefits of technology

Reduces testing costs, increases test coverage, generates test cases more efficient, and enables more comprehensive testing of software projects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473891A_ABST
    Figure CN119473891A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software testing, and discloses a test case generation method and system based on a finite-state machine homomorphic graph, and the method comprises the steps: importing a source file of a to-be-tested project into a preset test engine, and generating a finite-state machine graph corresponding to a function state change relation in the source file of the to-be-tested project; obtaining a finite-state machine homomorphic graph based on information in the finite-state machine graph; traversing the homomorphic graph based on a depth-first search algorithm to generate a test path set connected in series between nodes and edges; and importing the test path set into a test module of a preset test engine, and generating a plurality of test case results of the to-be-tested item. According to the method, the finite-state machine homomorphic graph is constructed, the state transition relation of item functions is more simply and comprehensively represented, the state number is greatly reduced, redundant structures are reduced, the test path set obtained by traversing the homomorphic graph through the depth-first search algorithm guarantees generation of multiple test cases, and the test efficiency is improved. And the test coverage rate of the software project is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and in particular to a test case generation method and system based on a finite state machine homomorphic graph. Background Art

[0002] In the prior art, simulation and manual testing are used for software testing. For simulation testing, the construction and maintenance of the test environment requires a lot of resources. The test tools, hardware resources and manpower investment greatly increase the overall cost, sometimes even increasing to half of the software development cost. For manual testing, since the test environment, input parameters, and test case structure are all obtained manually and rely on the experience and assumptions of the developers, potential problems cannot be fully tested and the test coverage is low. Summary of the invention

[0003] In view of this, the present invention provides a test case generation method and system based on a finite state machine homomorphic graph to solve the problem of how to improve the coverage of software project testing under low-cost development conditions.

[0004] In a first aspect, the present invention provides a test case generation method based on a finite state machine homomorphic graph, the method comprising:

[0005] Importing the source file of the project to be tested into the finite state machine graph generation module of the preset test engine, generating a finite state machine graph corresponding to the function state change relationship in the source file of the project to be tested;

[0006] Based on the information in the finite state machine graph, a corresponding finite state machine homomorphic graph is obtained;

[0007] Based on the depth-first search algorithm, the homomorphic graph is traversed to generate a set of test paths connected in series between nodes and edges;

[0008] The test path set is imported into the test module of the preset test engine to generate multiple test case results for the project to be tested.

[0009] The embodiment of the present invention automatically generates a finite state machine diagram corresponding to the function state change relationship by importing the source file of the project to be tested into the finite state machine diagram generation module of the preset test engine. By constructing a finite state machine homomorphic graph, the state transition relationship of the project function is more simply and comprehensively represented, thereby removing redundant states, simplifying the state machine structure, and greatly reducing the number of states. The homomorphic graph structure can effectively improve the search and generation efficiency of test cases. By traversing the homomorphic graph using a depth-first search algorithm, a set of test paths between nodes and edges can be generated at one time, and then multiple test cases can be generated, which greatly improves the test coverage rate. Compared with the method of formulating test cases based on artificial experience, the generation process of test cases based on the finite state machine homomorphic graph will be more efficient. The generation of the homomorphic graph in this embodiment not only reduces the redundant structure, thereby reducing the overall cost of the test, but also uses the test path set obtained by traversing the homomorphic graph using a depth-first search algorithm to ensure the generation of multiple test cases, which greatly improves the test coverage rate of the software project.

[0010] In an optional implementation, the information in the finite state machine graph includes: a set of nodes, a set of edges, a mapping relationship between the start vertices of the edges, and a mapping relationship between the end vertices of the edges; wherein each node represents a state, and the edge represents a transition relationship between states, and each node and each edge is provided with a corresponding identification symbol;

[0011] Based on the information in the finite state machine diagram, the corresponding finite state machine homomorphic diagram is obtained, including:

[0012] According to the node set, the edge set, the edge start vertex mapping relationship, the edge end vertex mapping relationship, and the identifier corresponding to each node and each edge, all nodes are traversed to determine the homomorphic node mapping relationship; wherein the homomorphic node mapping relationship represents the mapping relationship between each node and the corresponding homomorphic node;

[0013] According to the identification symbols corresponding to each node and each edge, the homomorphic node mapping relationship, the starting vertex mapping relationship of the edge, and the ending vertex mapping relationship of the edge are queried to obtain the homomorphic node set, the homomorphic edge set, the starting vertex mapping relationship of the homomorphic edges, and the ending vertex mapping relationship of the homomorphic edges; according to the homomorphic node set, the homomorphic edge set, the starting vertex mapping relationship of the homomorphic edges, and the ending vertex mapping relationship of the homomorphic edges, the homomorphic graph of the finite state machine graph is generated.

[0014] The embodiment of the present invention utilizes a finite state machine graph node set, an edge set, an edge start vertex mapping relationship, and an edge end vertex mapping relationship to perform a one-time node traversal, and can efficiently and quickly determine the isomorphic node corresponding to each node. In the process of generating a isomorphic graph, the redundancy of state nodes is reduced by traversing the node set and determining the mapping relationship of the isomorphic nodes. Compared with the testing process based on the original state machine graph in the prior art, the isomorphic graph generated by this implementation aggregates all similar node states, reduces the number of states, and thus improves the computational efficiency of subsequent test case generation.

[0015] In an optional implementation, according to the node set, the edge set, the edge start vertex mapping relationship, the edge end vertex mapping relationship, and the identifier corresponding to each node and each edge, all nodes are traversed to determine the homomorphic node mapping relationship, specifically including:

[0016] According to the node set or edge set, combined with the edge start vertex mapping relationship, edge end vertex mapping relationship, each node and each edge corresponding identification symbol, calculate the out-degree information and in-degree information of each node in the node set;

[0017] Traverse the out-degree information and in-degree information of each node in the node set to determine the homomorphic node of each node;

[0018] The homomorphic node mapping relationship is determined according to each node and the corresponding homomorphic node.

[0019] The embodiment of the present invention, by traversing the node set and the edge set, combined with the starting and ending vertex mapping relationship and identification symbols, can accurately determine the network structure characteristics of each node, and further reflect the connection relationship between the nodes. This implementation method can narrow the range of nodes that need to be processed by first calculating the out-degree and in-degree information. That is to say, when each node is found, it is only necessary to compare the out-degree and in-degree information of the current node and other nodes, and determine the out-degree information and in-degree information first, thereby avoiding repeated traversal of the entire graph. When generating a homomorphic mapping relationship, it not only improves the computational efficiency of the algorithm.

[0020] In an optional implementation, the out-degree information includes out-degree neighbor nodes, and the in-degree information includes in-degree neighbor nodes;

[0021] According to the node set, combined with the edge start vertex mapping relationship, edge end vertex mapping relationship, and the identifier corresponding to each node and each edge, the out-degree information and in-degree information of each node in the node set are calculated, including:

[0022] Traverse each node in the node set, wherein when traversing to the current node, query the starting vertex mapping relationship of the edge according to the identifier of the current node to obtain the current out-degree edge corresponding to the current node, and query the ending vertex mapping relationship of the edge according to the identifier of the out-degree edge to obtain the out-degree neighbor node of the current node; query the ending vertex mapping relationship of the edge according to the identifier of the current node to obtain the current in-degree edge corresponding to the current node, and query the starting vertex mapping relationship of the edge according to the identifier of the in-degree edge to obtain the in-degree neighbor node of the current node.

[0023] The embodiments of the present invention use the mapping relationship of the starting vertices and the ending vertices of the edges instead of directly traversing the set of edges, which can reduce the complexity of the algorithm. When the number of nodes and edges is large, it is equivalent to avoiding repeated global traversals and can reduce the time required for calculation. The use of identification symbols makes it easy to quickly search between each node and edge, which can improve the algorithm efficiency of generating homomorphic mapping relationships.

[0024] In an optional implementation, the out-degree information includes an out-degree matrix, and the in-degree information includes an in-degree matrix;

[0025] According to the edge set, combined with the edge start vertex mapping relationship, the edge end vertex mapping relationship, each node and the identifier corresponding to each edge, the out-degree information and in-degree information of each node in the node set are calculated, including:

[0026] Traverse the edge set, use the identifier of each edge to query the mapping relationship of the starting vertex and the ending vertex of the edge, and determine the adjacency matrix of the finite state machine graph;

[0027] Determine the out-degree matrix and in-degree matrix of each node according to the adjacency matrix.

[0028] The embodiment of the present invention calculates the out-degree information and in-degree information of each node through the set of edges, the starting vertex mapping relationship and the ending vertex mapping relationship, and can use identification symbols to facilitate quick search between each node and edge during each traversal, and directly use the characteristics of the adjacency matrix to quickly determine the connection relationship between nodes, reducing unnecessary searches, thereby accelerating the calculation of out-degree and in-degree, and improving the algorithm efficiency of generating homomorphic mapping relationships.

[0029] In an optional implementation, traversing the out-degree information and in-degree information of each node in the node set to determine the homomorphic node of each node specifically includes:

[0030] Traverse each node in the node set, compare the in-degree neighbor nodes corresponding to each node with each other, and compare the out-degree neighbor nodes corresponding to all nodes with each other; if there are one or more nodes with the same in-degree neighbor nodes and out-degree neighbor nodes, the nodes are isomorphic nodes;

[0031] Alternatively, traverse each node in the node set, compare the in-degree matrices corresponding to all nodes with each other, and compare the out-degree matrices corresponding to all nodes with each other; if there are one or more nodes with the same in-degree matrix and out-degree matrix, the nodes are isomorphic nodes.

[0032] The embodiment of the present invention compares the in-degree neighbors and out-degree neighbors, the in-degree matrix and the out-degree matrix of a node. When the in-degree neighbor node and the out-degree neighbor node or the in-degree matrix and the out-degree matrix coincide, the node is determined to be a homomorphic node, thereby being able to quickly confirm the homomorphic mapping relationship and facilitating the reduction of the redundant structure of the state organic graph.

[0033] In a second aspect, the present invention provides a test case generation system based on a finite state machine homomorphic graph, the system comprising:

[0034] A state machine generation module, used to import the source file of the project to be tested into the finite state machine graph generation module of the preset test engine, and generate a finite state machine graph corresponding to the function state change relationship in the source file of the project to be tested;

[0035] A homomorphic graph generation module, used for obtaining a corresponding finite state machine homomorphic graph based on the information in the finite state machine graph;

[0036] A test path generation module is used to traverse the homomorphic graph based on a depth-first search algorithm to generate a set of test paths connected in series between nodes and edges;

[0037] The test case generation module is used to import the test path set into the test module of the preset test engine to generate multiple test case results for the project to be tested.

[0038] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the test case generation method based on the finite state machine homomorphic graph of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0039] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the test case generation method based on a finite state machine homomorphic graph of the above-mentioned first aspect or any corresponding embodiment thereof.

[0040] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, which are used to enable a computer to execute the test case generation method based on a finite state machine isomorphic graph according to the above-mentioned first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the specific implementation of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the specific implementation or the prior art description. Obviously, the drawings described below are some implementations of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0042] Figure 1 is a flow chart of a test case generation method based on a finite state machine homomorphic graph according to an embodiment of the present invention;

[0043] Figure 2 is a finite state machine diagram of a test case generation method based on a finite state machine homomorphic diagram according to an embodiment of the present invention;

[0044] Figure 3 is a homomorphic graph of a test case generation method based on a finite state machine homomorphic graph according to an embodiment of the present invention;

[0045] Figure 4 is a schematic diagram of test case results of a test case generation method based on a finite state machine homomorphic graph according to an embodiment of the present invention;

[0046] Figure 5 is a flow chart of another test case generation method based on a finite state machine homomorphic graph according to an embodiment of the present invention;

[0047] Figure 6 is a flow chart of another test case generation method based on a finite state machine homomorphic graph according to an embodiment of the present invention;

[0048] Figure 7 is a structural block diagram of a test case generation system based on a finite state machine homomorphic graph according to an embodiment of the present invention;

[0049] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0051] The software security issues faced by spacecraft systems are also gradually increasing, and the reliability and robustness of system software are becoming more and more prominent, which will directly affect the system and network security performance. Due to the extremely high security requirements of spacecraft systems, software system problems will not only affect the normal operation of systems, networks, and business functions, but will also cause huge economic losses and even pose a serious threat to the lives of related personnel. How to improve software quality and effectively improve the security and reliability of spacecraft software systems has become an issue that needs to be focused on in the field of aerospace software technology research.

[0052] The main disadvantages of simulation-based testing of spacecraft software in the existing technology are: the construction and maintenance of the test environment requires a lot of resources, including test tools, hardware resources and manpower investment. The core idea is to verify whether the system operation results are consistent with the system design expectations through different parameter combinations under conditions close to the real environment, so as to judge whether the system implementation is successful and usable. The cost of this method has accounted for about half of the total software development cost. Simulation testing can improve testing efficiency through automation, but its effectiveness depends on well-designed test cases and accurate input parameters. If the test case design is not good, it may lead to low coverage and failure to fully discover potential problems.

[0053] Manual testing of spacecraft software relies on the experience and assumptions of developers, and the test environment, input parameters, and use case structure are all set manually. Manual testing is relatively slow and prone to errors when faced with highly repetitive tests, further reducing the correctness of test results and test efficiency.

[0054] According to an embodiment of the present invention, an embodiment of a test case generation method based on a finite state machine homomorphic graph is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0055] In this embodiment, a test case generation method based on a finite state machine homomorphic graph is provided, which can be used for the above-mentioned computer. Figure 1is a flow chart of a test case generation method based on a finite state machine homomorphic graph according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0056] Step S101, importing the source file of the project to be tested into a finite state machine graph generation module of a preset test engine, and generating a finite state machine graph corresponding to the function state change relationship in the source file of the project to be tested.

[0057] Specifically, (1) First, the source files of the C language project to be tested need to be analyzed, and the SeC formal language is used to model the model according to the test content. SeC is a formal specification language specifically used for software testing, which can describe the behavior and properties of the software system. In SeC, it mainly includes main, scenario, model, mediator and other parts. (2) The constructed SeC model is imported into the preset CTESK test engine. Among them, CTESK is an automated testing tool that can automatically construct a finite state machine diagram based on the SeC model. The finite state machine diagram is a graphical representation method used to describe the transition relationship between different states of the system. The CTESK test engine will analyze the states, transition conditions and operations defined in the SeC model, and then automatically generate the corresponding finite state machine diagram G = (V, E, λ, ρ). Among them, V represents the vertex set in the graph, corresponding to each state of the system; E represents the edge set, corresponding to the transition between states; λ is the starting vertex function, and ρ is the ending vertex function. These two functions are used to determine the starting and ending vertices of each edge.

[0058] For example, if the project to be tested is an XX functional module, and the implementation results of this functional module include state A, state B and state C, a total of three states; after modeling using the SeC language, the CTESK test engine will generate a finite state machine diagram containing three vertices (corresponding to three states) and multiple edges (corresponding to different functional operations), laying the foundation for the subsequent test case generation based on the homomorphic graph.

[0059] Step S102, obtaining a corresponding finite state machine homomorphic graph based on the information in the finite state machine graph.

[0060] It should be noted that the homomorphic graph is an abstract graph representation of the original image, which retains the basic structural features of the original image but removes redundant states and transitions.

[0061] Specifically, (1) the implementation can execute a symbolic calculation function to calculate the degree information and neighbor node information of each node in the finite state machine graph. The degree of a node includes the in-degree (i.e., the number of edges pointing to the node) and the out-degree (i.e., the number of edges starting from the node). (2) The degree information and neighbor node information of each node are compared. If two nodes have the same degree information and neighbor node information, they can be mapped as the same node in the homomorphic graph.

[0062] For example, see Figure 2 , the out-degree of node 3 is 1 (the edge pointing to node 1), and the in-degree is 1 (the edge from node 2); Figure 2 , we get the following mapping relationship: {1:1,2:2,3:3 / 4,4:3 / 4,5:5}. The generated homomorphic graph can be referred to Figure 3 , node 3 and node 4 have the same degree information and neighbor node information. Due to the different storage structures of finite state machine graphs, there are usually many repeated mapping structures in finite state machine graphs. Figure 2 The original finite state machine graph G shown includes 5 states 1-5. From the structure of graph G, it can be easily seen that nodes 3 and 4 in the original finite state machine graph G have the same graph structure. This embodiment can effectively reduce the redundant states in the finite state machine graph by generating a finite machine graph isomorphic graph, thereby simplifying the graph structure and reducing the complexity of the test.

[0063] Step S103, traversing the homomorphic graph based on a depth-first search algorithm to generate a set of test paths connected in series between nodes and edges.

[0064] Specifically, (1) an initial node in the homomorphic graph is selected as the starting point, and the node corresponding to the initial state of the original finite state machine graph is selected as the starting point. (2) Starting from this starting point, traverse according to the depth-first principle, wherein an unvisited adjacent node of the current node is preferentially selected, and then moved to the node, and the movement process is recorded and saved. (3) If the current node has no unvisited adjacent nodes, it goes back to the previous node and continues to search for unvisited adjacent nodes until all nodes have been visited or the preset traversal depth limit is reached, and finally a set of all paths is generated. During the traversal process, the movement process of each step (i.e., the corresponding edge) is recorded, including the starting node, the edge passed, and the node reached. The movement process is connected in series to form a test path.

[0065] For example, Figure 3 As shown, one of the complete test paths may be as follows: {1,b1,2,c1,5,b3 / b2,3 / 4,a1 / a2,1}.

[0066] Step S104: import the test path set into the test module of the preset test engine to generate multiple test case results for the project to be tested.

[0067] Specifically, the generated test path set is imported into the test module of the preset test engine to generate actual test cases. Among them, the test case is used to verify whether the function and behavior of the project to be tested meet the expectations. The test case includes input data, expected output and execution conditions, and multiple representative test cases will be generated according to different paths.

[0068] For example, for the path {1, b1, 2, c1, 5, b3 / b2, 3 / 4, a1 / a2, 1}, the test module generates a set of specific inputs and expected outputs to facilitate test execution and result verification. The results of testing based on the test case can be referred to Figure 4 , All Tests Completed Successfully means that all tests have been successfully completed; Scenarios means test scenarios; pqueue_scenario means a specific scenario name; Branch Coverages means branch coverage; start states means the initial state of the test; transitions means state transition; end states means the state at the end of the test; hits means the number of times a specific test case or scenario is executed, which helps testers analyze whether each test case or scenario meets expectations.

[0069] In the embodiment of the present invention, a finite state machine diagram corresponding to the function state change relationship is automatically generated by importing the source file of the project to be tested into the finite state machine diagram generation module of the preset test engine. By constructing a finite state machine homomorphic graph, the state transition relationship of the project function is more simply and comprehensively represented, thereby removing redundant states, simplifying the state machine structure, and greatly reducing the number of states. The homomorphic graph structure can effectively improve the search and generation efficiency of test cases. By traversing the homomorphic graph using a depth-first search algorithm, a test path set between nodes and edges can be generated at one time, and then multiple test cases can be generated, which greatly improves the test coverage rate. Compared with the method of formulating test cases based on artificial experience, the generation process of test cases based on the finite state machine homomorphic graph will be more efficient. The generation of the homomorphic graph in this embodiment not only reduces the redundant structure, thereby reducing the overall cost of the test, but also uses the depth-first search algorithm to traverse the homomorphic graph to obtain a test path set, which ensures the generation of multiple test cases, greatly improving the test coverage rate of the software project.

[0070] In this embodiment, a test case generation method based on a finite state machine homomorphic graph is provided, which can be used for the above-mentioned computer. Figure 5is a flow chart of a test case generation method based on a finite state machine homomorphic graph according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:

[0071] Step S501: Import the source file of the project to be tested into the finite state machine graph generation module of the preset test engine to generate a finite state machine graph corresponding to the function state change relationship in the source file of the project to be tested. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0072] Step S502, obtaining a corresponding finite state machine homomorphic graph based on the information in the finite state machine graph.

[0073] The information in the finite state machine graph includes: a set of nodes, a set of edges, a mapping relationship between the starting vertices of the edges, and a mapping relationship between the ending vertices of the edges; wherein each node represents a state, and the edge represents the transition relationship between states, and each node and each edge is set with a corresponding identification symbol.

[0074] Exemplarily, the finite state machine diagram in step S101 is used as an example for explanation, where V = (1, 2, 3, 4, 5); E = (a1, a2, b1, b2, b3, c1); and the λ function and the ρ function are a set of mapping functions, where λ = {a1:3, a2:4, b1:1, …, c1:2}; ρ = {a1:1, b1:2, …, c1:5}, for example, "a1" and "1" are the identification symbols corresponding to the edges or nodes.

[0075] Specifically, the above step S502 includes:

[0076] Step S5021, traverse all nodes to determine the homomorphic node mapping relationship according to the node set, the edge set, the starting vertex mapping relationship of the edge, the ending vertex mapping relationship of the edge, and the identification symbols corresponding to each node and each edge; wherein the homomorphic node mapping relationship represents the mapping relationship between each node and the corresponding homomorphic node.

[0077] Specifically, the above step S5021 includes:

[0078] a1. According to the node set or edge set, combined with the edge start vertex mapping relationship, edge end vertex mapping relationship, and the identifiers corresponding to each node and each edge, calculate the out-degree information and in-degree information of each node in the node set.

[0079] Furthermore, in this embodiment, a1 may adopt the following two specific implementations including but not limited to:

[0080] Method 1: out-degree information includes out-degree neighbor nodes, and in-degree information includes in-degree neighbor nodes; according to the node set, combined with the starting vertex mapping relationship of the edge, the ending vertex mapping relationship of the edge, and the identification symbols corresponding to each node and each edge, the out-degree information and in-degree information of each node in the node set are calculated, specifically including: (1) traversing each node in the node set, wherein when traversing to the current node, querying the starting vertex mapping relationship of the edge according to the identification symbol of the current node to obtain the current out-degree edge corresponding to the current node, and querying the ending vertex mapping relationship of the edge according to the identification symbol of the out-degree edge to obtain the out-degree neighbor node of the current node; (2) querying the ending vertex mapping relationship of the edge according to the identification symbol of the current node to obtain the current in-degree edge corresponding to the current node, and querying the starting vertex mapping relationship of the edge according to the identification symbol of the in-degree edge to obtain the in-degree neighbor node of the current node.

[0081] For example, in a finite state machine graph, node 1 represents a state, and edge a1 represents a transition relationship. The out-degree information of 1 can be determined by the mapping relationship of the starting vertex of the edge. If edge a1 starts from node 1 and reaches node a2, the out-degree neighbor node of 1 is 2; if 2 can return to 1 through edge a1, the in-degree neighbor node of 2 is 1. By traversing each node and edge using the identifier symbol, in application scenarios with a large number of nodes and edges, the search based on the identifier symbol can reduce the calculation time.

[0082] It is understandable that using the mapping relationship between the starting vertices of the edges and the ending vertices of the edges instead of directly traversing the set of edges can reduce the complexity of the algorithm. When the number of nodes and edges is large, it is equivalent to avoiding repeated global traversals and can reduce the time required for calculation. The use of identification symbols makes it easy to quickly search between each node and edge, which can improve the efficiency of the algorithm for generating homomorphic mapping relationships.

[0083] Method 2: the out-degree information includes the out-degree matrix, and the in-degree information includes the in-degree matrix; according to the edge set, combined with the edge starting vertex mapping relationship, the edge ending vertex mapping relationship, each node and the identification symbol corresponding to each edge, the out-degree information and the in-degree information of each node in the node set are calculated, specifically including: (1) traversing the edge set, using the identification symbol of each edge to query the edge starting vertex mapping relationship and the edge ending vertex mapping relationship, and determine the adjacency matrix of the finite state machine graph; (2) determining the out-degree matrix and the in-degree matrix of each node according to the adjacency matrix.

[0084] Specifically, traverse the set of edges, use the identifier of each edge to query the mapping relationship of the starting vertex and the ending vertex of the edge, determine the adjacency matrix of the finite state machine graph, and update the adjacency matrix according to each traversed edge, including: for each edge, find the corresponding starting vertex u and ending vertex v. M represents the adjacency matrix array, and M[u][v] in the adjacency matrix array is set to 1, and the remaining positions are 0 to indicate that there are no reachable nodes or adjacent edges. Among them, the out-degree matrix indicates that for each node i, the out-degree can be calculated by calculating the number of columns with values ​​1 in the corresponding rows of the node, and the in-degree matrix indicates that for each node jj, the in-degree can be calculated by calculating the number of rows with values ​​1 in the corresponding columns of the node.

[0085] For example, the out-degree matrix of node 3 is (1, 0, 0, 0, 0), and the in-degree matrix is ​​(0, 0, 0, 0, 1). Therefore, the out-degree of node 3 is 1, the in-degree is 1, and it has two neighbor nodes.

[0086] It can be understood that the out-degree information and in-degree information of each node are calculated through the set of edges, the starting vertex mapping relationship and the ending vertex mapping relationship, and the identification symbols can be used in each traversal to facilitate quick search between each node and edge. The connection relationship between nodes can be quickly determined by directly using the characteristics of the adjacency matrix, which reduces unnecessary searches, thereby speeding up the calculation of out-degree and in-degree, and improving the efficiency of the algorithm for generating homomorphic mapping relationships.

[0087] a2, traverse the out-degree information and in-degree information of each node in the node set, and determine the homomorphic node of each node.

[0088] Further, in this embodiment, a2 can adopt the following two specific implementations including but not limited to:

[0089] Method three: traverse each node in the node set, compare the in-degree neighbor nodes corresponding to each node with each other, and compare the out-degree neighbor nodes corresponding to all nodes with each other; if there are one or more nodes with the same in-degree neighbor nodes and out-degree neighbor nodes, the nodes are isomorphic nodes;

[0090] Method 4: traverse each node in the node set, compare the in-degree matrices corresponding to all nodes with each other, and compare the out-degree matrices corresponding to all nodes with each other; if there are one or more nodes with the same in-degree matrix and out-degree matrix, the nodes are isomorphic nodes.

[0091] For example, the in-degree neighbor node of node 3 is 5, and the out-degree neighbor node is 1; the in-degree neighbor node of node 4 is 5, and the out-degree neighbor node is 1; nodes 3 and 4 are mutually isomorphic nodes; the out-degree matrix of node 3 is (1, 0, 0, 0, 0), and the in-degree matrix is ​​(0, 0, 0, 0, 1); the out-degree matrix of node 4 is (1, 0, 0, 0, 0), and the in-degree matrix is ​​(0, 0, 0, 0, 1); nodes 3 and 4 are mutually isomorphic nodes.

[0092] It can be understood that by comparing the in-degree neighbors and out-degree neighbors, the in-degree matrix and the out-degree matrix of a node, when the in-degree neighbor node and the out-degree neighbor node or the in-degree matrix and the out-degree matrix coincide, the node is determined to be a homomorphic node, so that the homomorphic mapping relationship can be quickly confirmed, which is convenient for reducing the redundant structure of the state organic graph.

[0093] a3, determine the homomorphic node mapping relationship based on each node and the corresponding homomorphic node.

[0094] For example, based on the determined homomorphic nodes, a mapping table is generated from each node to its homomorphic node. In the mapping table, each node is mapped to its corresponding homomorphic node. By using the identifier of each node, the corresponding relationship of the node in the mapping table can be found (the homomorphic node includes the current node). Figure 3 The mapping relationship in: {1:1,2:2,3:3 / 4,4:3 / 4,5:5}.

[0095] The embodiment of the present invention, by traversing the node set and the edge set, combined with the starting and ending vertex mapping relationship and identification symbols, can accurately determine the network structure characteristics of each node, and further reflect the connection relationship between the nodes. This implementation method can narrow the range of nodes that need to be processed by first calculating the out-degree and in-degree information. That is to say, when each node is found, it is only necessary to compare the out-degree and in-degree information of the current node and other nodes, and determine the out-degree information and in-degree information first, thereby avoiding repeated traversal of the entire graph. When generating a homomorphic mapping relationship, it not only improves the computational efficiency of the algorithm.

[0096] It can be understood that by analyzing the structural characteristics of the nodes (degree information and neighbor node information), nodes with the same structural characteristics are found, thereby reducing the redundant states in the finite state machine graph, simplifying the structure of the graph, and laying the foundation for the subsequent generation of homomorphic graphs, which helps to improve testing efficiency.

[0097] Step S5022, query the homomorphic node mapping relationship, the starting vertex mapping relationship of the edge, and the ending vertex mapping relationship of the edge according to the identification symbols corresponding to each node and each edge to obtain the homomorphic node set, the homomorphic edge set, the starting vertex mapping relationship of the homomorphic edges, and the ending vertex mapping relationship of the homomorphic edges; generate the homomorphic graph of the finite state machine graph according to the homomorphic node set, the homomorphic edge set, the starting vertex mapping relationship of the homomorphic edges, and the ending vertex mapping relationship of the homomorphic edges.

[0098] Specifically, (1) query the homomorphic node mapping relationship obtained in step S5021 according to the identifier of each node; (2) query the mapping relationship between the starting vertex and the ending vertex of each edge in the original graph according to the identifier of each edge in the original graph, determine the starting vertex and the ending vertex of the edge in the homomorphic graph, and determine the edge in the homomorphic graph based on the above information, wherein, if the starting vertex and the ending vertex of an edge in the original graph are mapped to different nodes in the homomorphic graph, then the edge is retained in the homomorphic graph; if they are mapped to the same node, then the edge is directly merged in the homomorphic graph, which can be referred to Figure 3 The structure of the homomorphic graph. When calculating the homomorphic node mapping relationship, the homomorphic correspondence relationship {1:1, 2:2, 3:3 / 4, 4:3 / 4, 5, 5} is output.

[0099] In actual application, based on the above steps, the homomorphic graph generation algorithm can be referred to Figure 3 In this embodiment, the homomorphic graph generation algorithm is as follows: Initial node v0 = 1, execute identifier symbol calculation φ(v0) = φ(1) = 1 = v0 * , then update the state v1 = 2, and continue to execute the identifier calculation φ(v1) = φ(2) = 2 = v1 * , update state v2 = 3, φ(v2) = φ(3) = 3 / 4, and continue until i = n, generating the homomorphic graph G * .

[0100] Step S503: traverse the homomorphic graph based on the depth-first search algorithm to generate a set of test paths connected in series between nodes and edges. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0101] Step S504: import the test path set into the test module of the preset test engine to generate multiple test case results for the project to be tested. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0102] The embodiment of the present invention utilizes a finite state machine graph node set, an edge set, an edge start vertex mapping relationship, and an edge end vertex mapping relationship to perform a one-time node traversal, and can efficiently and quickly determine the isomorphic node corresponding to each node. In the process of generating a isomorphic graph, the redundancy of state nodes is reduced by traversing the node set and determining the mapping relationship of the isomorphic nodes. Compared with the testing process based on the original state machine graph in the prior art, the isomorphic graph generated by this implementation aggregates all similar node states, reduces the number of states, and thus improves the computational efficiency of subsequent test case generation.

[0103] In the actual application process, the actual operation process of the test case generation method based on the finite state machine homomorphic graph provided by the embodiment of the present invention can be referred to Figure 6 Based on the CTESK test engine, the SeC test project model is first imported into the CTESK test engine to generate the original finite state machine diagram, and then the test sequence generation algorithm of the finite state machine homomorphic graph is used to map the homomorphic graph of the graph according to the original finite state machine diagram, and then a logical test sequence set is generated based on the depth-first search, and finally the logical test sequence set is imported into the CTESK test engine to realize the automatic generation of the test sequence. The use of this algorithm can effectively reduce the redundant states in the finite state machine diagram, thereby improving the test efficiency. Among them, the implementation logic of the test sequence generation algorithm of the finite state machine homomorphic graph in the computer program code is as follows:

[0104] (1) Import the SeC project to be tested into the CTESK engine and generate a finite state machine diagram, where vertices represent states, edges represent state transitions, the initial vertex function returns the starting vertex of the edge, and the terminal vertex function returns the terminal vertex of the edge.

[0105] (2) Calculate the out-degree and in-degree of each node and update the node degree information.

[0106] (3) Calculate the neighbor node information of each node.

[0107] (4) Compare the node's degree information and neighbor node information with other node information: if the information is the same, the node is mapped as the same node; if the information is different, it is mapped as a new node.

[0108] (5) Store node mapping information and output mapping results.

[0109] (6) Starting from the initial state v0 of the finite state machine graph G, determine the initial vertex V0 in the homomorphic graph G*.

[0110] (7) Given a series of generalized symbols x1, x2, …, xn used to traverse G*, and initialize the current state in G* to V0.

[0111] (8) Start generating the homomorphic graph: Initial node v0 = 1, execute the identifier calculation φ(v0) = φ(1) = 1 = v0 * , then update the state v1 = 2, and continue to execute the identifier calculation φ(v1) = φ(2) = 2 = v1 * , update state v2 = 3, φ(v2) = φ(3) = 3 / 4, and so on until i = n, generating a homomorphic graph G*. Specifically: Determine graph G * The only arc e in * ; Determine the automaton input symbol x i ; Input symbol x i To the automaton, generate the path temp=(v0,x1,x2,x3,…,x i ,x i+1 ); if the input symbol x i If there is no terminal state after the automaton, then P * + = temp, input symbol from P * Delete it and roll back to continue execution; otherwise, get the new state v i+1 , satisfying φ(v i+1 )=φ(e * ).

[0112] (9) Traverse the homomorphic graph G*: determine the unique arc in the graph and its corresponding automatic input symbol; send the input symbol to the automaton to generate a path; if the input symbol results in no terminal state, delete the input symbol and roll back to continue execution; otherwise, record the new state and satisfy the corresponding conditions.

[0113] (10) Import the generated test sequence into the CTESK test engine.

[0114] (11) Determine whether the test conditions are met: If the conditions are met, execute recursively; otherwise, output an incorrect conclusion.

[0115] (12) Output the final test report.

[0116] In the prior art, homomorphic graph generation algorithms such as the brute force enumeration method traverse all node combinations of the source graph G to check whether the homomorphic conditions are met. This method has high time complexity and is only suitable for small-scale graphs; the greedy algorithm tries to select the optimal mapping at each step without considering the long-term consequences. This method is highly efficient, but may not be able to find the optimal solution; the SAT / SMT solving algorithm converts the homomorphic graph construction problem into a Boolean satisfiability problem (SAT) or an integer linear programming problem (SMT), and uses an efficient SAT / SMT solver to solve it. This method is difficult to program and is extremely dependent on the selected solver.

[0117] Compared with the above algorithms, this method starts with node degree information and neighbor node information. By comprehensively considering the node degree and neighbor node information, compared with the path selection of brute force enumeration and greedy method, this method generates test logic paths through depth-first search, ensuring higher path coverage. This can not only traverse all critical paths, but also ensure the mapping of important nodes. In contrast, other methods may not be able to traverse all possible paths due to time complexity limitations, and perform poorly when processing large-scale graphs. Accurately select important nodes to improve the accuracy of homomorphic graph mapping, ensure the coverage of key nodes, and reduce the redundant structure of the graph; finally, this method uses depth-first search to realize the generation of test logic paths without relying on the selected solver. This strategy can effectively ensure the coverage of test paths and ensure that all important paths are traversed.

[0118] In this embodiment, a test case generation system based on a finite state machine homomorphic graph is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0119] This embodiment provides a test case generation system based on a finite state machine homomorphic graph, such as Figure 7 As shown, including:

[0120] A state machine generation module 701, used to import the source file of the project to be tested into the finite state machine graph generation module of the preset test engine, and generate a finite state machine graph corresponding to the function state change relationship in the source file of the project to be tested;

[0121] A homomorphic graph generation module 702, used to obtain a corresponding finite state machine homomorphic graph based on the information in the finite state machine graph;

[0122] A test path generation module 703 is used to traverse the homomorphic graph based on a depth-first search algorithm to generate a set of test paths connected in series between nodes and edges;

[0123] The test case generation module 704 is used to import the test path set into the test module of the preset test engine to generate multiple test case results for the project to be tested.

[0124] In some optional implementations, the information in the finite state machine graph includes: a set of nodes, a set of edges, a mapping relationship between the starting vertices of the edges, and a mapping relationship between the ending vertices of the edges; wherein each node represents a state, and the edge represents a transition relationship between states, and each node and each edge are provided with corresponding identification symbols; the homomorphic graph generation module 702 includes:

[0125] A homomorphic mapping relationship generating unit is used to traverse all nodes to determine a homomorphic node mapping relationship according to a node set, an edge set, an edge start vertex mapping relationship, an edge end vertex mapping relationship, and an identifier corresponding to each node and each edge; wherein the homomorphic node mapping relationship represents a mapping relationship between each node and a corresponding homomorphic node;

[0126] A homomorphic graph construction unit is used to query the homomorphic node mapping relationship, the starting vertex mapping relationship of the edge, and the ending vertex mapping relationship of the edge according to the identification symbols corresponding to each node and each edge, to obtain the homomorphic node set, the homomorphic edge set, the starting vertex mapping relationship of the homomorphic edges, and the ending vertex mapping relationship of the homomorphic edges, and to generate a homomorphic graph of the finite state machine diagram according to the homomorphic node set, the homomorphic edge set, the starting vertex mapping relationship of the homomorphic edges, and the ending vertex mapping relationship of the homomorphic edges.

[0127] In an optional implementation, the homomorphic mapping relationship generating unit includes:

[0128] The in-degree information calculation subunit is used to calculate the out-degree information and in-degree information of each node in the node set according to the node set or the edge set, in combination with the mapping relationship of the starting vertices of the edges, the mapping relationship of the ending vertices of the edges, and the identification symbols corresponding to each node and each edge;

[0129] The homomorphic node determination subunit is used to traverse the out-degree information and in-degree information of each node in the node set and determine the homomorphic node of each node;

[0130] The homomorphic mapping determination subunit is used to determine the homomorphic node mapping relationship according to each node and the corresponding homomorphic node.

[0131] In an optional implementation, the out-degree information includes out-degree neighbor nodes, and the in-degree information includes in-degree neighbor nodes;

[0132] According to the node set, combined with the edge start vertex mapping relationship, edge end vertex mapping relationship, and the identifier corresponding to each node and each edge, the out-degree information and in-degree information of each node in the node set are calculated, including:

[0133] Traverse each node in the node set, wherein when traversing to the current node, query the starting vertex mapping relationship of the edge according to the identifier of the current node to obtain the current out-degree edge corresponding to the current node, and query the ending vertex mapping relationship of the edge according to the identifier of the out-degree edge to obtain the out-degree neighbor node of the current node; query the ending vertex mapping relationship of the edge according to the identifier of the current node to obtain the current in-degree edge corresponding to the current node, and query the starting vertex mapping relationship of the edge according to the identifier of the in-degree edge to obtain the in-degree neighbor node of the current node.

[0134] In an optional implementation, the out-degree information includes an out-degree matrix, and the in-degree information includes an in-degree matrix;

[0135] According to the edge set, combined with the edge start vertex mapping relationship, the edge end vertex mapping relationship, each node and the identifier corresponding to each edge, the out-degree information and in-degree information of each node in the node set are calculated, including:

[0136] Traverse the edge set, use the identifier of each edge to query the mapping relationship of the starting vertex and the ending vertex of the edge, and determine the adjacency matrix of the finite state machine graph;

[0137] Determine the out-degree matrix and in-degree matrix of each node according to the adjacency matrix.

[0138] In an optional implementation, traversing the out-degree information and in-degree information of each node in the node set to determine the homomorphic node of each node specifically includes:

[0139] Traverse each node in the node set, compare the in-degree neighbor nodes corresponding to each node with each other, and compare the out-degree neighbor nodes corresponding to all nodes with each other; if there are one or more nodes with the same in-degree neighbor nodes and out-degree neighbor nodes, the nodes are isomorphic nodes;

[0140] Alternatively, traverse each node in the node set, compare the in-degree matrices corresponding to all nodes with each other, and compare the out-degree matrices corresponding to all nodes with each other; if there are one or more nodes with the same in-degree matrix and out-degree matrix, the nodes are isomorphic nodes.

[0141] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0142] The test case generation system based on the finite state machine homomorphic graph in this embodiment is presented in the form of functional units, where the units refer to ASIC (Application Specific Integrated Circuit) circuits, processors and memories that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0143] The embodiment of the present invention also provides a computer device having the above Figure 7 The test case generation system based on the finite state machine homomorphic graph is shown.

[0144] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.

[0145] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0146] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0147] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0148] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0149] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0150] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0151] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0152] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the defined scope.

Claims

1. A test case generation method based on a finite state machine homomorphic graph, characterized in that: The method comprises: Importing the source file of the project to be tested into the finite state machine graph generation module of the preset test engine, generating a finite state machine graph corresponding to the function state change relationship in the source file of the project to be tested; Obtaining a corresponding finite state machine homomorphic graph based on the information in the finite state machine graph; Traversing the homomorphic graph based on a depth-first search algorithm to generate a set of test paths connected in series between nodes and edges; The test path set is imported into the test module of the preset test engine to generate multiple test case results for the project to be tested.

2. The method according to claim 1, characterized in that The information in the finite state machine graph includes: a set of nodes, a set of edges, a mapping relationship between the starting vertices of the edges, and a mapping relationship between the ending vertices of the edges; wherein each node represents a state, and the edge represents the transition relationship between the states, and each node and each edge are provided with a corresponding identification symbol; The obtaining a corresponding finite state machine homomorphic graph based on the information in the finite state machine graph specifically includes: According to the node set, the edge set, the edge start vertex mapping relationship, the edge end vertex mapping relationship, and the identifier corresponding to each node and each edge, traverse all nodes to determine the homomorphic node mapping relationship; wherein the homomorphic node mapping relationship represents the mapping relationship between each node and the corresponding homomorphic node; According to the identification symbols corresponding to each node and each edge, the homomorphic node mapping relationship, the starting vertex mapping relationship of the edge, and the ending vertex mapping relationship of the edge are queried to obtain the homomorphic node set, the homomorphic edge set, the starting vertex mapping relationship of the homomorphic edges, and the ending vertex mapping relationship of the homomorphic edges; according to the homomorphic node set, the homomorphic edge set, the starting vertex mapping relationship of the homomorphic edges, and the ending vertex mapping relationship of the homomorphic edges, the homomorphic graph of the finite state machine graph is generated.

3. The method according to claim 2, characterized in that The step of traversing all nodes to determine the homomorphic node mapping relationship according to the node set, the edge set, the edge start vertex mapping relationship, the edge end vertex mapping relationship, and the identifier corresponding to each node and each edge specifically includes: According to the node set or the edge set, in combination with the starting vertex mapping relationship of the edge, the ending vertex mapping relationship of the edge, and the identification symbols corresponding to each node and each edge, calculate the out-degree information and in-degree information of each node in the node set; Traversing the out-degree information and in-degree information of each node in the node set, and determining the homomorphic node of each node; A homomorphic node mapping relationship is determined according to each node and the corresponding homomorphic node.

4. The method according to claim 3, characterized in that The out-degree information includes out-degree neighbor nodes, and the in-degree information includes in-degree neighbor nodes; According to the node set, in combination with the mapping relationship of the starting vertices of the edges, the mapping relationship of the ending vertices of the edges, and the identification symbols corresponding to each node and each edge, the out-degree information and the in-degree information of each node in the node set are calculated, specifically including: Traverse each node in the node set, wherein when traversing to the current node, query the starting vertex mapping relationship of the edge according to the identifier of the current node to obtain the current out-degree edge corresponding to the current node, query the ending vertex mapping relationship of the edge according to the identifier of the out-degree edge to obtain the out-degree neighbor node of the current node; query the ending vertex mapping relationship of the edge according to the identifier of the current node to obtain the current in-degree edge corresponding to the current node, and query the starting vertex mapping relationship of the edge according to the identifier of the in-degree edge to obtain the in-degree neighbor node of the current node.

5. The method according to claim 3, characterized in that: The out-degree information includes an out-degree matrix, and the in-degree information includes an in-degree matrix; According to the edge set, in combination with the starting vertex mapping relationship of the edge, the ending vertex mapping relationship of the edge, and the identification symbol corresponding to each node and each edge, the out-degree information and the in-degree information of each node in the node set are calculated, specifically including: Traversing the set of edges, using the identifier of each edge to query the mapping relationship of the starting vertices of the edge and the mapping relationship of the ending vertices of the edge, and determining the adjacency matrix of the finite state machine graph; The out-degree matrix and the in-degree matrix of each node are determined according to the adjacency matrix.

6. The method according to claim 4 or 5, characterized in that: The traversing the out-degree information and in-degree information of each node in the node set to determine the homomorphic node of each node specifically includes: Traversing each node in the node set, comparing the in-degree neighbor nodes corresponding to each node with each other, and comparing the out-degree neighbor nodes corresponding to all nodes with each other; if there are one or more nodes whose in-degree neighbor nodes and out-degree neighbor nodes are the same, the nodes are mutually isomorphic nodes; Alternatively, traverse each node in the node set, compare the in-degree matrices corresponding to all nodes with each other, and compare the out-degree matrices corresponding to all nodes with each other; if there are one or more nodes with the same in-degree matrix and out-degree matrix, the nodes are isomorphic nodes.

7. A test case generation system based on a finite state machine homomorphic graph, characterized in that: The system comprises: A state machine generation module, used to import the source file of the project to be tested into the finite state machine graph generation module of the preset test engine, and generate a finite state machine graph corresponding to the function state change relationship in the source file of the project to be tested; A homomorphic graph generation module, used to obtain a corresponding finite state machine homomorphic graph based on the information in the finite state machine graph; A test path generation module, used for traversing the homomorphic graph based on a depth-first search algorithm to generate a set of test paths connected in series between nodes and edges; The test case generation module is used to import the test path set into the test module of the preset test engine to generate multiple test case results for the project to be tested.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the test case generation method based on the finite state machine homomorphic graph according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the test case generation method based on the finite state machine homomorphic graph according to any one of claims 1 to 6.

10. A computer program product, characterized in that It includes computer instructions, and the computer instructions are used to enable a computer to execute the test case generation method based on the finite state machine homomorphic graph according to any one of claims 1 to 6.