A
software testing method based on a model includes the following steps that S1,
software to be tested is analyzed, and a
test object and test characteristics are determined; S2, a UML model is selected and constructed; S3,
verification is performed on the UML model, and
correctness of the UML model is guaranteed; S4, traversal is performed on the UML model through a depth-first
search algorithm, a
test case is automatically generated, a relevant coverage rate is calculated according to sufficiency criteria such as a statement coverage criterion, a judgment coverage criterion, a condition coverage criterion and a
route coverage criterion, so that assessment of the
test case is finished; S5, a
test script is generated according to a program to be tested and the
test case obtained through the UML model, the
test script is automatically executed, and an actual output result obtained through execution of the
test script is stored; S6, according to comparison between actual output and anticipated output of the test case, a test result is obtained, and then according to the
test object and a preset stopping criterion, whether the model or the program to be tested needs to be modified or not is determined.