The invention provides an automatic GUI testing method based on UML activity diagrams. The method includes the first step of carrying out user
behavioral modeling, and carrying out modeling on possible operation behaviors of a user on a GUI to generate corresponding UML activity diagrams, the second step of establishing a script
library, wherein the script
library includes all functions and parameters needing to be called in the test executing process, and the functions and the parameters are in one-to-one correspondence with activities in the UML activity diagrams generated in the user
behavioral modeling step, the third step of generating testing scripts, performing traversal on the UML activity diagrams generated in the user
behavioral modeling step to obtain feasible execution sequences, and according to the execution sequences and the mapping relation between the UML activity diagrams and the function in the script
library to generate the testing scripts, the fourth step of executing testing, calling the testing scripts to automatically execute the testing and recording execution process and execution results, and the fifth step of analyzing the results, obtaining the testing coverage rate according to the execution results of the corresponding scripts, and analyzing occurrence reasons of program errors through playback.