winrunner数据驱动时,测试的数据为非法数据时,该如何处理
以sample中的flight 4a为例,登录时用户名一定要求为4位以上的字符,但是如果我用3位来测试时就提示一个出错框,然后系统就一直停滞直到超时。现在就是想请教大牛们,如何在代码中设置,使得能自动关闭出错框,然后自动跳到下一条数据再继续进行呢 table = "e:\\新建 microsoft excel 工作表.xls";
rc = ddt_open(table, DDT_MODE_READ);
if (rc!= E_OK && rc != E_FILE_OPEN)
pause("Cannot open table.");
ddt_get_row_count(table,table_RowCount);
for(table_Row = 1; table_Row <= table_RowCount; table_Row ++)
{
ddt_set_row(table,table_Row);
table = table;
rc = ddt_open(table, DDT_MODE_READ);
if (rc!= E_OK && rc != E_FILE_OPEN)
pause("Cannot open table.");
ddt_get_row_count(table,table_RowCount);
for(table_Row = 1; table_Row <= table_RowCount; table_Row ++)
{
ddt_set_row(table,table_Row);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
button_press ("开始");
# BaseBar
set_window ("BaseBar", 3);
toolbar_select_item ("ToolbarWindow32_1", "程序(P);WinRunner;Sample Applications;Flight 4A");
# Login
set_window ("Login", 2);
edit_set ("Agent Name:", ddt_val(table,"用户名"));
obj_type ("Agent Name:","<kTab>");
password_edit_set("Password:", "kzptnyoslzjsaz");
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 6);
obj_type ("MSMaskWndClass","020206");
list_select_item ("Fly From:", "Frankfurt");# Item Number 1;
list_select_item ("Fly To:", "London");# Item Number 1;
obj_mouse_click ("FLIGHT", 37, 26, LEFT);
# Flights Table
set_window ("Flights Table", 0);
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 3);
edit_set ("Name:", "lk");
button_press ("Insert Order");
win_close ("Flight Reservation");
}
ddt_close(table);
}
ddt_close(table);
附上代码,谢谢了 不懂,但是进来了。帮顶下! 回复 3# lsekfe
谢谢,好像没人关注,sigh 回复 4# llzh137724
客气了,不要气馁。会有知道的人来的! Thank you very much for sharing!The good man!The good life of peace!
页:
[1]