关于学习用Tsl测试脚本的问题。
有没有用OLDsidney学习笔记的作为参考资料的仫,我按照上面第7部分使用TSL撰写测试脚本中的步骤做了一个脚本加入了tl_step涵数后,为何执行不了呢脚本如下:table = "lesson88.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. 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 ] 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);
# Flight Reservation
set_window ("Flight Reservation", 2);
obj_mouse_click ("AfxWnd40", 67, 6, LEFT);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 3);
button_set ("Order No.", ON);
edit_set ("Edit", ddt_val(table,"Order_Num"));-----你这一步跟我的不同,你再查一下!
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 3);
menu_select_item ("File;Fax Order...");
# Fax Order No. 3
set_window ("Fax Order No. 3", 4);
edit_get_text("# Tickets:",Ticket);
edit_get_text("Ticket Price:",Price);
edit_get_text("Total:",Total);
# check that the total ticket price is calculate correctly.
if (Ticket*Price==Total)
tl_step("total",0,"Correct."Ticket" * $"Price" =$"Total".");
else
tl_step("total",1,"Error."Ticket"ticket at $"Price" does not equal $"Total".");
button_press ("Cancel"); 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);
# Flight Reservation
set_window ("Flight Reservation", 2);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 2);
button_set ("Order No.", ON);
edit_set ("Edit_1", ddt_val(table,"Order_Num"));
button_press ("OK");
# Flight Reservation
set_window ("Flight Reservation", 3);
menu_select_item ("File;Fax Order...");
# Fax Order No. 3
set_window ("Fax Order No. 3", 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,"Correct. "tickets" tickets at $"price" cost $"total".");
else
tl_step("total",1,"Error. "tickets" tickets at $"price" does not equal $"total".");
button_press ("Cancel");
}
ddt_close(table); 楼主的执行步骤好像和我们的不太一样;
还有,你虽然设定的是从表中取值:
table = "lesson88.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);
……
}
ddt_close(table);
但实际上好象并没有这样做: edit_set ("Edit", "3" );
[ Last edited by someone5 on 2004-12-2 at 15:57 ] 你看看是不是下面的原因造成的:
# 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 ]
我找到了错误的原因
原因是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);
# Flight Reservation
win_activate ("Flight Reservation");
set_window ("Flight Reservation", 4);
menu_select_item ("File;Open Order...");
# Open Order
set_window ("Open Order", 1);
button_set ("Order No._1", ON);
edit_set ("Edit_2", "4");
button_press ("OK_1");
# Flight Reservation
set_window ("Flight Reservation", 5);
menu_select_item ("File;Fax Order...");
# 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");
}
ddt_close(table);
也就是现在打开90.xls文件没有数据。记得上次写的问题中的lesson88.xls得数据试我自己按找讲义写的。为何90.xls文件没有数据 呢?? 90.xls里面的数据应该是你自己加入的吧.
没有自动生成的
你是把数据放到EXECL表里,然后WR再从EXECL读出来!
哎呀,好久没看了,还有好多的朋友给我回复。谢谢大家哦
哎呀,好久没看了,谢谢大家哦
页:
[1]