# Fax Order No. 3
win_activate ("Fax Order No. 3");
set_window ("Fax Order No. 3", 8);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 2);
button_set ("Order No.", ON);
edit_set ("Edit", "3");
button_press ("OK");
# Fax Order No. 3
set_window ("Fax Order No. 3", 10);
menu_select_item ("File;Fax Order...");
# Fax Order No. 3_1
set_window ("Fax Order No. 3_1", 9);
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,"Total is correct.");
else
tl_step("total",1,"Total is incorrect.");
button_press ("Cancel");
}
ddt_close(table);
运行结果:Step:total,Status:Fail,Description:Total is incorrect.
请指教,多谢!
[ Last edited by panda on 2004-12-1 at 19:08 ]作者: QA_BAY 时间: 2004-12-1 22:09
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);
# Check that the total ticket price is calculated correctly.
if(tickets*price == total)
tl_step("total",0,"Correct. "tickets" tickets at $"price" cost $"total".");
else
tl_step("total",1,"Error. "tickets" tickets at $"price" does not equal $"total".");
button_press ("Cancel");
[ Last edited by someone5 on 2004-12-2 at 15:57 ]作者: someone5 时间: 2004-12-2 13:54
你看看是不是下面的原因造成的:
# Fax Order No. 3_1
set_window ("Fax Order No. 3_1", 9);
edit_get_text("# Tickets:",Tickets);//请注意此处的Tickets
edit_get_text("Ticket Price:", Price);//请注意此处的Price
edit_get_text("Total:",Total);
# check that the total ticket price is calculated correctly.
if( tickets*price == Total) //此处的tickets和price的开头字母好象应该大写吧,因为你前面取值时就用的是大写
tl_step("total",0,"Total is correct." );
else
tl_step("total",1,"Total is incorrect." );
button_press ("Cancel" );
[ Last edited by someone5 on 2004-12-2 at 15:59 ]作者: panda 时间: 2004-12-14 15:44 标题: 我找到了错误的原因 原因是lesson88.xls表中的数据不对吧,因为我从新一步一步做了开始lesson88.xls中没有数据,执行是对得,后来写了一些数据,就执行不对了。不过为何我的俺资料生成脚本后,用table->date table打开lesson88.xls没有数据呢
我刚做的脚本
table = "90.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);
# Fax Order No. 4
set_window ("Fax Order No. 4", 1);
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,"Total is correct.");
else
tl_step("Total",1,"Total is incorrect.");
button_press ("Cancel");