|
WinRunner中进行数字比较
想到以下解决办法,但是对于在我的例子中数字比较时为什么不能用==,而要用compare_text()。搞不懂啊,希望有人知道,告诉我一声
table10 = "lesson10.xls";
rc = ddt_open(table10, DDT_MODE_READ);
if (rc!= E_OK && rc != E_FILE_OPEN)
pause("Cannot open table.");
ddt_get_row_count(table10,table10_RowCount);
for(table10_Row = 1; table10_Row <= table10_RowCount; table10_Row ++)
{
ddt_set_row(table10,table10_Row);
# Flight Reservation
set_window ("Flight Reservation", 3);z
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 1);
button_set ("Order No.", ON);
edit_set ("Edit", ddt_val(table10,"order_num"));
button_press ("OK");
wait(1);
# Flight Reservation
set_window ("Flight Reservation", 5);
edit_get_text("Tickets:",tickets);
edit_get_text("Price:",price);
edit_get_text("Total:",total);
price = substr(price,2);
total = substr(total,2);
wait(1);
x = price*tickets;
total=total*1;
if (compare_text(x,total))
tl_step("total",0,"total is right,"tickets"乘以"price"总计"total"");
else
tl_step("total",1,"total is wrong,"tickets"乘以"price"总计不是"total"而是"x""); #比较total和x值的不同
}
ddt_close(table10); |
|