The invention is applicable to the technical field of
software testing, and provides a
mutation testing method based on a co-location coverage relationship, which comprises the following steps of: applying a
mutation operator to a variable original statement of a tested program to generate a
mutation statement, and constructing a corresponding mutation
branch, on the premise of keeping the
semantics of the original program unchanged, all variation branches are integrated to obtain a new tested program, then the tested program is executed by using a
test case set, the coverage information of the
test case on the original statement and the variation branches is collected, and whether a co-location coverage relationship exists between the original statement and the variation branches is judged according to the coverage information; on the basis of the coverage relation, it can be directly determined that a
test case covers a variable original statement and also covers a variable
branch of the variable original statement, and for variants which cannot be judged according to the in-situ coverage relation, weak variation testing is executed, and a variation
score is calculated in combination with the actual killing condition. According to the method, the variation
test execution amount is remarkably reduced, the
test efficiency is improved, the
resource consumption is reduced, and meanwhile, high variation scores and
test quality are kept.