Qtp is an automated testing tool that can be automated by writing scripts or recording:
The following is a test of the built-in calculator for Windows.
First, write the script and Use Vbscript to open the calculator.
Dim oshell
Set oshell = Createobject ("wscript. Shell ")
Oshell. Run "calc", 1
Wait 2
Then record
The script will be generated automatically, and then add the checkpoint after editing to test 1 + 1 = 2 (insert-> checkpoint-> text area checkpoint)
The interface is as follows:
Set the value to 2.
The final script is
Dim Oshell Set Oshell = Createobject ( " Wscript. Shell " ) Oshell. Run " Calc " , 1 Wait 2 Window ( " Calculator " ). Winbutton ( " 1 " ). Clickwindow ( " Calculator " ). Winbutton ( " + " ). Clickwindow ( " Calculator " ). Winbutton ( " 1 " ). Clickwindow ( " Calculator " ). Winbutton ( " = " ). Clickwindow ( " Calculator " ). Winedit ( " Edit " ). Check checkpoint ( " Edit_2 " ) Window ( " Calculator " ). Close
After running, a report is automatically generated: (for the purpose of testing error information, I set the value near the detection site to 3 .)