TSLonline Reference (A-J)
上一篇 / 下一篇 2007-06-01 10:17:28 / 个人分类:自动化测试
A、
1. ActiveBar_combo_select_item ( band_tool , item_name );选择下拉菜单某一项,
例如:
set_window("Form1", 1);
ActiveBar_combo_select_item("Format;Font", "Arial");
WinRunner选择Format:Font的第三项.
set_window("Form1", 1);
ActiveBar_combo_select_item("Format;Font", "#3");
2. ActiveBar_dump ( file_name );存储活动工具栏信息,包括标题、名称、ID等。
file_name参数包括路径,
例如:
set_window("Form1", 1);
ActiveBar_dump ("d:\\Bar\\dump.txt");
3. ActiveBar_select_menu ( band_tool [, events_only ] ) ;选择菜单某一项,
例如:
WinRunner选择菜单Edit上的Cut选项。
set_window("Form1", 1);
ActiveBar_select_menu ("Edit;Cut",TRUE);
4. ActiveBar_select_tool (band_tool [, events_only ] ) ;选择工具栏里某一项,
例如:
set_window("Form1", 1);
ActiveBar_select_tool("Format; Center", TRUE);
5. ActiveX_activate_method ( object, ActiveX_method, return_value [,param4,……param8] );激活一个ActiveX方法;
例如:使用GetText方法,从一个快表中取数据;
Column = "1";
Row = "1";
set_window("Form1", 1);
rc=ActiveX_activate_method("FPSpread.Spread.1","GetText",retval,Column,Row,Text);
例如:使用GetCellPos方法得到cell的位置;
#This code retrieves position of the cell in the third column and fourth row
Column = "3";
Row = "4";
set_window("Form1", 1);
rc=ActiveX_activate_method("FPSpread.Spread.1","GetCellPos",retval,Column,Row,X,Y,Width,Height);
6. ActiveX_get_info (ObjectName, PropertyName, OutValue [ , IsWindow ] );
ActiveX_get_info ( ObjectName, PropertyName ( X ) , OutValue [ , IsWindow ] );
ActiveX_get_info ( ObjectName, PropertyName ( X , Y ) , OutValue [ , IsWindow ] );
返回ActiveX、VB的属性值;
例如:在LoanSheet的form中返回lblIntr(1).Caption的标题给label_caption;
ActiveX_get_info("LoanSheet", "lblIntr(1).Caption", label_caption, TRUE);
if (label_caption != "Minimum %")
report_msg ("The caption is incorrect");
7. ActiveX_set_info ( ObjectName, PropertyName , Value [ , Type [ , IsWindow ] ] );
ActiveX_set_info ( ObjectName, PropertyName ( X ) , Value [ , Type [ , IsWindow ] ] );
ActiveX_set_info ( ObjectName, PropertyName ( X , Y ) , Value [ , Type [ , IsWindow ] ] );
设置ActiveX、VB的属性值;
例如:设置数组item(6)的Vector控件给New Value.
ActiveX_set_info("Vector", "Item(6)", "NewValue");
8. add_cust_record_class ( MSW_class, dll_name [ , rec_func [ , log_name_func ]);把用户录制的函数或者命名的函数与用户定义的GUI类联合起来,
例如:将录制的SpinRec函数、逻辑命名的vb_ln与用户GUI的SpinButton联合起来
add_cust_record_class("SpinButton", M_Root&"\\arch\\vb_util.dll", "SpinRec ", "vb_ln");
9. add_dlph_obj ( MSW_class, class, oblig_attr, optional_attr, default _check_prop, item );增加一个delphi对象;
10. add_record_attr ( attr_name, dll_name, query_func_name, verify_func_name );注册一个用户属性
例如:注册用户属性vb_name,其中查询函数名是_ole_name_query。
add_record_attr("vb_name",m_root&"\\arch\\ole_ifs.dll","_ole_name_query","string_verify");
11. add_record_message ( message_number );在windows消息列表中增加一条消息
例如:WM_MOUSEMOVE
add_record_message ( 512 );
12. ascii ( string );返回字符串第一个字符的ascii码
例如:str=”mercury”; code=ascii(str);
#因为M的ascii码是77所以code=77;
13. atan2 ( y, x );返回y/x(正切)的弧度
B、
1. button_check_info ( button, property, property_value );检查按钮属性的值
例如:打开Buger应用程序和Order-Entry box窗口,判断Sub按钮是不是enable,是则报“Error occurred”。
# Call the Burger application.
call load_aut ("Burger",0);
set_window ("Burger", 1);
# Open the Order-Entry box.
menu_select_item ("Order;Create order box...");
set_window ("Order-Entry Box");
# Check if the Sub button is disabled.
if (button_check_info("Sub","enabled",0)!=E_OK)
report_msg("Error occurred");
# Press the Add button.
button_press ("Add");
2. button_check_state ( button, state );检查单选框或复选框的状态
例如:
if (button_check_state ("Ketchup",OFF) != E_OK|| button_check_state ("Medium", ON) != E_OK)