求教!谢谢
大哥大姐们:谁能教我写一个重复测试的脚本,有例子
程序是一个输入用户信息的程序,我采用了"Table"中Data driver wizard进行测试,但是我想从表中"soName"取的数据为"test100"test后面的数字为奇数时"list_select_item("status","====无效====");"选择无效,test后面的数字为偶数时"list_select_item("status","====有效====");"选择有效.并且能够重复执行100次.
table = "default.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);
# 管理系统->用户信息管理
set_window("管理系统->用户信息管理",2);
web_link_click("新增用户");
# mic_unknown_class
set_window("mic_unknown_class",13);
edit_set("soName",ddt_val(table,"soName"));
edit_set("sysPwd",ddt_val(table,"sysPwd"));
list_select_item("status","====无效====");
edit_set("ouserName",ddt_val(table,"ouserName"));
button_press("提交");
}
ddt_close(table);
这里谢谢大家了,希望大家按照例子教我. You can add a "if()" command as following:
table = "default.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);
# 管理系统->用户信息管理
set_window("管理系统->用户信息管理",2);
web_link_click("新增用户");
# mic_unknown_class
set_window("mic_unknown_class",13);
edit_set("soName",ddt_val(table,"soName"));
edit_set("sysPwd",ddt_val(table,"sysPwd"));
Flag = table_Row%2;
if (Flag==1)
list_select_item("status","====无效====");
else
list_select_item("status","====有效====");
edit_set("ouserName",ddt_val(table,"ouserName"));
button_press("提交");
}
ddt_close(table); Repalce "table_RowCount" to "100" for 100 times executing, as following:
table = "default.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 <= 100; table_Row ++)
{
ddt_set_row(table,table_Row);
# 管理系统->用户信息管理
set_window("管理系统->用户信息管理",2);
web_link_click("新增用户");
# mic_unknown_class
set_window("mic_unknown_class",13);
edit_set("soName",ddt_val(table,"soName"));
edit_set("sysPwd",ddt_val(table,"sysPwd"));
Flag = table_Row%2;
if (Flag==1)
list_select_item("status","====无效====");
else
list_select_item("status","====有效====");
edit_set("ouserName",ddt_val(table,"ouserName"));
button_press("提交");
}
ddt_close(table); 谢谢“steven0607”
页:
[1]