WinRunner脚本标准格式.doc_第1页
WinRunner脚本标准格式.doc_第2页
WinRunner脚本标准格式.doc_第3页
WinRunner脚本标准格式.doc_第4页
WinRunner脚本标准格式.doc_第5页
已阅读5页,还剩21页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

目录结构 存放目录要求: 1、根目录与项目名称相同,如江西移动BOSS 测试目录为JXBOSS 2、根目录下应该是按子项目存放,如SALES、ACCOUNT。如果有公共脚本,存放在Share 目录下面 3、子项目下面应该根据功能/TestCase 来存放,如果有公共脚本也应该存放在Share 目录下 4、为存取及备份方便,目录不能使用中文。使用的名称应该尽量与开发保持一致 5、GUI 文件应该存放在脚本的同一目录,并且名称相同 6、正确性测试(使用完全正确数据来检查程序功能是否完成)目录名称规定为validity 以下是一个目录例子 JxBoss -Sales -ChangeSimCard -validity -CheckSimNoExistAnIdError -Share -Share -Account 脚本要求 注释要求 脚本创建及修改说明注释 每个脚本的开头注释格式如下: #脚本名称:文件名称 #创建人:创建人 #创建日期:格式为YYYY/MM/DD #功能:脚本完成的功能描述 #运行前要求:运行前的要打开的窗口及状态要求、数据库中的数据要求、被测试程序运行目录等 #参考文档:描述录制代码是参考的有关设计测试文档 #修改历史: # 修改人: # 修改时间:格式为YYYY/MM/DD # 主要修改内容: 注意创建人及修改人必须是中文完整姓名,不允许使用其它任何名称。运行前的要求一定要描述清楚 子功能注释 在各小段功能前应该加入功能注释,注意不能只是WinRunner 自己产生的注释如: # insert a record # Flight Reservation set_window (Flight Reservation, 1); obj_mouse_click (Button, 13, 16, LEFT); obj_type (MSMaskWndClass,101002); list_select_item (Fly From:, London); # Item Number 2; list_select_item (Fly To:, Paris); # Item Number 3; obj_mouse_click (FLIGHT, 56, 22, LEFT); 注释可以使用英文或中文。 修改代码说明注释 在具体修改的代码附近应该加入如下注释 #修改人 #修改日期 #修改原因/增加功能 注释可以放在一行中,简单修改可以忽略“修改原因/增加功能”,复杂修改应该不能忽 略(简单及复杂标准待定) 代码要求 路径要求 代码中使用的路径都应该使用相对路径,不允许出现类似“d:”、“”下的代码,应该使用类似“.”的代码。 在Script 里面打开和关闭GUI 各Script 的GUI 的文件应该分开保存在与Script 保存在同一个目录,应该使用用 GUI_load 在SCRIPT 开始以前就装载GUI,在SCRIPT 开始增加: if (GUI_load(.login.gui)!=0) pause (Cant load login.gui); texit; 在SCRIPT 完毕的时候加入 GUI_close(.login.gui);关闭GUI,注意代码中的路径一定要使用相对路径。 错误报告 在使用错误报告的时候,应该注意包括出错的脚本文件名称,这样当脚本文件被其他脚本调用时候,也能很清楚在什么地方没有通过。Report_msg 的参数格式定义为“文件名称:错误描述”。同时鉴于WinRunner 的Check 函数不能提供清楚的错误报告,要求错误报告使 用以方式 if ( win_check_bitmap(Flight Reservations, Img1, 1)!=E_OK) report_msg(DateCheck:月份输入错误提示不对!); 附件:一个完整的例子 #脚本名称:DateCheck #创建人:* #创建日期:YYYY/MM/dd #功能:检查FLIGHTA 程序在输入错误月份的时候提示是否正确 #运行前要求:要求FLIGHA 进入定票窗口(New_Order 状态)且无任何数据输入 # 或者FLIGHTA 没有运行,这时候要求FLIGHTA。EXE 位 # 于E:Program FilesMercury InteractiveWinRunnersamplesflightappflight1a.exe #参考文档:无 #修改历史: # 修改人:* # 修改时间:YYYY/MM/dd # 主要修改内容:不采用位图方式,改为直接判断字符串内容 #load gui file #Flight Reservation if (GUI_load(.DateCheck.gui)!=0) report_msg (DataCheck:Cant load .DateCheck.gui); texit; #Check windows exists ,if dont exist ,call login to open it. # Flight Reservation if (win_exists(Flight Reservation)!=E_OK) #pause (Windows Flight Reservation dont exist); #texit; call .loginlogin(); #input error month win_activate (Flight Reservation); set_window (Flight Reservation, 3); obj_mouse_drag (Button_4, 17, 6, 17, 7, LEFT); obj_type (MSMaskWndClass,301212); list_select_item (Fly From:, Denver); # Item Number 0; #check message bitmap # Flight Reservations_1 set_window (Flight Reservations, 3); # #if ( win_check_bitmap(Flight Reservations, Img1, 1)!=E_OK) #static_check_info(Invalid month Entered.The month must be greater than 01 and less than 12.(static),enabled,1); if (static_check_info(CheckMessage,label,Invalid month Entered.The month must be greater than 01 and less than 12.)!=E_OK) #YYYY/MM/DD *修改结束 report_msg(DateCheck:月份输入错误提示不对!); button_press (确定); #close gui file GUI_close(.DateCheck.gui); 101、GUI_save ( file_name );保存guimap文件102、GUI_save_as ( current_file_name, new_file_name );另存为guimap文件103、GUI_set_window ( window_name );设置guimap里目标识别范围104、GUI_unload ( file );卸载guimap文件105、GUI_unload_all ( )卸载全部的guimap文件106、icon_move ( icon, x, y );移动图标到新位置107、icon_select ( icon );点击鼠标选择图标108、java_activate_method( object, method, retval , param1, . param8 );调用请求的java方法109、java_fire_event ( object , class , constructor_param1,., constructor_paramX );模拟一个java对象的事件110、jco_create ( object , jco , class , constructor_param1 , . , constructor_param8 )创建一个现有java对象的上下文java对象111、jco_free ( object_name );释放内存里指定的jco对象112、jco_free_all();释放全部内存里的jco对象113、jdc_aut_connect ( in_timeout );建立一个winrunner和java应用程序的连接114、method_wizard ( object );打开java方法的向导115、obj_key_type ( object, keyboard_input );向java组件发送事件116、obj_set_info ( object, property, value );设置对象属性的值117、popup_select_item ( menu component;menu item );从java活动菜单选择一个选项118、list_activate_item ( list, item , offset );激活列表里某一项119、list_check_info ( list, property, property_value );检查列表属性的值120、list_check_item ( list, item_num, item_content );检查列表某项的内容121、list_check_selected ( list, selected_items );检查选中的那项122、list_collapse_item ( list, item , mouse_button );隐藏树型图里的选项123、list_deselect_item ( list, item , mouse_button , offset );取消选定列表的某一项124、list_deselect_range ( list, item1, item2 , offset );取消选定2个选项125、list_drag_item ( source_list, item , mouse_button );拖动源列表的某个选项126、list_drop_on_item ( target_list, target_item );把一个对象关联到目标列表的选项127、list_expand_item ( list, item , mouse_button );显示隐藏的树型图选项128、list_extend_item ( list, item , button , offset );往指定的列表里添加一个选项129、list_extend_multi_items ( list, item_list, , mouse_button , offset );添加多个选项130、list_extend_range ( list, item1, item2 , button , offset );添加一定范围的选项131、list_get_checked_items ( list, items, number );返回标记的选项的个数和值132、list_get_info ( list, property, out_value );返回列表属性的值133、list_get_item ( list, item_num, out_value );返回列表选项的内容134、list_get_item_coord ( list, item, out_x, out_y, out_width, out_height );返回列表选项的四个坐标135、list_get_item_info ( list, item, state, out_value );返回列表选项的状态136、list_get_item_num ( list, item, out_num );返回列表选项的位置137、list_get_selected ( list, out_item, out_num );返回列表里选定选项的数字和字符串值138、list_select_item ( list, item ,button , offset );选择一个列表选项139、list_select_multi_items ( list, item_list , mouse_button , offset );选择一个列表的多个选项140、list_select_range ( list, item1, item2 , button , offset );选定一定范围内全部选项141、list_wait_info ( list, property, value, time );等待列表属性的值142、menu_get_desc ( menu, oblig, optional, selector, out_desc );返回菜单的物理描述143、menu_get_info ( menu, property, out_value );返回菜单属性的值144、menu_get_item ( menu, item_number, out_contents );返回菜单选项的内容145、menu_get_item_num ( menu, item, out_position );返回菜单选项的位置146、menu_select_item ( menu;item x,y );选择一个菜单选项147、menu_wait_info ( menu, property, value, time );等待菜单属性的值148、obj_check_bitmap ( object, bitmap, time , x, y, width, height );比较对象的位图149、obj_check_gui ( object, checklist, expected_results_file, time );比较当前的gui对象数据150、obj_check_info ( object, property, property_value , timeout );检查gui对象属性的值151、obj_click_on_text ( object, string ,search_area , string_def , mouse_button );在对象里点击文本152、obj_drag ( source_object, x, y , mouse_button );从源对象拖动一个对象153、obj_drop ( target_object, x, y );拖动一个对象到目标对象154、obj_exists ( object , time );检查对象是否显示在屏幕上155、obj_find_text ( object, string, result_array , search_area , string_def );在对象里返回字符串的位置156、obj_get_desc ( object, oblig, optional, selector, out_desc );返回对象的物理描述157、obj_get_info ( object, property, out_value );返回对象属性的值158、obj_get_text ( object, out_text , x1, y1, x2, y2 );读取对象的文本159、obj_highlight ( object , flashes );高亮显示对象160、obj_mouse_click ( object, x, y , mouse_button );点击一个对象161、obj_mouse_dbl_click ( object, x, y , mouse_button );双击一个对象162、obj_mouse_drag ( object, start_x, start_y, end_x, end_y ,mouse_button );在对象上拖动鼠标163、obj_mouse_move ( object, x, y );在对象里移动鼠标指针164、obj_move_locator_text ( object, string , search_area , string_def );在对象里移动鼠标到一个字符串165、obj_type ( object, keyboard_input );用键盘输入对象166、obj_wait_bitmap ( object, bitmap, time , x, y, width, height );等待对象位图出现在屏幕167、obj_wait_info ( object, property, value, time );等待对象属性的值168、scroll_check_info ( scroll, property, property_value );检查滚动条的属性值169、scroll_check_pos ( scroll, position );检查滚动条的当前位置170、scroll_drag ( scroll, orientation, position );滚动到指定位置171、scroll_drag_from_min ( scroll, orientation, position );从最小值开始滚动172、scroll_get_info ( scroll, property, out_value );返回滚动条的属性值173、scroll_get_max ( scroll, orientation, out_max );返回滚动条的最大位置174、scroll_get_min ( scroll, orientation, out_min );返回滚动条的最小位置175、scroll_get_selected ( slider, min_value, max_value );返回滚动条的最小和最大值176、scroll_get_pos ( scroll, orientation, out_pos );返回滚动条当前位置177、scroll_line ( scroll, orientation, +|- lines );滚动指定的几行178、scroll_max ( scroll, orientation );设置滚动条到最大位置179、scroll_min ( scroll, orientation );设置滚动条到最小位置180、scroll_page ( scroll, orientation, +|- pages );移动滚动条指定的页数181、scroll_wait_info ( scroll, property, value, time );等待滚动条属性的值182、spin_get_info ( spin, property, out_value );返回旋转属性的值183、spin_get_pos ( spin, out_value );返回旋转对象的位置184、spin_get_range ( spin, out_min_pos, out_max_pos );返回旋转对象的最小与最大位置185、spin_max ( spin , index );设置旋转对象到最大值186、spin_min ( spin , index );设置旋转对象到最小值187、spin_next ( spin , index );设置旋转对象到下一个值188、spin_prev ( spin , index ); 设置旋转对象到前一个值189、spin_set ( spin, item , index );设置选择对象到一个选项值190、spin_wait_info ( spin, property, value, time );等待旋转属性等于指定的值191、static_check_info ( static, property, property_value );检查静态文本对象属性的值192、static_check_text ( static, text, case_sensitive );检查静态文本对象的内容193、static_get_info ( static, property, out_value );返回静态文本对象属性的值194、static_get_text ( static, out_string );返回静态文本对象的内容195、static_wait_info ( static, property, value, time );等待静态文本对象的属性值196、statusbar_get_field_num ( statusbar, field, field_index );返回状态栏区域的数字索引197、statusbar_get_info ( statusbar, property, out_value );返回状态栏的属性值198、statusbar_get_text ( statusbar, field_index, out_text );读取状态栏区域的文本199、statusbar_wait_info ( statusbar, property, value, time );等待状态栏属性的值200、tab_get_info ( tab, property, out_value );返回tab属性的值201、tab_get_item ( tab, item_num, out_item );返回tab选项的名称 202、tab_get_selected ( tab, out_item, out_num );返回选定的tab选项的名称和个数203、tab_select_item ( tab, item );选择tab选项204、tab_wait_info ( tab, property, value, time );等待tab属性的值205、tbl_activate_cell ( table, row, column );双击表里某个单元206、tbl_activate_col ( table, column );双击表里某列207、tbl_activate_header ( table, column );双击表里某列标题208、tbl_activate_row ( table, row );双击表里某行209、tbl_deselect_col ( table, column );取消选择表的某列210、tbl_deselect_cols_range ( table, from_column, to_column );取消选择表里某几列211、tbl_deselect_row ( table, row );取消选择表里某行212、tbl_deselect_rows_range ( table, from_row, to_row );取消选择表里某几行213、tbl_extend_col ( table, column );往表里当前列加一列214、tbl_extend_cols_range ( table, from_column, to_column );往表里当前列加多列215、tbl_extend_row ( table, row );往表里当前行前加一行216、tbl_extend_rows_range ( table, from_row, to_row );往表里当前行加多行217、tbl_get_cell_data ( table, row, column, out_text );返回表里指定单元的内容218、tbl_get_cols_count ( table, out_cols_count );返回表的列数219、tbl_get_column_name ( table, col_index, out_col_name );返回表里指定列的标题名称220、tbl_get_column_names ( table, out_col_names, out_cols_count );返回表里列的名称和个数221、tbl_get_rows_count ( table, out_rows_count );返回表的行数222、tbl_get_selected_cell ( table, out_row, out_column );返回表里焦点所在单元223、tbl_get_selected_row ( table, row );返回当前焦点所在行224、tbl_select_cells_range ( table, start_row, start_col, end_row, end_col );在表里点击选定的几个单元225、tbl_select_col_header ( table, column );选定指定的列的标题226、tbl_select_cols_range ( table, from_column, to_column );在表里选定指定的几列227、tbl_select_rows_range ( table, from_row, to_row );在表里选定指定的几行228、tbl_set_cell_data ( table, row, column, data );设置表里某单元的内容229、tbl_set_cell_focus ( table, row, column );设置表里焦点到某个单元230、tbl_set_selected_cell ( table, row, column );在表里选定指定的单元231、tbl_set_selected_col ( table, column );在表里选定指定的列232、tbl_set_selected_row ( table, row );在表里选定指定的行233、obj_click_on_text ( object, string ,search_area , string_def , mouse_button );点击一个对象的文本234、obj_find_text ( object, string, result_array , search_area , string_def );返回一个对象字符串的位置235、obj_get_text ( object, out_text , x1, y1, x2, y2 );从对象里读取文本236、obj_move_locator_text ( object, string , search_area , string_def );在对象里把鼠标焦点落在字符串237、win_find_text ( window, string, result_array , search_area , string_def );在一个窗口返回字符串位置238、win_click_on_text (window, string ,search_area , string_def , mouse_button );在窗口搜索文本239、win_get_text ( window, out_text , x1, y1, x2, y2 );从窗口指定的区域读取文本240、win_move_locator_text ( window, string ,search_area ,string_def );在窗口里把鼠标焦点落在字符串241、toolbar_button_press ( toolbar, button, mouse_button );点击工具栏按钮242、toolbar_get_button ( toolbar, button_num, out_text );返回工具栏按钮名称243、toolbar_get_button_info ( toolbar, button, property, out_value );返回工具栏按钮属性值244、toolbar_get_button_num ( toolbar, button, out_num );返回工具栏按钮位置245、toolbar_get_buttons_count ( toolbar, out_num );返回工具栏按钮的个数246、toolbar_select_item ( toolbar, toolbar_item_chain , mouse_button );选择类菜单工具栏的某项247、web_browser_invoke ( browser, site );调用ie打开某个站点248、web_cursor_to_image ( image, x, y );移动鼠标指针到某个图片249、web_cursor_to_label ( label, x, y );移动鼠标指针到某个标签250、web_cursor_to_link ( link, x, y );移动鼠标指针到某个链接251、web_cursor_to_obj ( object, x, y );移动鼠标指针到某个对象252、web_event ( object, event_name , x , y );在指定对象运行一个事件253、web_file_browse ( object );点击浏览按钮254、web_file_set ( object, value );在文件类型的对象设置文本值255、web_find_text ( frame, text_to_find, result_array , text_before, text_after, index, show );返回帧内文本位置256、web_frame_get_text ( frame, out_text , text_before, text_after, index );返回帧内文本的内容257、web_frame_get_text_count ( frame, regex_text_to_find, count );返回帧内标准表达式的事件个数258、web_frame_text_exists ( frame, text_to_find , text_before, text_after );检查帧内指定的文本字符串是否存在259、web_get_run_event_mode ( out_mode );返回当前的运行模式260、web_get_timeout ( out_timeout );返回winrunner响应web的最大等待时间261、web_image_click ( image, x, y );点击一个图片链接或图片262、web_label_click ( label );点击指定的标签263、web_link_click ( link );点击朝文本链接264、web_link_valid ( name, valid );检查url链接是否有效265、web_obj_get_child_item ( object, table_row, table_column, object_type, index, out_object );返回对象的子对象的物理描述266、web_obj_get_child_item_count ( object, table_row, table_column, object_type, object_count );返回对象的子对象的个数267、web_obj_get_info ( object, property_name, property_value );返回对象属性的值268、web_obj_get_text ( object, table_row, table_column, out_text , text_before, text_after, index );返回对象的文本字符串269、web_obj_get_text_count ( object, table_row, table_column, regex_text_to_find, count ); 返回对象内标准表达式的事件个数270、web_obj_text_exists ( object, table_row, table_column, text_to_find , text_before, text_after );在对象里如果该文本存在,返回该文本271、web_refresh ( frame );winrunner重新连接指定的帧272、web_restore_event_default ( );重新设置全部事件为默认值273、web_set_event ( class, event_name, event_type, event_status );设置事件状态274、web_set_run_event_mode ( mode );设置事件运行模式275、web_set_timeout ( timeout );设置winrunner响应web的最大时间276、web_set_tooltip_color ( fg_color, bg_color );设置webtest工具条的颜色277、web_sync ( timeout );等待帧的导航完成278、web_tbl_get_cell_data ( table, row, column, starting_pos, out_text, out_actual_text_length );返回web表内指定单元的内容,开始于指定的字符279、web_url_valid ( URL, valid );检查url是否有效280、tbl_get_cell_data ( table, row, column, out_text );返回table里指定单元的内容(加载webtest)281、tbl_get_cols_count ( table, out_cols_count );返回表的列数(加载webtest)282、tbl_get_column_name ( table, col_index, out_col_name );返回表里指定列的标题的名称(加载webtest)283、tbl_get_rows_count ( table, out_rows_count );返回表的行数(加载webtest)284、web_password_encrypt ( password );将web页面的密码加密285、set_window ( window ,time );激活窗口并确定等待时间286、win_activate ( window );激活窗口287、win_check_bitmap ( window, bitmap, time , x, y, width, height );比较窗口的位图288、win_check_gui ( window, checklist, expected_results_file, time );比较窗口的gui数据289、win_check_info ( window, property, property_value , timeout );检查被请求的窗口属性290、win_click_help ( window );在窗口点击帮助按钮291、win_click_on_text (window, string ,search_area , string_def , mouse_button );在窗口搜索文本292、win_close ( window );关闭窗口293、win_drag (source_window, x, y , mouse_button );从源窗口拖动对象294、win_drop ( target_window, x, y );拖动对象到目标窗口295、win_exists ( window , time );检查窗口是否显示在屏幕上296、win_find_text ( window, string, result_array , search_area , string_def );返回窗口里字符串的位置297、win_get_desc ( window, obligatory, optional, selector, out_desc );返回窗口的物理描述298、win_get_info ( window, property, out_value );返回窗口属性的值299、win_get_text ( window, out_text , x1, y1, x2, y2 );从窗口指定区域读取文本300、win_highlight ( window , flashes );高亮显示窗口301、win_max ( window );最大化窗口到全屏302、最小化窗口为一个图标303、win_mouse_click ( window, x, y , mouse_button , modifier );在窗口点击鼠标304、win_mouse_dbl_click ( window, x, y , mouse_button , modifier );在窗口双击鼠标305、win_mouse_drag ( window, start_x, start_y, end_x, end_y , mouse_button );在窗口做鼠标拖动操作306、win_mouse_move ( window, x, y );移动鼠标焦点到指定的位置307、win_move ( window, x, y )

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论