分类:
2008-10-15 16:44:51
1,report_msg : prints a user-defined string expression to the test run report
2, pause : The pause function stops the test run and displays a string expression in a message box on the screen
report_Msg和pause是在Win下显示的信息,在UNIX下是printf
3, radio_button : 控制按扭属性是ON还是OFF,如:
set_window ("Flight Reservation", 3);
button_set ("{class: radio_button, MSW_class: Button, label: Business}", ON);
4, return[expression] : 返回值
5,脚本格式 :
Test Header :
---------> Test Name
---------> Subject
---------> Test Creator
---------> Date of creation/Date of revision
---------> Purpose of the test
正式脚本
6,static const
7,[static/public]
8, 三种判断方式
------->if (win_exists ("Window_Name") == 0) {
set_window ("Window_Name");
--------> if (!win_exists ("Window_Name")) {
set_window ("Window_Name");
---------> if (win_exists ("Window_Name") == E_OK) {
set_window ("Window_Name");
9,自己创建错误提示代码的协定
-------->Error codes should be in capital letters.必须为大写字母
-------->Error codes should begin with the letter “E” followed by an underscore (for example, E_MY_ERROR).
-------->Error code numbers should include a dash “-” followed by a five digit value (for example, -31001).
-------->Error codes should be defined as public in a library or initialization test or example, public const E_MY_ERROR = -31001).
10, GUI_Load和GUI_Unload
GUI_Load(file_name): 加载GUI的MAP文件,加载的是全路径
GUI_unload( ): 释放GUI文件
如:
# This loads the GUI file
GUI_load ("E:\\file1.gui");
GUI_list_map_buffers(out_file, out_buffer);
# The out_file contain the loaded gui file file1.gui.
GUI_unload (file1.gui);
# This unloads the GUI file
GUI_list_map_buffers(out_file, out_buffer);
# Now the out_file array does not contain file1.
11,tl_step : 可以输出一些的信息
12, Function Header
The function header is placed above a user defined function. Like the Test
Header, the function header is enclosed by the "#" symbol and stores
information about the function:
>Function Name
>Descrīption or purpose of the function
>Input parameters
>Output parameters
>Return Values
For example:
################################################################
# FUNCTION: get_flight_from_table
# PURPOSE: This function is static only to this file. It selects a flight from the
# flight table using a given flight number. Also uses split() function to access the
# flight number from the table.
#
# INPUT PARAMS: flight_num The flight number to be selected.
# OUTPUT PARAMS: none
# RETURN VALUES: Standard return values.
###############################################################
static function get_flight_from_table (in flight_num){...
13, TSL includes four types of functions:
>Context Sensitive functions perform specific tasks on GUI objects, such as
clicking a button or selecting an item from a list. Function names, such as
button_press and list_select_item, reflect the function’s purpose.
>Analog functions depict mouse clicks, keyboard input, and the exact
coordinates traveled by the mouse.
>tandard functions perform general purpose programming tasks, such as
sending messages to a report or performing calculations.
>Customization functions allow you to adapt WinRunner to your testing
environment.