After developing a client that provides a log version, start to try to reproduce the error. After manual logon for more than 20 times, the logon failed again, but the Development said that the output logs were not detailed enough and a new compilation version was submitted. I really don't want to repeat the login operation, so I thought of writing an automated script to implement the manual process:
1) enter the user name and password to log on to the client.
2) log out of the Client
3) Delete the user application directory after installation (a user application directory is generated every time the user logs on. The delete directory is to be as close as possible to logon after the new client is installed)
The first thing that comes to mind is qtp. But since qtp was not successfully installed on my test machine, it is too late to reinstall the system. So I want to use autoit to meet the above requirements,CodeIt is very simple, as follows:
Run ("D: \ installation directory \ xxx.exe ")
Sleep (MS), to wait for the user to log on to the dialog box
Sleep (2000)
; Waiting for Client Login Dialog Box
Winwait ("Logon window name ")
In the "user" box, enter the user ID by using controlsend ("window title", "window text", Control ID, "string" [, Flag]).
Controlsend ("Logon window name", "", "edit6", "username ")
Enter the password in the "password" box.
Controlsend ("Logon window name", "", "edit7", "passwd ")
Click the "Log on" button. The method is controlclick ("window title", "window text", Control ID [, key [, number of clicks [, X coordinate [,; Y coordinates])
Controlclick ("Logon window name", "", "button6 ")
; Wait 5 seconds
Sleep (5000)
The client window appears after the login is successful.
Winwait ("client window name after Successful Logon ")
Sleep (5000)
Winclose ("client window name after Successful Logon ")
Delete the user application mold path generated after login
Dirremove ("C: \ User application directory", 1)
With this script, we can reproduce or verify whether the defect is fixed by specifying the number of logins. Finally, for the 11th modified version after development, the system repeatedly runs and logs on for 50 times. No Logon failure occurs, indicating that the vulnerability has been fixed. If a manual test is used, the 11 versions will be disconnected after testing.
Autoit provides a window information tool to identify windows or controls. It is easy to use. For more information, see the help manual provided by autoit.