The invention provides a mobile application GUI
automatic testing method and
system based on hierarchical
reinforcement learning, and belongs to the technical field of mobile application testing. A real hardware device or a
virtual machine is used for building a testing environment and configuring an automatic exploration framework, a to-be-tested application program is initialized, GUI layer information and
control layer information are extracted respectively, and the GUI layer information and the
control layer information are extracted respectively; the method comprises the following steps: acquiring a GUI layer and a
control layer, converting the GUI layer and the control layer into a fine-grained
state vector convenient for subsequent
reinforcement learning processing, exploring the GUI layer and the control layer by using hierarchical
reinforcement learning in combination with a reward function,
processing interaction between the two
layers of networks, and performing conversion by using an FSM when an exception occurs. Respectively obtaining a
code coverage rate and a
crash detection result by utilizing the
code coverage rate detection framework and the log information of Appium; the problem that an existing mobile application GUI
automatic testing method does not consider rough GUI information
granularity and too single exploration level, and consequently exploration
path coverage is not comprehensive is solved.