CPC G06N 3/04 (2013.01) [G06N 20/00 (2019.01)] | 6 Claims |
1. A defect location method based on coverage information, the method comprising:
characterizing program structure information and test case coverage information of a target program in a graph to obtain a graph-characterized structure;
generating a node attribute sequence and an adjacency matrix based on the graph-characterized structure; and
inputting the node attribute sequence and the adjacency matrix to a trained graph neural network model, so that the graph neural network model outputs a suspicious degree list of the target program based on the node attribute sequence and the adjacency matrix,
wherein the characterizing program structure information and the test case coverage information of the target program in the graph to obtain the graph-characterized structure comprises:
obtaining an abstract syntax tree structure of each function in the target program as the program structure information of the target program, wherein the abstract syntax tree structure comprises a plurality of program nodes and attribute information of each program node;
using each test case in the test case coverage information as an independent test node; and
generating the graph-characterized structure based on the abstract syntax tree structure of each function, and a coverage relationship between each test node in the test case coverage information and each program node;
wherein the graph neural network model outputting the suspicious degree list of the target program based on the node attribute sequence and the adjacency matrix comprises:
converting the node attribute sequence into a vector sequence through an embedding layer in the graph neural network model and outputting the vector sequence to a graph neural network layer in the graph neural network model;
obtaining, by the graph neural network layer, a state value of the program node and a state value of the test node based on the vector sequence and the adjacency matrix, and outputting them to an output layer in the graph neural network model by the graph neural network layer; and
obtaining, by the output layer, the suspicious degree of each function in the target program based on the state value of the program node and the state value of the test node, and generating, by the output layer, the suspicious degree list of each function in an order of suspicious degree from high to low.
|