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