領測軟件測試網
在使用錯誤報告的時候,應該注意包括出錯的腳本文件名稱,這樣當腳本文件被
其他腳
本調用時候,也能很清楚在什么地方沒有通過。Report_msg 的參數格式定義為“文件名稱:
錯誤描述”。同時鑒于
WinRunner 的Check 函數不能提供清楚的錯誤報告,要求錯誤報告使
用以方式
if ( win_check_bitmap("Flight Reservations", "Img1", 1)!=E_OK)
{
report_msg("DateCheck:月份輸入錯誤提示不對!");
}
附件:一個完整的例子
#腳本名稱:DateCheck
#創建人:謝慧強
#創建日期:2002/09/08
#功能:檢查FLIGHTA 程序在輸入錯誤月份的時候提示是否正確
#運行前要求:要求FLIGHA 進入定票窗口(New_Order 狀態)且無任何數據輸入
# 或者FLIGHTA 沒有運行,這時候要求FLIGHTA。EXE 位
# 于E:\\Program Files\\
Mercury Interactive\\WinRunner\\samples\\flight\\app\\flight1a.exe
#參考文檔:無
#修改歷史:
# 修改人:謝慧強
# 修改時間:2002/09/09
# 主要修改內容:不采用位圖方式,改為直接判斷字符串內容
#load gui file
#Flight Reservation
if (GUI_load(".\\DateCheck.gui")!=0)
{
report_msg ("DataCheck:Can't load .\\DateCheck.gui");
texit;
}
#Check windows exists ,if don't exist ,call login to open it.
# Flight Reservation
if (win_exists("Flight Reservation")!=E_OK){
#pause ("Windows Flight Reservation don't exist");
#texit;
call "..\\login\\login"();
}
#input error month
win_activate ("Flight Reservation");
set_window ("Flight Reservation", 3);
obj_mouse_drag ("Button_4", 17, 6, 17, 7, LEFT);
obj_type ("MSMaskWndClass","301212");
list_select_item ("Fly From:", "Denver"); # Item Number 0;
#check message bitmap
# Flight Reservations_1
set_window ("Flight Reservations", 3);
#2002/09/09 謝慧強
#if ( win_check_bitmap("Flight Reservations", "Img1", 1)!=E_OK)
#static_check_info("Invalid month Entered.The month must be greater than 01 and less than
12.(static)","enabled",1);
if (static_check_info("CheckMessage","label","Invalid month Entered.The month must be
greater than 01 and less than 12.")!=E_OK)
#2002/09/09 謝慧強修改結束
{
report_msg("DateCheck:月份輸入錯誤提示不對!");
}
button_press ("確定");
#close gui file
GUI_close(".\\DateCheck.gui");