Wr测试数据出错!
Wr测试数据出错!table = "lesson8.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);
# Shell_TrayWnd
set_window ("Shell_TrayWnd", 1);
toolbar_button_press ("ToolbarWindow32_1", "Flight Reservation"); # Button Number 4;
# Flight Reservation
set_window ("Flight Reservation", 2);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 1);
button_set ("Order No.", ON);
#obj_check_gui("Edit_1", "list1.ckl", "gui1", 1);
edit_set ("Edit_1", ddt_val(table,"Order_num"));
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 2);
menu_select_item ("File;Fax Order...");
# Fax Order No. 3
set_window ("Fax Order No. 3", 3);
edit_get_text("# Tickets:",tickets);
edit_get_text("Ticket Price:",price);
edit_get_text("Total:",total);
# check that the total ticket price is calculated correctly.
if(tickets*price==total)
tl_step("total",0,"correct."tickets "ticket(s) at $"price"cost $"total".");
else
tl_step("total",1,"incorrect."tickets" ticket(s) at $"price "doesn't equal $"total".");
tl_step("pass",0,tickets*price"="total"?");
button_press ("Cancel");
}
ddt_close(table);
这是对WR自带的例子“Flight Reservation”测试时的脚本,在进行循环测试时,lesson8.xls里的数据为order no从1-12,为什么其它都对,就当order no 为2时不能pass,而且不管把“2”放在什么位置都会出错,可其实软件没有问题,tickets*price=total。我确实想不明白。不知有没有人碰上过,是不是WR本身有问题,呵呵,请高手指教!
[ Last edited by lbdfg on 2005-4-30 at 17:57 ] 这不知道是哪儿的bug。
这个问题我3年前就发现了,好像我是first,Mercury的工程师也解决不了,都搞不明白咋回事。 太多了,把你出错的那句标明一下 好像没有遇到过
把错误发出来看一下! 运行就知道错误了 他这里加入他自己做的excel,所以别人没法帮他试,但告诉我们错误在哪一行,应该可以帮他定位可能的原因 但看问题,他只是在数据2的时候出错.其它都不会.
这种可能会不会机器的问题呢 # check that the total ticket price is calculated correctly.
if(tickets*price==total)
tl_step("total",0,"correct."tickets "ticket(s) at $"price"cost $"total".");
else
tl_step("total",1,"incorrect."tickets" ticket(s) at $"price "doesn't equal $"total".");
tl_step("pass",0,tickets*price"="total"?");
出错在于,它好像认为当“open order" 的”edit"被设为2时,tickets*price!=total,因而执行else,但是显示的结果确为:“Step: total, Status: Fail, Description: incorrect. 3 ticket(s) at $647.60 doesn't equal $1942.80.
明显不对嘛 而且我把”2“在excel 表里的位置改变后,”2“在哪,就在哪出错! 我想知道,怎么发图 左下角的发表回复, 右下角吧,呵呵 很奇怪的问题,好像就是对这几个数字敏感
换个方式思考,把表达式改为if(total/tickets == price)那就都通过了
呵呵,很有意思哦,也许就像yuxingxin说的那样
页:
[1]