51Testing软件测试论坛
标题:
LoadRunner用参数设置关联(学习中~~)
[打印本页]
作者:
chipucca
时间:
2010-11-5 15:52
标题:
LoadRunner用参数设置关联(学习中~~)
本帖最后由 chipucca 于 2010-11-5 15:58 编辑
本人是做SAP测试的,刚刚学的LoadRunner也全部是在SAP 7.0系统中练习的。
现将自己做的一个脚本中的action发表如下,希望大家来提出宝贵意见~~呵呵
先上练习的case:
OX10 Record all the plants
ME2W supplying plant All the palnts recorded above
Click Execute
action内容如下:
Action()
{
int i;
char str[10];
sapgui_open_connection_ex(" /SAP_CODEPAGE=1100 /FULLMENU **.**.**.** /3 /UPDOWNLOAD_CP=2",
"DEMO ECC 6.0",
"con[0]");
sapgui_select_active_connection("con[0]");
sapgui_select_active_session("ses[0]");
sapgui_select_active_window("wnd[0]",
LAST);
/*Before running script, enter password in place of asterisks in logon function*/
lr_think_time(17);
sapgui_logon("*****",
"
**************
",
"501",
"EN",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1019",
END_OPTIONAL);
lr_think_time(24);
for(i=0;i>-1;i++)
{
itoa(i, str, 10 );
lr_save_string( str, "Row" );
sapgui_set_ok_code("ox10",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1020",
END_OPTIONAL);
sapgui_send_vkey(ENTER,
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1021",
END_OPTIONAL);
lr_think_time(5);
lr_save_int(i,"row");
sapgui_get_text("GetPlantID",
"ses[0]/wnd[0]/usr/tblSAPL0ORGTCTRL_V_T001W/ctxtV_T001W-WERKS[0,{Row}]",
"GetPlantID",
LAST);
lr_output_message(lr_eval_string("{GetPlantID}"));
lr_output_message(lr_eval_string("{Row}"));
sapgui_press_button("Exit (Shift+F3)",
btn1,
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1027",
END_OPTIONAL);
if(strcmp(lr_eval_string ("{GetPlantID}"),"____")==0){
lr_output_message ("__________________________Seach END______________________________");
break;
}
sapgui_set_ok_code("me2w",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1030",
END_OPTIONAL);
sapgui_send_vkey(ENTER,
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1031",
END_OPTIONAL);
lr_think_time(9);
sapgui_set_text("EW_RESWK-LOW",
"{GetPlantID}",
ctxtEW_RESWK1,
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1034",
END_OPTIONAL);
lr_output_message(lr_eval_string("{GetPlantID}"));
sapgui_press_button("Execute (F8)",
btn2,
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1036",
END_OPTIONAL);
sapgui_status_bar_get_text("paramStatusBarText",
BEGIN_OPTIONAL,
"Recorded status bar text: No suitable purchasing documents found",
"AdditionalInfo=sapgui1039",
END_OPTIONAL);
lr_think_time(6);
sapgui_press_button("Exit (Shift+F3)",
btn1,
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1040",
END_OPTIONAL);
lr_think_time(4);
}
sapgui_press_button("Log off (Shift+F3)",
btn1,
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1043",
END_OPTIONAL);
sapgui_select_active_window("wnd[1]",
LAST);
sapgui_press_button("Yes",
btnSPOP1,
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1046",
END_OPTIONAL);
return 0;
}
*******************************************************************
真心希望大家能提出宝贵意见,一起进步~~
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2