CN117435511A - Flow monitoring software testing method and device based on graph neural network - Google Patents
Flow monitoring software testing method and device based on graph neural network Download PDFInfo
- Publication number
- CN117435511A CN117435511A CN202311761911.1A CN202311761911A CN117435511A CN 117435511 A CN117435511 A CN 117435511A CN 202311761911 A CN202311761911 A CN 202311761911A CN 117435511 A CN117435511 A CN 117435511A
- Authority
- CN
- China
- Prior art keywords
- data variables
- data
- variables
- nodes
- graph
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000013528 artificial neural network Methods 0.000 title claims abstract description 79
- 238000000034 method Methods 0.000 title claims abstract description 32
- 238000013522 software testing Methods 0.000 title description 4
- 238000012360 testing method Methods 0.000 claims abstract description 137
- 238000012544 monitoring process Methods 0.000 claims abstract description 15
- 230000002159 abnormal effect Effects 0.000 claims abstract description 13
- 244000035744 Hura crepitans Species 0.000 claims description 16
- 238000012549 training Methods 0.000 claims description 8
- 238000006243 chemical reaction Methods 0.000 claims description 7
- 230000008569 process Effects 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 2
- 238000004364 calculation method Methods 0.000 description 4
- 230000005856 abnormality Effects 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 2
- 230000006399 behavior Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006698 induction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/042—Knowledge-based neural networks; Logical representations of neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
- G06N3/0455—Auto-encoder networks; Encoder-decoder networks
Abstract
The invention provides a method and a device for testing flow monitoring software based on a graph neural network, wherein the method comprises the following steps: scanning source program codes of the flow monitoring software to obtain M first data variables related to flow monitoring, finding N second data variables related to the M first data variables, and constructing a syntax analysis tree; determining K third data variables which can cause abnormal operation of the flow monitoring software according to M first data variables and N second data variables based on a syntax analysis tree, and converting the M first data variables, the N second data variables and the K third data variables into a graph; and then constructing a graph neural network based on the graph, inputting test variables into the trained graph neural network to generate a test variable graph, generating test cases by using a self-encoder for the test variable graph, and testing the flow monitoring software by using the test cases, thereby improving the accuracy of the test cases.
Description
Technical Field
The invention relates to the technical field of artificial intelligence and flow software testing, in particular to a testing method and device of flow monitoring software based on a graph neural network.
Background
The Test Case (Test Case) is to make a scientific organization induction on the behavior activity of the software Test, and aims to convert the behavior of the software Test into a manageable mode; meanwhile, the test cases are one of methods for quantifying the test details, and the test cases are different for different types of software.
In the prior art, the test cases are mainly written manually, and some test cases are generated in an artificial intelligence mode, but for the flow monitoring software, the monitored flow changes in real time, trojans and hackers attack the flow monitoring software, and how to efficiently generate the corresponding flow software test cases and perform efficient testing is a technical challenge.
Disclosure of Invention
The present invention proposes the following technical solution to one or more of the above technical drawbacks of the prior art.
A flow monitoring software testing method based on a graph neural network comprises the following steps:
an analysis step of scanning and analyzing source program codes of the flow monitoring software to obtain M first data variables related to flow monitoring, searching N second data variables related to the M first data variables, and constructing a grammar analysis tree based on the M first data variables and the N second data variables;
a conversion step of determining K third data variables which can cause abnormal operation of the flow monitoring software according to the M first data variables and the N second data variables based on the syntax analysis tree, and converting the M first data variables, the N second data variables and the K third data variables into a graph;
a test case generation step, namely constructing a graph neural network based on the graph, training the graph neural network to obtain a trained graph neural network, inputting test variables into the trained graph neural network to generate a test variable graph, using a self-encoder to generate a test case, and using a deep neural network to train to obtain the self-encoder;
testing the flow monitoring software by using the test case, and obtaining a test result;
the process of constructing the syntax analysis tree based on the M first data variables and the N second data variables is as follows: sequentially concatenating the M first data variables as trunks of the parse tree, as root nodes of the parse tree, using the rest of the first data variables as trunk nodes, and using one or more second data variables related to the first data variables as leaf nodes to be connected with related root nodes or trunk nodes;
wherein converting the M first data variables, the N second data variables, and the K third data variables into a graph based on the parse tree is performed as: the M first data variables, the N second data variables and the K third data variables are nodes in the graph, if a connection relation exists between the M first data variables and the N second data variables in the grammar analysis, an edge is inserted between the corresponding nodes, if no connection relation exists between the M first data variables and the N second data variables, no edge exists between the corresponding nodes, if the p-th of the K third data variables is determined based on the i-th of the M first data variables and the j-th of the N second data variables in the grammar analysis tree, an edge is inserted between the p-th third data variable and the i-th first data variable and the j-th second data variable, and otherwise no edge exists;
wherein, the characteristic values of the M first data variables are as follows:
the characteristic values of the N second data variables are as follows:
the characteristic values of the K third data variables are as follows:
wherein,representing a characterThe value of i is more than or equal to 1 and less than or equal to M, j is more than or equal to 1 and less than or equal to N, and p is more than or equal to 1 and less than or equal to K;
the weights of edges between the nodes of the M first data variables and the nodes of the N second data variables are as follows:
the weights of edges between the nodes of the K third data variables based on the nodes of the M first data variables are:
the weights of edges between the nodes of the K third data variables based on the N second data variables are:
wherein, M is more than or equal to 2, N is more than or equal to 2, and K is more than or equal to 2.
Further, retraining the graph neural network according to the test result.
Further, in the testing step, a test is developed with the size ofBuilding a sandbox environment in the memory space, and testing the flow monitoring software in the sandbox environment by using the test case;
the memory spaceThe method comprises the following steps:
;
wherein,representing the size of the memory space occupied by the flow monitoring software,and representing the size of the memory space occupied by the test case.
The invention also provides a testing device of flow monitoring software based on the graph neural network, which comprises:
the analysis unit scans and analyzes source program codes of the flow monitoring software to obtain M first data variables related to flow monitoring, searches N second data variables related to the M first data variables, and constructs a grammar analysis tree based on the M first data variables and the N second data variables;
the conversion unit is used for determining K third data variables which can cause abnormal operation of the flow monitoring software according to the M first data variables and the N second data variables based on the syntax analysis tree, and converting the M first data variables, the N second data variables and the K third data variables into a graph;
the test case generation unit is used for constructing a graph neural network based on the graph, training the graph neural network to obtain a trained graph neural network, inputting test variables into the trained graph neural network to generate a test variable graph, using a self-encoder to generate a test case, and using a deep neural network to train to obtain the self-encoder;
the testing unit is used for testing the flow monitoring software by using the testing case and obtaining a testing result;
the process of constructing the syntax analysis tree based on the M first data variables and the N second data variables is as follows: sequentially concatenating the M first data variables as trunks of the parse tree, as root nodes of the parse tree, using the rest of the first data variables as trunk nodes, and using one or more second data variables related to the first data variables as leaf nodes to be connected with related root nodes or trunk nodes;
wherein converting the M first data variables, the N second data variables, and the K third data variables into a graph based on the parse tree is performed as: the M first data variables, the N second data variables and the K third data variables are nodes in the graph, if a connection relation exists between the M first data variables and the N second data variables in the grammar analysis, an edge is inserted between the corresponding nodes, if no connection relation exists between the M first data variables and the N second data variables, no edge exists between the corresponding nodes, if the p-th of the K third data variables is determined based on the i-th of the M first data variables and the j-th of the N second data variables in the grammar analysis tree, an edge is inserted between the p-th third data variable and the i-th first data variable and the j-th second data variable, and otherwise no edge exists;
wherein, the characteristic values of the M first data variables are as follows:
the characteristic values of the N second data variables are as follows:
the characteristic values of the K third data variables are as follows:
wherein,representing a characterThe value of i is more than or equal to 1 and less than or equal to M, j is more than or equal to 1 and less than or equal to N, and p is more than or equal to 1 and less than or equal to K;
the weights of edges between the nodes of the M first data variables and the nodes of the N second data variables are as follows:
the weights of edges between the nodes of the K third data variables based on the nodes of the M first data variables are:
the weights of edges between the nodes of the K third data variables based on the N second data variables are:
wherein, M is more than or equal to 2, N is more than or equal to 2, and K is more than or equal to 2.
Further, retraining the graph neural network according to the test result.
Further, in the test unit, a test unit of the size ofBuilding a sandbox environment in the memory space, and testing the flow monitoring software in the sandbox environment by using the test case;
the memory spaceThe method comprises the following steps:
;
wherein,representing the size of the memory space occupied by the flow monitoring software,and representing the size of the memory space occupied by the test case.
The invention also proposes a computer readable storage medium having stored thereon computer program code which, when executed by a computer, performs any of the methods described above.
The invention has the technical effects that: the invention discloses a method, a device and a storage medium for testing flow monitoring software based on a graph neural network, wherein the method comprises the following steps: s101, scanning and analyzing source program codes of the flow monitoring software to obtain M first data variables related to flow monitoring, searching N second data variables related to the M first data variables, and constructing a grammar analysis tree based on the M first data variables and the N second data variables; a conversion step S102, based on the syntax analysis tree, determining K third data variables which can cause abnormal operation of the flow monitoring software according to the M first data variables and the N second data variables, and converting the M first data variables, the N second data variables and the K third data variables into a graph; step S103 of test case generation, namely constructing a graph neural network based on the graph, training the graph neural network to obtain a trained graph neural network, inputting test variables into the trained graph neural network to generate a test variable graph, using a self-encoder to generate a test case, and using a deep neural network to train to obtain the self-encoder; step S104 of testing, namely testing the flow monitoring software by using the test case, and obtaining a test result; wherein, M is more than or equal to 2, N is more than or equal to 2, and K is more than or equal to 2. In the invention, firstly, source program codes of the flow monitoring software are scanned and analyzed to obtain M first data variables related to flow monitoring, N second data variables related to the M first data variables are searched, a grammar analysis tree is constructed based on the M first data variables and the N second data variables, K third data variables which can cause abnormal operation of the flow monitoring software are determined based on the grammar analysis tree according to the M first data variables and the N second data variables, the M first data variables, the N second data variables and the K third data variables are converted into a graph, a graph neural network is constructed based on the graph, the graph neural network is trained to obtain a trained graph neural network, the method comprises the steps of inputting test variables into a trained graph neural network to generate a test variable graph, using a self-encoder to generate a test case, using the self-encoder to train the self-encoder by using a deep neural network, then using flow monitoring software to test the test case.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings.
Fig. 1 is a flow chart of a method of testing flow monitoring software based on a graph neural network, according to an embodiment of the invention.
Fig. 2 is a block diagram of a testing device for flow monitoring software based on a graph neural network according to an embodiment of the present invention.
Detailed Description
The present application is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 shows a testing method of flow monitoring software based on a graph neural network, which comprises the following steps:
s101, scanning and analyzing source program codes of the flow monitoring software to obtain M first data variables related to flow monitoring, searching N second data variables related to the M first data variables, and constructing a grammar analysis tree based on the M first data variables and the N second data variables;
a conversion step S102, based on the syntax analysis tree, determining K third data variables which can cause abnormal operation of the flow monitoring software according to the M first data variables and the N second data variables, and converting the M first data variables, the N second data variables and the K third data variables into a graph;
step S103 of test case generation, namely constructing a graph neural network based on the graph, training the graph neural network to obtain a trained graph neural network, inputting test variables into the trained graph neural network to generate a test variable graph, using a self-encoder to generate a test case, and using a deep neural network to train to obtain the self-encoder;
step S104 of testing, namely testing the flow monitoring software by using the test case, and obtaining a test result; wherein, M is more than or equal to 2, N is more than or equal to 2, and K is more than or equal to 2.
In the invention, firstly, source program codes of the flow monitoring software are scanned and analyzed to obtain M first data variables related to flow monitoring, N second data variables related to the M first data variables are searched, a grammar analysis tree is constructed based on the M first data variables and the N second data variables, K third data variables which can cause abnormal operation of the flow monitoring software are determined based on the grammar analysis tree according to the M first data variables and the N second data variables, the M first data variables, the N second data variables and the K third data variables are converted into graphs, a graph neural network is constructed based on the graphs, the graph neural network is trained to obtain a trained graph neural network, a test variable is input into the trained graph neural network to generate a test variable graph, the method comprises the steps of generating a test case by using a self-encoder, training the self-encoder by using a deep neural network, then testing the flow monitoring software by using the test case, and the core invention is based on code scanning flow monitoring related variables of a program, scanning out the related variables, constructing a grammar tree, determining data variables which cause abnormal operation of the flow monitoring software based on the grammar tree, finally constructing a graph neural network, outputting the graph neural network to the self-encoder to generate the test case, and improving the accuracy of the test case.
In one embodiment, the graphic neural network is retrained according to the test result, specifically, the test result is compared with a standard test result, and if the difference exceeds a certain threshold, the graphic neural network is retrained, so that the generated test case is more in line with the monitoring of the flow, which is another inventive concept of the present invention.
In one embodiment, in the test step S104, a test is developed with a size ofBuilding a sandbox environment in the memory space, and testing the flow monitoring software in the sandbox environment by using the test case;
the memory spaceThe method comprises the following steps:
;
wherein,representing the size of the memory space occupied by the flow monitoring software,and representing the size of the memory space occupied by the test case.
In the invention, in order to ensure the safety of the flow monitoring software test and avoid attacks such as hackers and trojans, the test is carried out in a safe sandbox environment, the sandbox is positioned in a opened memory space, and in order to ensure that the memory space is used enough and the memory space is not wasted, the invention provides a method for determining the size of the opened memory space, the method improves the fluency of the software test process and does not influence the operation of other software, which is another important invention concept of the invention.
In one embodiment, the operations of converting the M first data variables, the N second data variables, and the K third data variables into a graph are: the M first data variables, the N second data variables and the K third data variables are nodes in the graph, if the M first data variables and the N second data variables are related, an edge is inserted between the corresponding nodes, if the M first data variables and the N second data variables are not related, no edge exists between the corresponding nodes, if the p-th of the K third data variables is determined based on the i-th of the M first data variables and the j-th of the N second data variables, an edge is inserted between the p-th third data variable and the i-th first data variable and the j-th second data variable, and otherwise no edge exists.
The invention provides a specific mode of constructing a graph, namely inserting an edge between corresponding nodes if the M first data variables and the N second data variables are related, if the M first data variables and the N second data variables are not related, no edge exists between the corresponding nodes, if the p-th of the K third data variables is determined based on the i-th of the M first data variables and the j-th of the N second data variables, inserting an edge between the p-th third data variable and the i-th first data variable and the j-th second data variable, and the specific mode of constructing the graph is determined, which is another important invention concept of the invention.
In one embodiment, the characteristic values of the M first data variables are:
the characteristic values of the N second data variables are as follows:
the characteristic values of the K third data variables are as follows:
wherein,representing a characterThe value of i is more than or equal to 1 and less than or equal to M, j is more than or equal to 1 and less than or equal to N, and p is more than or equal to 1 and less than or equal to K.
In one embodiment, the weights of the edges between the nodes of the M first data variables and the nodes of the N second data variables are:
the weights of edges between the nodes of the K third data variables based on the nodes of the M first data variables are:
the weights of edges between the nodes of the K third data variables based on the N second data variables are:
wherein, M is more than or equal to 2, N is more than or equal to 2, and K is more than or equal to 2.
The invention provides a calculation mode of the characteristic value of each node in the graph neural network and a determination mode of the weight of each edge, because the node causing the software abnormality is most important, the characteristic value is related to the characteristic values of the other two nodes, the influence of the node of the second data variable on the monitoring software is smaller, the characteristic value is less related, the weight of the set edge is set as the product of the corresponding characteristic value according to the data type and multiplied by the corresponding constant coefficient, and the calculation efficiency of the subsequent neural network is improved.
Fig. 2 shows a testing device of flow monitoring software based on a graph neural network according to the present invention, the device comprises:
the analysis unit 201 performs scan analysis on source program codes of the flow monitoring software, obtains M first data variables related to flow monitoring, finds N second data variables related to the M first data variables, and constructs a syntax analysis tree based on the M first data variables and the N second data variables;
a conversion unit 202, configured to determine K third data variables that may cause abnormal operation of the flow monitoring software based on the parse tree according to the M first data variables and the N second data variables, and convert the M first data variables, the N second data variables, and the K third data variables into a graph;
the test case generating unit 203 constructs a graph neural network based on the graph, trains the graph neural network to obtain a trained graph neural network, inputs test variables into the trained graph neural network to generate a test variable graph, uses a self-encoder to generate a test case, and uses a deep neural network to train to obtain the self-encoder;
the test unit 204 is used for testing the flow monitoring software by using the test case and obtaining a test result; wherein, M is more than or equal to 2, N is more than or equal to 2, and K is more than or equal to 2.
In the invention, firstly, source program codes of the flow monitoring software are scanned and analyzed to obtain M first data variables related to flow monitoring, N second data variables related to the M first data variables are searched, a grammar analysis tree is constructed based on the M first data variables and the N second data variables, K third data variables which can cause abnormal operation of the flow monitoring software are determined based on the grammar analysis tree according to the M first data variables and the N second data variables, the M first data variables, the N second data variables and the K third data variables are converted into graphs, a graph neural network is constructed based on the graphs, the graph neural network is trained to obtain a trained graph neural network, a test variable is input into the trained graph neural network to generate a test variable graph, the method comprises the steps of generating a test case by using a self-encoder, training the self-encoder by using a deep neural network, then testing the flow monitoring software by using the test case, and the core invention is based on code scanning flow monitoring related variables of a program, scanning out the related variables, constructing a grammar tree, determining data variables which cause abnormal operation of the flow monitoring software based on the grammar tree, and finally constructing a graph neural network, and outputting the graph neural network to the self-encoder to generate the test case.
In one embodiment, the graphic neural network is retrained according to the test result, specifically, the test result is compared with a standard test result, and if the difference exceeds a certain threshold, the graphic neural network is retrained, so that the generated test case is more in line with the monitoring of the flow, which is another inventive concept of the present invention.
In one embodiment, the test unit 204,opens up a size ofBuilding a sandbox environment in the memory space, and testing the flow monitoring software in the sandbox environment by using the test case;
the memory spaceThe method comprises the following steps:
;
wherein,representing the size of the memory space occupied by the flow monitoring software,and representing the size of the memory space occupied by the test case.
In the invention, in order to ensure the safety of the flow monitoring software test and avoid attacks such as hackers and trojans, the test is carried out in a safe sandbox environment, the sandbox is positioned in a opened memory space, and in order to ensure that the memory space is used enough and the memory space is not wasted, the invention provides a method for determining the size of the opened memory space, the method improves the fluency of the software test process and does not influence the operation of other software, which is another important invention concept of the invention.
In one embodiment, the operations of converting the M first data variables, the N second data variables, and the K third data variables into a graph are: the M first data variables, the N second data variables and the K third data variables are nodes in the graph, if the M first data variables and the N second data variables are related, an edge is inserted between the corresponding nodes, if the M first data variables and the N second data variables are not related, no edge exists between the corresponding nodes, if the p-th of the K third data variables is determined based on the i-th of the M first data variables and the j-th of the N second data variables, an edge is inserted between the p-th third data variable and the i-th first data variable and the j-th second data variable, and otherwise no edge exists.
The invention provides a specific mode of constructing a graph, namely inserting an edge between corresponding nodes if the M first data variables and the N second data variables are related, if the M first data variables and the N second data variables are not related, no edge exists between the corresponding nodes, if the p-th of the K third data variables is determined based on the i-th of the M first data variables and the j-th of the N second data variables, inserting an edge between the p-th third data variable and the i-th first data variable and the j-th second data variable, and the specific mode of constructing the graph is determined, which is another important invention concept of the invention.
In one embodiment, the characteristic values of the M first data variables are:
the characteristic values of the N second data variables are as follows:
the characteristic values of the K third data variables are as follows:
wherein,representing a characterThe value of i is more than or equal to 1 and less than or equal to M, j is more than or equal to 1 and less than or equal to N, and p is more than or equal to 1 and less than or equal to K.
In one embodiment, the nodes of the M first data variables are associated with N second numbersThe weights of the edges between the nodes by variable are:
the weights of edges between the nodes of the K third data variables based on the nodes of the M first data variables are:
the weights of edges between the nodes of the K third data variables based on the N second data variables are:
wherein, M is more than or equal to 2, N is more than or equal to 2, and K is more than or equal to 2.
The invention provides a calculation mode of the characteristic value of each node in the graph neural network and a determination mode of the weight of each edge, because the node causing the software abnormality is most important, the characteristic value is related to the characteristic values of the other two nodes, the influence of the node of the second data variable on the monitoring software is smaller, the characteristic value is less related, the weight of the set edge is set as the product of the corresponding characteristic value according to the data type and multiplied by the corresponding constant coefficient, and the calculation efficiency of the subsequent neural network is improved.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present application.
From the above description of embodiments, it will be apparent to those skilled in the art that the present application may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the apparatus described in the embodiments or some parts of the embodiments of the present application.
Finally, what should be said is: the above embodiments are merely for illustrating the technical aspects of the present invention, and it should be understood by those skilled in the art that although the present invention has been described in detail with reference to the above embodiments: modifications and equivalents may be made thereto without departing from the spirit and scope of the invention, which is intended to be encompassed by the claims.
Claims (5)
1. The method for testing the flow monitoring software based on the graph neural network is characterized by comprising the following steps of:
an analysis step of scanning and analyzing source program codes of the flow monitoring software to obtain M first data variables related to flow monitoring, searching N second data variables related to the M first data variables, and constructing a grammar analysis tree based on the M first data variables and the N second data variables;
a conversion step of determining K third data variables which can cause abnormal operation of the flow monitoring software according to the M first data variables and the N second data variables based on the syntax analysis tree, and converting the M first data variables, the N second data variables and the K third data variables into a graph;
a test case generation step, namely constructing a graph neural network based on the graph, training the graph neural network to obtain a trained graph neural network, inputting test variables into the trained graph neural network to generate a test variable graph, using a self-encoder to generate a test case, and using a deep neural network to train to obtain the self-encoder;
testing the flow monitoring software by using the test case, and obtaining a test result;
the process of constructing the syntax analysis tree based on the M first data variables and the N second data variables is as follows: sequentially concatenating the M first data variables as trunks of the parse tree, as root nodes of the parse tree, using the rest of the first data variables as trunk nodes, and using one or more second data variables related to the first data variables as leaf nodes to be connected with related root nodes or trunk nodes;
wherein converting the M first data variables, the N second data variables, and the K third data variables into a graph based on the parse tree is performed as: the M first data variables, the N second data variables and the K third data variables are nodes in the graph, if a connection relation exists between the M first data variables and the N second data variables in the grammar analysis, an edge is inserted between the corresponding nodes, if no connection relation exists between the M first data variables and the N second data variables, no edge exists between the corresponding nodes, if the p-th of the K third data variables is determined based on the i-th of the M first data variables and the j-th of the N second data variables in the grammar analysis tree, an edge is inserted between the p-th third data variable and the i-th first data variable and the j-th second data variable, and otherwise no edge exists;
wherein, the characteristic values of the M first data variables are as follows:
the characteristic values of the N second data variables are as follows:
the characteristic values of the K third data variables are as follows:
wherein the method comprises the steps of,Representing a characterI is more than or equal to 1 and less than or equal to M, j is more than or equal to 1 and less than or equal to N, and p is more than or equal to 1 and less than or equal to K;
the weights of edges between the nodes of the M first data variables and the nodes of the N second data variables are as follows:
the weights of edges between the nodes of the K third data variables based on the nodes of the M first data variables are:
the weights of edges between the nodes of the K third data variables based on the N second data variables are:
wherein, M is more than or equal to 2, N is more than or equal to 2, and K is more than or equal to 2.
2. The method of claim 1, wherein during said testing step, a test is developed of the sizeBuilding a sandbox environment in the memory space, and testing the flow monitoring software in the sandbox environment by using the test case;
the memory spaceThe method comprises the following steps:
;
wherein,representing the size of the memory space occupied by the flow monitoring software,and representing the size of the memory space occupied by the test case.
3. A testing device of flow monitoring software based on a graph neural network, which is characterized in that the device comprises:
the analysis unit scans and analyzes source program codes of the flow monitoring software to obtain M first data variables related to flow monitoring, searches N second data variables related to the M first data variables, and constructs a grammar analysis tree based on the M first data variables and the N second data variables;
the conversion unit is used for determining K third data variables which can cause abnormal operation of the flow monitoring software according to the M first data variables and the N second data variables based on the syntax analysis tree, and converting the M first data variables, the N second data variables and the K third data variables into a graph;
the test case generation unit is used for constructing a graph neural network based on the graph, training the graph neural network to obtain a trained graph neural network, inputting test variables into the trained graph neural network to generate a test variable graph, using a self-encoder to generate a test case, and using a deep neural network to train to obtain the self-encoder;
the testing unit is used for testing the flow monitoring software by using the testing case and obtaining a testing result;
the process of constructing the syntax analysis tree based on the M first data variables and the N second data variables is as follows: sequentially concatenating the M first data variables as trunks of the parse tree, as root nodes of the parse tree, using the rest of the first data variables as trunk nodes, and using one or more second data variables related to the first data variables as leaf nodes to be connected with related root nodes or trunk nodes;
wherein converting the M first data variables, the N second data variables, and the K third data variables into a graph based on the parse tree is performed as: the M first data variables, the N second data variables and the K third data variables are nodes in the graph, if a connection relation exists between the M first data variables and the N second data variables in the grammar analysis, an edge is inserted between the corresponding nodes, if no connection relation exists between the M first data variables and the N second data variables, no edge exists between the corresponding nodes, if the p-th of the K third data variables is determined based on the i-th of the M first data variables and the j-th of the N second data variables in the grammar analysis tree, an edge is inserted between the p-th third data variable and the i-th first data variable and the j-th second data variable, and otherwise no edge exists;
wherein, the characteristic values of the M first data variables are as follows:
the characteristic values of the N second data variables are as follows:
the characteristic values of the K third data variables are as follows:
wherein,representing a characterThe value of i is more than or equal to 1 and less than or equal to M, j is more than or equal to 1 and less than or equal to N, and p is more than or equal to 1 and less than or equal to K;
the weights of edges between the nodes of the M first data variables and the nodes of the N second data variables are as follows:
the weights of edges between the nodes of the K third data variables based on the nodes of the M first data variables are:
the weights of edges between the nodes of the K third data variables based on the N second data variables are:
wherein, M is more than or equal to 2, N is more than or equal to 2, and K is more than or equal to 2.
4. A device according to claim 3, characterized in that a test unit is provided with a test element of the sizeBuilding a sandbox environment in the memory space, and testing the flow monitoring software in the sandbox environment by using the test case;
the memory spaceThe method comprises the following steps:
;
wherein,representing the size of the memory space occupied by the flow monitoring software,and representing the size of the memory space occupied by the test case.
5. A computer readable storage medium having stored thereon computer program code which, when executed by a computer, performs the method of any of the preceding claims 1-2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311761911.1A CN117435511B (en) | 2023-12-20 | 2023-12-20 | Flow monitoring software testing method and device based on graphic neural network and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311761911.1A CN117435511B (en) | 2023-12-20 | 2023-12-20 | Flow monitoring software testing method and device based on graphic neural network and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117435511A true CN117435511A (en) | 2024-01-23 |
CN117435511B CN117435511B (en) | 2024-03-19 |
Family
ID=89553973
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311761911.1A Active CN117435511B (en) | 2023-12-20 | 2023-12-20 | Flow monitoring software testing method and device based on graphic neural network and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117435511B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20210334656A1 (en) * | 2018-09-05 | 2021-10-28 | Sartorius Stedim Data Analytics Ab | Computer-implemented method, computer program product and system for anomaly detection and/or predictive maintenance |
CN115238822A (en) * | 2022-08-19 | 2022-10-25 | 哈尔滨工程大学 | Network protocol vulnerability mining method based on mixed variation strategy |
CN115826988A (en) * | 2022-12-09 | 2023-03-21 | 南京大学 | Java method annotation instant automatic updating method based on data flow analysis and attention mechanism |
CN116361788A (en) * | 2022-12-23 | 2023-06-30 | 中国人民解放军国防科技大学 | Binary software vulnerability prediction method based on machine learning |
CN116522334A (en) * | 2023-03-21 | 2023-08-01 | 西安电子科技大学 | RTL-level hardware Trojan detection method based on graph neural network and storage medium |
CN116633804A (en) * | 2023-05-11 | 2023-08-22 | 中国电信股份有限公司北京研究院 | Modeling method, protection method and related equipment of network flow detection model |
-
2023
- 2023-12-20 CN CN202311761911.1A patent/CN117435511B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20210334656A1 (en) * | 2018-09-05 | 2021-10-28 | Sartorius Stedim Data Analytics Ab | Computer-implemented method, computer program product and system for anomaly detection and/or predictive maintenance |
CN115238822A (en) * | 2022-08-19 | 2022-10-25 | 哈尔滨工程大学 | Network protocol vulnerability mining method based on mixed variation strategy |
CN115826988A (en) * | 2022-12-09 | 2023-03-21 | 南京大学 | Java method annotation instant automatic updating method based on data flow analysis and attention mechanism |
CN116361788A (en) * | 2022-12-23 | 2023-06-30 | 中国人民解放军国防科技大学 | Binary software vulnerability prediction method based on machine learning |
CN116522334A (en) * | 2023-03-21 | 2023-08-01 | 西安电子科技大学 | RTL-level hardware Trojan detection method based on graph neural network and storage medium |
CN116633804A (en) * | 2023-05-11 | 2023-08-22 | 中国电信股份有限公司北京研究院 | Modeling method, protection method and related equipment of network flow detection model |
Non-Patent Citations (1)
Title |
---|
钟伟华;黄达辉;王欣霖;于欣宁: "基于决策树模型的医院网络流量监测方法研究", 《微型电脑应用》, vol. 39, no. 4, 30 April 2023 (2023-04-30), pages 91 - 93 * |
Also Published As
Publication number | Publication date |
---|---|
CN117435511B (en) | 2024-03-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111639344B (en) | Vulnerability detection method and device based on neural network | |
CN111783100B (en) | Source code vulnerability detection method for code graph representation learning based on graph convolution network | |
CN109413028B (en) | SQL injection detection method based on convolutional neural network algorithm | |
CN109976995B (en) | Method and apparatus for testing | |
CN111897946B (en) | Vulnerability patch recommendation method, vulnerability patch recommendation system, computer equipment and storage medium | |
CN111694937A (en) | Interviewing method and device based on artificial intelligence, computer equipment and storage medium | |
CN112579469A (en) | Source code defect detection method and device | |
CN112507337A (en) | Implementation method of malicious JavaScript code detection model based on semantic analysis | |
CN113741886A (en) | Statement level program repairing method and system based on graph | |
CN112613040A (en) | Vulnerability detection method based on binary program and related equipment | |
CN110826325B (en) | Language model pre-training method and system based on countermeasure training and electronic equipment | |
CN112669215A (en) | Training text image generation model, text image generation method and device | |
CN112783508B (en) | File compiling method, device, equipment and storage medium | |
CN117435511B (en) | Flow monitoring software testing method and device based on graphic neural network and storage medium | |
CN111241843B (en) | Semantic relation inference system and method based on composite neural network | |
CN115686923B (en) | Method and system for automatically repairing software source code defects | |
CN111488950A (en) | Classification model information output method and device | |
Ye et al. | Rapidfuzz: Accelerating fuzzing via generative adversarial networks | |
CN115828264A (en) | Intelligent contract vulnerability detection method and system and electronic equipment | |
Phan et al. | Story point level classification by text level graph neural network | |
CN113760358A (en) | Countermeasure sample generation method for source code classification model | |
CN114357984A (en) | Homophone variant processing method based on pinyin | |
CN115412335B (en) | 5G power Internet of things edge equipment vulnerability detection method, device and system | |
Sharmila | Tapering Malicious Language for Identifying Fake Web Content | |
CN116502140B (en) | Encryption algorithm identification method and device based on similarity of control flow graphs |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |