QTP bring your own ticket to implement loop execution, parameter and exception prompt information output

Source: Internet
Author: User

This example is mainly to accumulate some more basic knowledge, so that we can study later.

This example is a c/sclient program for booking

First, business needs:

1. Implement abnormal and normal data login form, the system verifies the data

2. After successful login. Booking business, involving many people booking different times, different cities of the ticket business

3. Exit the booking system

Second, self-active script needs to implement the function:

1. When multiple sets of data are logged in, the data needs to be counted. And in the login form to log in according to the number of data to loop login "(1) parameter data (2) Set the script loop rule"

2. Abnormal data logging system, the system gives the prompt information of the check. Need to officer abnormal data information in the QTP report "show exception information in QTP report"

3. Number of flight dates, ticket holders. Flight take-off location and destination "digital data"

4. Cut the script into 3 parts. The first part: Login business; the second part: Ticket booking business; Part III: Exit booking system Business

Third, implement the script:

Action1 Script

Dialog ("Login"). Winedit ("Agent Name:"). Set DataTable ("P_username", Dtlocalsheet)
Wait 1
Dialog ("Login"). Winedit ("Agent Name:"). Type Mictab
Wait 1
Dialog ("Login"). Winedit ("Password:"). SetSecure DataTable ("p_passwd", Dtlocalsheet)
Wait 1
Dialog ("Login"). Winbutton ("OK"). Click
Wait 1
If Dialog ("Login"). Dialog ("Flight reservations"). Exist (2) Then
Dim Err_message
Err_message=dialog ("Login"). Dialog ("Flight reservations"). Static ("Incorrect password. Please "). Getroproperty ("text")
Wait 1
Reporter.reportevent micfail, "Login Failed", "error message is:" &err_message
Wait 1
Dialog ("Login"). Dialog ("Flight reservations"). Winbutton ("OK"). Click
Wait 1
End If
Wait 1



Action2 script:

Window ("Flight reservation"). ActiveX ("MaskEdBox"). Type DataTable ("P_data_of_flight", Dtlocalsheet)
Wait 1
Window ("Flight reservation"). Wincombobox ("Fly from:"). Select DataTable ("P_flyfrom", Dtlocalsheet)
Wait 1
Window ("Flight reservation"). Wincombobox ("Fly to:"). Select DataTable ("P_flyto", Dtlocalsheet)
Wait 1
Window ("Flight reservation"). Winbutton ("FLIGHT"). Click
Wait 1
Window ("Flight reservation"). Dialog ("Flights Table"). Winbutton ("OK"). Click
Wait 1
Window ("Flight reservation"). Winedit ("Name:"). Set DataTable ("P_name", Dtlocalsheet)
Wait 1
Window ("Flight reservation"). Winbutton ("Insert Order"). Click
Wait 1
Window ("Flight reservation"). Winmenu ("menu"). Select "File; New Order "
Wait 1



Action3 Script

Window ("Flight reservation"). Close

QTP to carry out the ticket to implement the loop execution, the parameter and the exception prompt information output

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.