The invention discloses a defect positioning-oriented code searching method. The method comprises the following steps of: firstly, constructing a
source code file
abstract syntax tree corresponding toa bug report in a
software history
library; secondly, extracting all code diff files related to bugs, defining continuous code modification lines in the code diff files as chunks, and establishing achunks
relation graph of each code diff file; then, obtaining an importance
score detree of each node in the chunk
relation graph; then, the relation between the bug report and the chunk is established; Bug-is established by using a
knowledge base establishing tool; A chunk
knowledge base; then, for a new bug report, obtaining the new bug report and the new bug-, wherein the similarity sim of thebug report in the chunk
knowledge base; and finally, generating a chunk
list by combining the importance
score detree and the similarity sim of the chunk to realize defect positioning. The processingobject takes the chunk as a unit, and is oriented to a continuous code block, so that the
processing data volume is reduced, the chunk is a modified
code line, the pertinence is better in the calculation process, and the pertinence and the accuracy of bug positioning are improved.