Qtp test Windows Calculator

Source: Internet
Author: User

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 .)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.