The invention relates to a
test case generation method and
system, and the method comprises the steps: carrying out the change weighting of all change line numbers, change timestamps, change depths and change operators, which are extracted from a Git change
record of a current version, through employing a time
exponential decay model; meanwhile, a
penalty factor of author diversity entropy generated by a change operator is introduced in the
weight change process to obtain row-level change popularity, and a code calling graph, a code inheritance graph and a
data dependency graph are extracted from a complete code
library of the current version through a
static analysis tool to construct a code heterogeneous graph; the method comprises the following steps: establishing a large
language model, introducing line-level change popularity and carrying out weight aggregation to generate an influence map, extracting and executing a hotspot method from the influence map to generate a to-be-covered path, and inputting the to-be-covered path into the large
language model to output a recall
test case and a newly-added
test case. Therefore, the method not only has the capability of generating the new test case, but also ensures the
recall rate and the accuracy of the test case.