s
start
loadrunner sap docs
http://www.sap.com/demos/richmedia/demos/sap-loadrunner-by-hp-optimize-the-quality-performance-and-scalability-of-end-to-end-business-processes-demo-us.epx
sap download
http://it.***.com/SNsoft/SAP_GUI_710.ZIP
http://it.***.com/SNsoft/gui710_13-10002995.exe
http://it.***.com/SNsoft/services.rar
http://it.***.com/SNsoft/SAP710(PeiZhi)V1.0.pdf
sap jco download
G:\projects\s*****_sap\sap_jco>dir
librfc32.dll // 2006/06/15 20:37 5,251,072
librfc32.dll.rar
lrapi.jar
sap-jco-3.0.8.jar
sapawrfc.dll
sapawrfc.rar
sapjco-linuxintel-2.1.8.rar
sapjco-linuxintel-2.1.8.tgz
sapjco.jar
sapjco.jar.png
sapjco3.dll
sapjco3.dll.rar
sapjco3_ntintel_32-3.0.8.dll
sapjco3_ntintel_32-3.0.8.rar
sapjco3_ntintel_64-3.0.8.dll
sapjco3_ntintel_64-3.0.8.rar
sapjcorfc.dll // 2006/06/15 20:37 3,723,264
sapjcorfc.dll.rar
snf-sap-jco-3.0.8.jar
snf-sap-jco-3.0.8.jar.png
snf-sap4j-1.0.2.jar
loadrunner sap 脚本无法录制问题解决
1、录制脚本需先登陆SAPGUI更改下述参数sapgui/user_scripting,缺省值为FALSE,该情况下不能录制脚本。需更改为true。
更改方法:
(1)查看Tcode:RZ11
(2)输入参数名称 sapgui/user_scripting
(3)更改为TRUE即可
loadrunner SAP 脚本录制,需SAP userscript 设置true即可录制。
D:\soft\sap\SAP_GUI_710\NW_2004s_Presentation\PRES1\GUI\WINDOWS\WIN32\SapGuiSetup.exe
prompt
please switch your terminal server to install mode before running SAPsetup .You can do this using the commandline "change user/install" and reset to execute mode using "change user/ execute "after installation . Do you want to correct your server mode Now ?
dos 输入
Microsoft Windows [版本 5.2.3790]
(C) 版权所有 1985-2003 Microsoft Corp.
C:\Documents and Settings\Administrator>change user /install
用户会话已准备好安装应用程序。
C:\Documents and Settings\Administrator>change user /execute
用户会话已准备好执行应用程序。
C:\Documents and Settings\Administrator>
再次重启电脑,点NO后,安装界面出现了
windows 2003 x64 sap patch setup sap gui 7.10 patch patchlevel 13
D:\soft\sap\gui710_13-10002995.exe
sap run
C:\Program Files (x86)\SAP\SapSetup\setup\SAL\SapLogon.s81
sap configuration
连接类型:自定义应用服务器
系统连接参数:
描述:my_sap_test
应用程序服务器:192.168.118.169
系统编号:00
系统标识:CRM
SAProute 字符串:null
loadrunner sap start sample
D:\Program Files (x86)\Mercury Interactive\Mercury LoadRunner\bin\LRLauncherApp.exe
-- File -- New Single Protocol Script -- SAPGUI -- OK
Start Recording
Applicatoin type:Win32 Applications
Program to record:D:\Program Files (x86)\SAP\SAPgui\saplogon.exe
Program arguments:null
Working directory:D:\Program Files (x86)\SAP\SAPgui
Recording into Action:Action
Record the application startup(勾选 pitch on)
ok
action.h
Action() { sapgui_open_connection_ex(" /SAP_CODEPAGE=1100 /FULLMENU 192.168.118.169 00 /3 /UPDOWNLOAD_CP=2", "s*****_SAP_test", "con[1]"); sapgui_select_active_connection("con[1]"); sapgui_select_active_session("ses[0]"); sapgui_select_active_window("wnd[0]"); sapgui_window_maximize( BEGIN_OPTIONAL, "AdditionalInfo=sapgui104", END_OPTIONAL); lr_start_transaction("登陆信息"); /*Before running script, enter password in place of asterisks in logon function*/ lr_think_time(24); sapgui_logon("wangqiang1", "654321", "200", "ZH", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1017", END_OPTIONAL); // 这里登录密码默认为星号,可改为明文654321,运行ok lr_think_time(4); sapgui_tree_set_selected_node("CIC0 - 联系中心 WinClient", shell1, "F00086", BEGIN_OPTIONAL, "AdditionalNodeInfo=收藏夹;CIC0 - 联系中心 WinClient", "AdditionalInfo=sapgui1018", END_OPTIONAL); sapgui_tree_press_key("Enter", shell1, "Enter", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1019", END_OPTIONAL); lr_think_time(6); sapgui_toolbar_press_button("??BP", shell2, "BPCR", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1022", END_OPTIONAL); lr_think_time(44); sapgui_set_text("姓 名", "*** ", txtUSER1, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1025", END_OPTIONAL); sapgui_set_text("移动电话", "138********", txtUSER2, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1026", END_OPTIONAL); // 这里手机号可以参数化,以便下次能继续run ok sapgui_set_text("Email", "[email protected]", txtUSER3, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1027", END_OPTIONAL); sapgui_set_text("证件号码", "320924198803225174", txtUSER4, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1028", END_OPTIONAL); sapgui_set_focus(ctxtUSER1, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1029", END_OPTIONAL); sapgui_send_vkey(F4, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1031", END_OPTIONAL); lr_think_time(4); sapgui_select_active_window("wnd[1]"); sapgui_window_scroll_to_row("0", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1035", END_OPTIONAL); sapgui_set_focus(lbl1, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1034", END_OPTIONAL); sapgui_send_vkey(F2, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1038", END_OPTIONAL); lr_think_time(4); sapgui_select_active_window("wnd[0]"); sapgui_send_vkey(ENTER, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1042", END_OPTIONAL); lr_think_time(14); sapgui_set_focus(cmbUSER1, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1045", END_OPTIONAL); sapgui_select_combobox_entry("玄武区", cmbUSER1, "2", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1046", END_OPTIONAL); sapgui_select_combobox_entry("淮海路快递点", cmbUSER2, "025021A", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1049", END_OPTIONAL); lr_think_time(19); sapgui_set_text("路/道/街", "常府街 ", txtUSER5, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1052", END_OPTIONAL); sapgui_set_text("邮 编", "210005", txtUSER6, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1053", END_OPTIONAL); sapgui_set_focus(txtUSER6, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1054", END_OPTIONAL); sapgui_press_button("保存", btnSAVE1, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1056", END_OPTIONAL); sapgui_status_bar_get_text("paramStatusBarText", BEGIN_OPTIONAL, "Recorded status bar text: 业务合作伙伴 1800490350 已创建 ", "AdditionalInfo=sapgui1059", END_OPTIONAL); lr_think_time(52); sapgui_toolbar_press_button("????", shell2, "ZS02", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1060", END_OPTIONAL); lr_end_transaction("登陆信息",LR_AUTO); lr_start_transaction("创建辅助安装订单"); lr_think_time(34); sapgui_set_text("ZCRMT_0100_BTX_UI02-ZZDQSPID", "101000451", ctxtZCRMT_0100_BTX_UI021, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1063", END_OPTIONAL); sapgui_send_vkey(ENTER, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1065", END_OPTIONAL); sapgui_select_active_window("wnd[1]"); sapgui_tree_set_hierarchy_header_width("135", shell3, "135", BEGIN_OPTIONAL, "AdditionalNodeInfo=", "AdditionalInfo=sapgui1068", END_OPTIONAL); sapgui_tree_select_item("SORG.1001, &Hierarchy", shell3, " 4", "&Hierarchy", BEGIN_OPTIONAL, "AdditionalNodeInfo=销售 ( 唯一 );SORG.1001", "AdditionalInfo=sapgui1069", END_OPTIONAL); sapgui_tree_scroll_to_item("SORG.1001, &Hierarchy", shell3, " 4", "&Hierarchy", BEGIN_OPTIONAL, "AdditionalNodeInfo=销售 ( 唯一 );SORG.1001", "AdditionalInfo=sapgui1070", END_OPTIONAL); sapgui_tree_set_checkbox("SORG.1001, &Hierarchy, True", shell3, " 4", "&Hierarchy", "True", BEGIN_OPTIONAL, "AdditionalNodeInfo=销售 ( 唯一 );SORG.1001", "AdditionalInfo=sapgui1071", END_OPTIONAL); sapgui_press_button("确定 (Enter)", btn1, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1074", END_OPTIONAL); lr_think_time(34); sapgui_select_active_window("wnd[0]"); sapgui_select_combobox_entry("保内", cmbZCRMT_0100_BTX_UI021, "0", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1077", END_OPTIONAL); sapgui_select_combobox_entry("安装", cmbZCRMT_0100_BTX_UI022, "01", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1078", END_OPTIONAL); sapgui_set_text("GS_CUSTOM_ADDR-TEL_NUMBER", "02512345678", txtGS_CUSTOM_ADDR1, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1079", END_OPTIONAL); sapgui_set_focus(ctxtGS_SERVICE_ORDER_H1, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1080", END_OPTIONAL); sapgui_send_vkey(F4, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1082", END_OPTIONAL); sapgui_select_active_window("wnd[1]"); sapgui_calendar_focus_date("2011-11-25", shell4, "20111125", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1085", END_OPTIONAL); sapgui_calendar_select_interval("2011-11-25-2011-11-25", shell4, "20111125,20111125", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1086", END_OPTIONAL); lr_think_time(10); sapgui_select_active_window("wnd[0]"); sapgui_select_combobox_entry("上午", cmbGS_SERVICE_ORDER_H1, "09", BEGIN_OPTIONAL, "AdditionalInfo=sapgui1089", END_OPTIONAL); sapgui_set_focus(lblTEXT_01801, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1090", END_OPTIONAL); sapgui_press_button("展开组织", btnPB_ORG_EXPAND1, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1092", END_OPTIONAL); lr_think_time(6); sapgui_press_button("保存订单", btnAA_BUT101, BEGIN_OPTIONAL, "AdditionalInfo=sapgui1095", END_OPTIONAL); sapgui_status_bar_get_text("paramStatusBarText", BEGIN_OPTIONAL, "Recorded status bar text: 事务 7100019113 已保存", "AdditionalInfo=sapgui1098", END_OPTIONAL); // 上面可以精简成这样sapgui_status_bar_get_text("paramStatusBarText"); lr_end_transaction("创建辅助安装订单",LR_AUTO); return 0; }
LoadRunner Java Vuser / loadrunner java properties 文件未部署到agent机器C盘特定temp目录里导致压测异常解决 / zhunianxi 14090090 / 建议带有配置文件的java应用,如xml、properties都打成jar调用最好。
loadrunner java exception / 业务测试脚本如下:
D:\TestCase\20141008_datacenter_cassandra\tc_cassandra_GetResultMap_Batch\libra.perperties
# pre com.s*****.libra.cassandra.hosts=10.27.15.71,10.27.15.72,10.27.15.73 com.s*****.cassandra.keyspace=libra # sit #com.s*****.libra.cassandra.hosts=10.27.39.206,10.27.39.208 #com.s*****.cassandra.keyspace=libra
D:\TestCase\20141008_datacenter_cassandra\tc_cassandra_GetResultMap_Batch\tc_cassandra_GetResultMap_Batch.usr
/* * LoadRunner Java script. (Build: _build_number_) * * Script Description: * */ import lrapi.lr; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import com.s*****.libra.cassandra.GetResultCallback; import com.s*****.libra.client.LibraClient; import com.s*****.libra.client.LibraClientImpl; public class Actions { public int init() throws Throwable { return 0; }//end of init public int action() throws Throwable { lr.start_transaction("批量发送6条sql请求cassandra"); LibraClient c = new LibraClientImpl(); String epl = ""; System.out.println(epl); Map groupByMap = new HashMap (); groupByMap.put("time_slot", "20140910_545"); c.getResultMap_Batch(epl, groupByMap, null, 2000, new GetResultCallback() { public void finish() { } public void callback(List
D:\TestCase\20141008_datacenter_cassandra\lib
2014-10-09 09:59 252,828 antlr4-runtime-4.1.jar 2014-10-09 09:59 281,694 bsh-2.0b4.jar 2014-10-09 09:59 541,332 cassandra-driver-core-2.0.3.jar 2014-10-09 09:59 322,362 cglib-nodep-2.2.jar 2014-10-09 09:59 160,519 commons-dbcp-1.4.jar 2014-10-09 09:59 60,686 commons-logging-1.1.1.jar 2014-10-09 09:59 111,119 commons-pool-1.6.jar 2014-10-09 09:59 2,833,724 db2jcc-9.5.3.jar 2014-10-09 09:59 313,898 dom4j-1.6.1.jar 2014-10-09 11:20 5,942,618 esper-s*****5.0.0-2.0.1.jar 2014-10-09 09:59 316,907 fastjson-1.1.15.jar 2014-10-09 09:59 2,228,009 guava-16.0.1.jar 2014-10-09 09:59 31,284 jcommander-1.12.jar 2014-10-09 09:59 245,039 junit-4.11.jar 2014-10-09 11:22 10,123 libra-client-2.0.1.jar 2014-10-09 11:20 118,121 libra-common-2.0.1.jar 2014-10-09 09:59 481,535 log4j-1.2.16.jar 2014-10-09 09:59 85,448 metrics-core-3.0.2.jar 2014-10-09 09:59 875,336 mysql-connector-java-5.1.28.jar 2014-10-09 09:59 1,231,993 netty-3.9.0.Final.jar 2014-10-09 09:59 25,515 org.abego.treelayout.core-1.0.1.jar 2014-10-09 09:59 23,445 slf4j-api-1.5.8.jar 2012-11-23 14:32 8,620 slf4j-log4j12-1.4.2.jar 2014-10-09 09:59 232,121 snakeyaml-1.6.jar 2014-10-09 09:59 597,777 testng-6.3.1.jar 2014-10-09 09:59 109,318 xml-apis-1.0.b2.jar
loadrunner java exception / loadrunner 场景测试异常报错如下:
D:\TestCase\20141008_datacenter_cassandra\Scenario_tc_cassandra_GetResultMap_Batch.lrs
Error: System.err: java.lang.ExceptionInInitializerError
Error: java.lang.NoClassDefFoundError: Could not initialize class com.s*****.libra.client.Configuration
Error: at com.s*****.libra.client.LibraClientImpl.
at Actions.action(Actions.java:27)
Error: System.err: Caused by: java.lang.NullPointerException
Error: at com.s*****.libra.client.LibraClientImpl.
at Actions.action(Actions.java:27)
Caused by: java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:418)
at java.util.Properties.load0(Properties.java:337)
at java.util.Properties.load(Properties.java:325)
at com.s*****.libra.client.Configuration.init(Configuration.java:40)
at com.s*****.libra.client.Configuration.
... 2 more
查找loadrunner agent 机器的日志
\\10.19.95.1\c$\Documents and Settings\Administrator\Local Settings\Temp\brr_UiR.449\netdir\D\TestCase\20141008_datacenter_cassandra\tc_cassandra_GetResultMap_Batch\res\log\tc_cassandra_getresultmap_batch_10.log
Start auto log messages stack - Iteration 1. [MsgId: MMSG-10545] Starting action Actions. [MsgId: MMSG-15919] Notify: Transaction "111" started. [MsgId: MMSG-16999] System.err: java.lang.NoClassDefFoundError: Could not initialize class com.s*****.libra.client.Configuration Error [MsgId: MMSG-17999] System.err: at com.s*****.libra.client.LibraClientImpl.(LibraClientImpl.java:33) Error [MsgId: MMSG-17999] System.err: at Actions.action(Actions.java:27) Error [MsgId: MMSG-17999] Error: java.lang.NoClassDefFoundError: Could not initialize class com.s*****.libra.client.Configuration [MsgId: MERR-17999] Error: at com.s*****.libra.client.LibraClientImpl. (LibraClientImpl.java:33) at Actions.action(Actions.java:27) [MsgId: MERR-17999] End auto log messages stack. [MsgId: MMSG-10544]
LoadRunner Java Vuser / loadrunner java properties 文件未部署到agent机器C盘特定temp目录里导致压测异常解决 / zhunianxi 14090090 / phone_md5:772d13e62aa14a9b2c900b24527b0cb4
解决方法:找到loadrunner controller 把java 脚本传递 到loadrunner agent 机器的路径带有netdir的类似目录,找到后放入lira.properties文件,如下:
,
ok
Narya性能测试(二) / Error (-17998): Failed to get [param not passed in call] thread TLS entry. 解决
http://kevindude.iteye.com/blog/869744
本来想用LoaderRunner对Narya的网络性能再做一次测试,LR的java vuser可以直接用java来编写测试脚本,本来还是挺方便的,但是不知道为什么脚本一跑起来就报这么个错:
Error (-17998): Failed to get [param not passed in call] thread TLS entry.
实在是有点郁闷的,网上搜索了很久也没找到个所以然,只是有人模模糊糊的指出,有可能是LR的java vuser脚本不支持多线程。想来也是,LR是靠license的并发数来卖钱的,如果你一个vuser可以开多个线程,每个vuser开100个线程,那一个100人的license就可以当1万人来用了,但我们narya的一个client本身就要开几个线程,看来是无法用LR来测了。
好在开源的社区里还有一个叫JMeter的性能测试工具。我们希望通过工具能够更灵活的来配置我们的测试用例,包括并发用户数,每个用户发送的请求数,和每个请求之间的间隔时间等。JMeter内置了一种叫做java sampler的sampler,我们需要继承AbstractJavaSamplerClient这个类,实现它的下面这个方法。
public SampleResult runTest(JavaSamplerContext javasamplercontext)
请问Error-27780:Connection reset by peer错误该怎么解决
http://bbs.51testing.com/thread-512650-1-1.html
给后来人一些提示吧:
HTTPS脚本加: web_set_sockets_option("SSL_VERSION","TLS"); //设置HTTPS相关信息,版本可以SSL通过浏览器查看
头信息加: web_add_header("X-Requested-With", "XMLHttpRequest");//设置相关头信息,根据每个产品的而定,可以抓包查看,也可以在录制的时候录制所有的头信息
报错案例二
Starting action Action. Action.c(6): Notify: Transaction "http-post 请求" started. Action.c(8): web_submit_data("http-post") started [MsgId: MMSG-26355] Action.c(8): t=608ms: Connecting [0] to host 10.27.84.101:443 [MsgId: MMSG-26000] Action.c(8): t=611ms: Connected socket [0] from 10.19.95.13:34737 to 10.27.84.101:443 in 1 ms [MsgId: MMSG-26000] Action.c(8): Error -27780: [GENERAL_MSG_CAT_SSL_ERROR]connect to host "10.27.84.101" failed: [10054] Connection reset by peer [MsgId: MERR-27780] Action.c(8): t=619ms: Closed connection [0] to 10.27.84.101:443 after completing 0 requests [MsgId: MMSG-26000] Action.c(8): Warning -26000: Empty or no response for URL="https://10.27.84.101/foo?name=111&passd=222&user=xxx&nick=rrr&id=333&name1=111&passd1=222&user1=xxx&nick1=rrr&id1=333" [MsgId: MWAR-26000] Action.c(8): web_submit_data("http-post") highest severity level was "ERROR", 0 body bytes, 0 header bytes [MsgId: MMSG-26388] Action.c(8): Notify: Transaction "http-post 请求" ended with "Fail" status (Duration: 0.6737 Wasted Time: 0.6013). Ending action Action.
案例二解决方案 / SSL与TLS 区别 以及介绍 http://hengstart.iteye.com/blog/840561
主站的证书从ssl3.0更换成TLS1.0,LR默认是ssl3.0的;在脚本开始加个函数就解决了,函数如下:
web_set_sockets_option("SSL_VERSION","TLS");
JAVA连接SAP配置(LIB包在SAP LIB中)
D:\lr>tree /f
卷 data 的文件夹 PATH 列表
卷序列号为 C8CE-1864
D:.
├─bin
│ librfc32.dll
│ sapjco3.dll
│ sapjcorfc.dll
└─classes
sapjco.jar
snf-sap-jco-3.0.8.jar
D:\>lr\classes\sapjco.jar
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.4
Created-By: 1.3.1_18-b01 (Sun Microsystems Inc.)
Specification-Title: SAP Java Connector
Specification-Version: 2.1.7
Specification-Vendor: SAP AG, Walldorf
Implementation-Title: com.sap.mw.jco
Implementation-Version: 20060615 2037 [2.1.7 (2006-06-12)]
Implementation-Vendor-Id: com.sap
Implementation-Vendor: SAP AG, Walldorf
Main-Class: com.sap.mw.jco.About
D:\>lr\classes\snf-sap-jco-3.0.8.jar
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: 11080241
Build-Jdk: 1.6.0_29
Main-Class: com.sap.conn.jco.rt.About
sapjco-linuxintel-2.1.8.tgz
H:\projects\sap_jco\sapjco-linuxintel-2.1.8>ls -l
total 8965
-rw-rw-rw- 1 user group 354 Jan 9 2007 Readme.txt
drwxrwxrwx 1 user group 0 Apr 25 18:22 demo
drwxrwxrwx 1 user group 0 Apr 25 18:22 docs
-rw-rw-rw- 1 user group 5046073 Jan 9 2007 librfccm.so
-rw-rw-rw- 1 user group 3827533 Jan 9 2007 libsapjcorfc.so
-rw-rw-rw- 1 user group 304418 Jan 9 2007 sapjco.jar
1)SUN JDK1.5(API 运行)
WINDOWS
把librfc32.dll,sapjcorfc.dll放入WINDOWS SYSTEM32目录下项目中引用sapjco.jar。
LINUX
把librfccm.so,libsapjcorfc.so 放入任意目录并且在.brash.rc文件中引入环境变量。项目中引用sapjco.jar。
2)IBM WEBSPHERE JDK1.5(WEB 运行)
LINUX
把librfccm.so,libsapjcorfc.so 放入IBM/WebSphere/AppServer/bin中并在.brash.rc文件中引入该目录环境变量。在IBM/WebSphere/AppServer/lib/中加入sapjco.jar。
测试环境是否成功:bash-2.05b# /export/home/oracle/midtier/jdk/jre/bin/java -jar sapjco.jar -stdout
Loadrunner8.1 + JDK1.5如何解决System Exceptions: EXCEPTION_ACCESS_VIOLATION
http://www.51testing.com/?uid-114582-action-viewspace-itemid-234320
Java Vuser协议的遇到Exception was raised when calling abort-cleanup function in extension java_int.dll: System Exceptions: EXCEPTION_ACCESS_VIOLATION问题,现讲解下这个问题的解决方法。
首先,保证纯净的操作系统
我 之前装的是Loadrunner9.5,准备配JDK1.6,最后怎么都是报错,然后采用Loadrunner8.1 + JDK1.5问题依旧,最后重装了系统,采用Loadrunner8.1 + JDK1.5问题解决。连网上说的A_lrunner_java_protocol_fixes_Feb_05.exe的补丁也未打。
http://dl.iteye.com/topics/download/7a339524-b7a3-382e-a729-0e03cec0417e
http://www.51testing.com/ddimg/uploadsoft/20091222/LR_java.zip
其次:确认JDK环境变量是否正确设置
Windows xp下配置JDK环境变量:
1.安装JDK,安装过程中可以自定义安装目录等信息,例如我们选择安装目录为D:\java\jdk1.5.0_08;
2.安装完成后,右击“我的电脑”,点击“属性”;
3.选择“高级”选项卡,点击“环境变量”;
4.在“系统变量”中,设置3项属性,JAVA_HOME,PATH,CLASSPATH(大小写无所谓),若已存在则点击“编辑”,不存在则点击“新建”;
5.JAVA_HOME指明JDK安装路径,就是刚才安装时所选择的路径D:\java\jdk1.5.0_08,此路径下包括lib,bin,jre等文件夹(此变量最好设置,因为以后运行tomcat,eclipse等都需要依*此变量);
Path使得系统可以在任何路径下识别java命令,设为:
%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
CLASSPATH为java加载类(class or lib)路径,只有类在classpath中,java命令才能识别,设为:
.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar (要加.表示当前路径)
%JAVA_HOME%就是引用前面指定的JAVA_HOME;
6.“开始”->;“运行”,键入“cmd”;
7.键入命令“java -version”,“java”,“javac”几个命令,出现画面,说明环境变量配置成功;
8. DOS中查看相关环境变量是否正常显示echo %path%,echo %classpath%,echo %java_home%。
再则,相关的Class有没有Import进去。
保证上面三步,就可以解决System Exceptions: CEPTION_ACCESS_VIOLATION报错问题。
[原创]如何解决LodRunner中报错关于Error -10489 : Exception was raised when calling per-thread-terminate function
http://www.cnblogs.com/mayingbao/archive/2006/05/27/410708.html
[原创]如何解决LodRunner中报错关于Error -10489 : Exception was raised when calling per-thread-terminate function 在用Loadrunner实施性能测试时,采用Goal模式加压,存在如果持续长时加压时LoadRunner的Controller会报 Error -10489 : Exception was raised when calling per-thread-terminate function错误;
问题产生原因:
Unlike the earlier Windows versions, Windows 2000 and Windows XP have the default environment set to C:\Document and Settings\
解决方法:
在C盘(或是其它盘均可以)新建TEMP文件夹(为了后续设置临时文件准备)
右键"我的电脑"->高级->环境变量->编辑修改TEMP变量目录,指身上面新建的目录,如我的指向C:\TEMP->保存即可^_^
SAP ATP 应用服务负载均衡 192.168.40.224 test
http://mylinux.5d6d.com/thread-913-1-1.html
http://hi.baidu.com/%BD%A3%CA%A5_%B7%A8%CA%A6/blog/item/5299cc09e2d8b5c23ac763fe.html
共两步,一是服务器的设置,二是客户端登陆设置。
先在SAP中使用SMLG 进行服务器分组。实例名是SAP系统中定义过的,你没法删也没改。。我们先建一个Group,然后给Group命名为X,把实例加到组中。服务器的配置就这么简单。
下面在用户端设置SAP message服务器,为下一步作准备。
填入以上信息,如果出现1处的错误信息,那么需要执行以下步骤设定Service端口映射:
SAP登陆时会从Windows的service文件中获取服务名称,需要在这个文件中指定service名称与端口映射,
在%systemroot%\system32\drivers\etc\中打开文件services并在其最后加入一行:
sapmsCID 36xx/tcp
SID是SAP系统的SID(系统ID)号码,需要被替换为你自己的,在SID与3600中的间隔推荐用Tab键而不是使用空格分隔,如果讯息服务器填的是主机名,并且没有DNS来解析,那么还需要在上面指定的目录中的hosts文件中加入IP到主机名的映射
注意:
从理论上讲(自已想像的),SAPGUI总是连接到SAP message服务器,message服务器则判断当前各服务器的响应时间,哪台响应时间最短,则让GUI连到哪台。如果你发现你的服务器配配置都差不 多,但GUI很多都连在一台服务器上,那说明另一台响应时间有点问题需要调整了。你随时可以通过AL08查看各服务器的登陆情况,也可以通过SMLG按 F5查看各服务器的响应时间。
可能遇到的问题
1、在给用户配置客户端登陆时,系统标识中输入PRD,但无法解析出IP。
解决:未配置消息服务器,请更改sapmsg.ini文件。
2、系统标识中输入PRD后,无法选择组服务器,出现一个错误提示,还是乱码的
原因没找到,估计是service文件中某些通讯端口设置有问题,造成无法与message服务器通信,当然也就没法选择组服务器了。
解决:从其他正常的机器上找到windows安装目录下的system32\drivers\etc下的service文件,拷一个过来覆盖就好。
JCO连接怪现象
http://www.iteye.com/problems/3667
这两天用JCO做个接口从数据库导数据进R/3
昨天调好得程序今天来调试结果报如下异常,JCO连接也不起作用了
Exception in thread "DefaultQuartzScheduler_Worker-4" java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjcorfc in java.library.path]. java.library.path [C:\Program Files\Java\jdk1.5.0_06\bin;C:\Tomcat 5.5\bin]
貌似是说librfc32.dll sapjcorfc.dll两个动态库得问题。
开始我没注意,我采用在类里面嵌入web测试,发现我得SAP配置是正确得,也能正常插入数据,为什么在web容器里面就跑不起来,应说我的两个库文件不在还是怎么着。
无奈之下只有将这两个库文件外加sapjco.jar一起粘贴进
C:\Program Files\Java\jdk1.5.0_06\bin
C:\Tomcat 5.5\bin
结果程序跑起来了…………
Call BAPI with SAP Enterprise Connector Guide
Call__BAPI__with__SAP__Enterprise_Connector_Guide.pdf.rar
http://sapjava.iteye.com/blog/412107
This document is step by step guide on how to calling BAPI in Java with SAP Enterprise connector.
SAP BAPI is remote enabled function module, and we can call it with JCO library. SAP Enterprise Connector is a wizard to generate proxy code for calling remote function module.
1.Install NWDS
First download NWDS from SDN, SAP NetWeaver Composition Environment 7.1 SR5 - Trial Version
You should register an account in SDN first.
Extract downloaded files to temp folder. Then install NWDS follow the installation instruction..
2.Create Java Project
Start Netweaver Development Studio, create Java project.
Add related library to build path:
3.Create proxy class with SAP Enterprise Connector
Select the function module , and click Finish button, Waiting for NWDS will generate proxy codes.
4.Test generated proxy class
- JCO.Client jcoClient = JCO.createClient(
- "800",
- "CP.WANG",
- "justin65",
- "EN",
- "/H/eclass.efglobe.com/H/sapecc",
- "01");
- jcoClient.setProperty("jco.client.codepage", "4110");
- CompanyCode_PortType proxy = new CompanyCode_PortType();
- proxy.messageSpecifier.setJcoClient(jcoClient);
- jcoClient.connect();
- Bapi_Companycode_Getlist_Input input = new Bapi_Companycode_Getlist_Input();
- try {
- Bapi_Companycode_Getlist_Output output = proxy.bapi_Companycode_Getlist(input);
- Bapi0002_1Type[] codes = output.getCompanycode_List();
- if(codes!=null && codes.length> 0){
- int len = codes.length;
- for(int i=0;i
- System.out.printf("%-10s", codes[i].getComp_Code());
- System.out.print(new String(new String(codes[i].getComp_Name()).getBytes("UTF-8"),"GBK"));
- System.out.println();
- }
- }
- } catch (ApplicationFaultException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SystemFaultException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- jcoClient.disconnect();
Question:
1.Exception:RFC_ERROR_COMMUNICATION
Exception in thread "main" com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: SAP_CMINIT3 : rc=20 > Connect to SAP gateway failed
Connect_PM GWHOST=sapecc, GWSERV=sapgw01, SYSNR=01
LOCATION CPIC (TCP/IP) on local host
ERROR hostname 'sapecc' unknown
TIME Sat Jun 20 16:08:59 2009
RELEASE 710
COMPONENT NI (network interface)
VERSION 39
RC -2
MODULE ninti.c
LINE 895
DETAIL NiPGetHostByName: 'sapecc' not found
SYSTEM CALL getaddrinfo
COUNTER 1
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native Method)
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1125)
at com.sap.mw.jco.JCO$Client.connect(JCO.java:3138)
at com.rfc.test.RFCTest.main(RFCTest.java:36)
Solution: When you connect to SAP system in java with JCO.Client , if you want to use SAP router string , please replace SAP host name with “/Hrouter_string/Hhostname” format.
2. Exception :
java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjcorfc in java.library.path]. java.library.path [C:\Program Files\Java\jdk1.6.0_11\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;E:\oracle\product\10.2.0\db_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programiles\Java\jdk1.6.0_11\bin;;D:\OpenSource\apache-ant-1.7.0\bin;D:\Program Files\MySQL\MySQL Server 5.0\bin ]
at com.sap.mw.jco.JCO.
at com.rfc.test.RFCTest.getCmp(RFCTest.java:62)
at com.jt.CompanyPanel.setData(CompanyPanel.java:28)
at desktopapplication1.DesktopApplication1View.showCompanyCode(DesktopApplication1View.java:248)
Solution: Copy sapjcorfc.dll, librfc32.dll into C:\Windows\System32, these files exist in SAP JCO library, and you could download from SAP Service Market Place, quick link connectors.
http://searchsap.techtarget.com/generic/0,295582,sid21_gci1095552,00.html
Summary:
Read reference of JCO before programming. Follow the install guide of JCO library.
林源:
SAP_JCO登录参数:
logonProperties.setProperty("jco.client.client", "800"); // 800 PRE 系统
logonProperties.setProperty("jco.client.user", "12061789"); // atp
logonProperties.setProperty("jco.client.passwd", "1234567890");// 654321
logonProperties.setProperty("jco.client.ashost", "10.19.250.5");
logonProperties.setProperty("jco.client.mshost", "10.19.250.5");
logonProperties.setProperty("jco.client.group", "atp_grp");// load
I005接口: ZIMS_MM_ORIGIN
inTable.setValue("000000000
inTable.setValue("
inTable.setValue("0001", "INV_LOCAT");//按照提供文件
inTable.setValue("71000
inTable.setValue("SAP", "SRC_SYS");// 固定
inTable.setValue("PO", "DOC_TYPE");// 固定
inTable.setValue("
inTable.setValue("10", "DOC_ITEM");// 固定
inTable.setValue("0000123456", "BATCH_NO");// 按照提供文件
inTable.setValue("10", "CMMDTY_QTY");// 固定
inTable.setValue("
问题1-------------------------------------
D:\TestCase\20140414_sap_kucun
Virtual User Script started at : 2014-04-15 15:04:12
Starting action vuser_init.
Error: System.err: java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjcorfc in java.library.path]. java.library.path [C:\Program Files\HP\LoadRunner\bin;.;C:\Documents and Settings\Administrator\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\Documents and Settings\Administrator\WINDOWS;C:\Program Files\Java\jdk1.6.0_10\jre\bin\client;C:\PROGRA~1\HP\LOADRU~1\bin;C:\PROGRA~1\HP\LOADRU~1\bin\gecko;C:\PROGRA~1\HP\LOADRU~1\bin\tulip\bin;C:\Program Files\Java\jdk1.6.0_10\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\SinoVoice\jTTS 5.0 Desktop\Bin;C:\Program Files\Java\jdk1.6.0_10\bin;D:\PROGRA~1\db2\BIN;D:\PROGRA~1\db2\FUNCTION;D:\PROGRA~1\db2\SAMPLES\REPL;C:\Documents and Settings\Administrator\WINDOWS;] Error
System.err: at com.sap.mw.jco.JCO.
System.err: at Actions.init(Actions.java:36) Error
Error: java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjcorfc in java.library.path]. java.library.path [C:\Program Files\HP\LoadRunner\bin;.;C:\Documents and Settings\Administrator\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\Documents and Settings\Administrator\WINDOWS;C:\Program Files\Java\jdk1.6.0_10\jre\bin\client;C:\PROGRA~1\HP\LOADRU~1\bin;C:\PROGRA~1\HP\LOADRU~1\bin\gecko;C:\PROGRA~1\HP\LOADRU~1\bin\tulip\bin;C:\Program Files\Java\jdk1.6.0_10\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\SinoVoice\jTTS 5.0 Desktop\Bin;C:\Program Files\Java\jdk1.6.0_10\bin;D:\PROGRA~1\db2\BIN;D:\PROGRA~1\db2\FUNCTION;D:\PROGRA~1\db2\SAMPLES\REPL;C:\Documents and Settings\Administrator\WINDOWS;]
Error: at com.sap.mw.jco.JCO.
at Actions.init(Actions.java:36)
Failed to get file name and line of the script for failed transaction "vuser_init_Transaction".
Abort was called from an action.
Virtual User Script started at : 2014-04-15 15:09:14
Starting action vuser_init.
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Actions.
Notify: Transaction "getTotalExecTime" started.
Notify: Transaction "getRepository" started.
Error: System.out: Exception:Connect to message server failed
Connect_PM MSHOST=10.19.250.5, R3NAME=ATE, GROUP=atp_grp
LOCATION CPIC (TCP/IP) on local host
ERROR service 'sapmsATE' unknown
TIME Tue Apr 15 15:09:14 2014
RELEASE 640
COMPONENT NI (network interface)
VERSION 37
RC -3
MODULE ninti.c
LINE 505
DETAIL NiPGetServByName2: service 'sapmsATE' not found
SYSTEM CALL getservbyname_r
COUNTER 1
Notify:
Error: Exception:Connect to message server failed
Connect_PM MSHOST=10.19.250.5, R3NAME=ATE, GROUP=atp_grp
LOCATION CPIC (TCP/IP) on local host
ERROR service 'sapmsATE' unknown
TIME Tue Apr 15 15:09:14 2014
RELEASE 640
COMPONENT NI (network interface)
VERSION 37
RC -3
MODULE ninti.c
LINE 505
DETAIL NiPGetServByName2: service 'sapmsATE' not found
SYSTEM CALL getservbyname_r
COUNTER 1
Ending action Actions.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Error: Vuser started transaction "getRepository", but did not reached a corresponding end transaction statement. The transaction ended automatically with status 'fail'.
Notify: Transaction "getRepository" ended with "Fail" status (Duration: 0.0951).
Error: Vuser started transaction "getTotalExecTime", but did not reached a corresponding end transaction statement. The transaction ended automatically with status 'fail'.
Notify: Transaction "getTotalExecTime" ended with "Fail" status (Duration: 0.0977).
Ending action vuser_end.
Vuser Terminated.
解决1:
把sapjco.jar放入脚本环境变量如下图
http://dl2.iteye.com/upload/attachment/0096/1446/f0da5661-5439-3737-8951-057f3103ec91.png
把sapjcorfc.dll和librfc32.dll放入C:\Program Files\HP\LoadRunner\bin\
http://www.iteye.com/problems/3667
http://sapjava.iteye.com/blog/412107
http://www.efglobe.com/
问题2-----------------------------------------------------------
Virtual User Script started at : 2014-04-15 15:09:14
Starting action vuser_init.
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Actions.
Notify: Transaction "getTotalExecTime" started.
Notify: Transaction "getRepository" started.
Error: System.out: Exception:Connect to message server failed
Connect_PM MSHOST=10.19.250.5, R3NAME=ATE, GROUP=atp_grp
LOCATION CPIC (TCP/IP) on local host
ERROR service 'sapmsATE' unknown
TIME Tue Apr 15 15:09:14 2014
RELEASE 640
COMPONENT NI (network interface)
VERSION 37
RC -3
MODULE ninti.c
LINE 505
DETAIL NiPGetServByName2: service 'sapmsATE' not found
SYSTEM CALL getservbyname_r
COUNTER 1
Notify:
Error: Exception:Connect to message server failed
Connect_PM MSHOST=10.19.250.5, R3NAME=ATE, GROUP=atp_grp
LOCATION CPIC (TCP/IP) on local host
ERROR service 'sapmsATE' unknown
TIME Tue Apr 15 15:09:14 2014
RELEASE 640
COMPONENT NI (network interface)
VERSION 37
RC -3
MODULE ninti.c
LINE 505
DETAIL NiPGetServByName2: service 'sapmsATE' not found
SYSTEM CALL getservbyname_r
COUNTER 1
Ending action Actions.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Error: Vuser started transaction "getRepository", but did not reached a corresponding end transaction statement. The transaction ended automatically with status 'fail'.
Notify: Transaction "getRepository" ended with "Fail" status (Duration: 0.0951).
Error: Vuser started transaction "getTotalExecTime", but did not reached a corresponding end transaction statement. The transaction ended automatically with status 'fail'.
Notify: Transaction "getTotalExecTime" ended with "Fail" status (Duration: 0.0977).
Ending action vuser_end.
Vuser Terminated.
解决:数据源sapmsATE 无法连通,库存中心 SIMS/ ATE
打开文件:C:\WINDOWS\system32\drivers\etc\services
添加内容:
sapmsPMP 3600/tcp # 价格生产机
sapmsWLE 3600/tcp # 物流预生产
sapmsATE 3600/tcp # 库存预生产
问题3----------------------------
Virtual User Script started at : 2014-04-15 15:18:01
Starting action vuser_init.
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Actions.
Notify: Transaction "getTotalExecTime" started.
Notify: Transaction "getRepository" started.
Error: System.out: Exception:Connect to message server failed
Connect_PM MSHOST=10.19.250.5, R3NAME=PRE, GROUP=atp_grp
LOCATION CPIC (TCP/IP) on local host
ERROR service 'sapmsPRE' unknown
TIME Tue Apr 15 15:18:01 2014
RELEASE 640
COMPONENT NI (network interface)
VERSION 37
RC -3
MODULE ninti.c
LINE 505
DETAIL NiPGetServByName2: service 'sapmsPRE' not found
SYSTEM CALL getservbyname_r
COUNTER 1
Notify:
Error: Exception:Connect to message server failed
Connect_PM MSHOST=10.19.250.5, R3NAME=PRE, GROUP=atp_grp
LOCATION CPIC (TCP/IP) on local host
ERROR service 'sapmsPRE' unknown
TIME Tue Apr 15 15:18:01 2014
RELEASE 640
COMPONENT NI (network interface)
VERSION 37
RC -3
MODULE ninti.c
LINE 505
DETAIL NiPGetServByName2: service 'sapmsPRE' not found
SYSTEM CALL getservbyname_r
COUNTER 1
Ending action Actions.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Error: Vuser started transaction "getRepository", but did not reached a corresponding end transaction statement. The transaction ended automatically with status 'fail'.
Notify: Transaction "getRepository" ended with "Fail" status (Duration: 0.1366).
Error: Vuser started transaction "getTotalExecTime", but did not reached a corresponding end transaction statement. The transaction ended automatically with status 'fail'.
Notify: Transaction "getTotalExecTime" ended with "Fail" status (Duration: 0.1415).
Ending action vuser_end.
Vuser Terminated.
解决:数据源sapmsPRE 无法连通库存中心 SIMS/ATE
打开文件:C:\WINDOWS\system32\drivers\etc\services
添加内容:
sapmsPMP 3600/tcp # 价格生产机
sapmsWLE 3600/tcp # 物流预生产
sapmsATE 3600/tcp # 库存预生产
sapmsPRE 3600/tcp # 库存预生产
loadrunner sap exception
问题:loadrunner 录制SAP界面客户端脚本时,发现录制到SAP 数据表横向滚动条定位不到的情况
解决:loadrunner 录制SAP界面,不用手动拖拽横向滚动条,需要点击SAP自开发的下一条数据的按钮。
loadrunner web转javavUser协议的脚本的方法:
1、录制web协议脚本,将Action.c放到一个目录下(可以改名字也可以不改)
2、采用LR的bin目录下的命令:
C:\Program Files\HP\LoadRunner\bin\sed -f web to java.sed D:\web.txt > D:\java.txt
3、生成一个txt文件里面是java协议的脚本;结合java基础写邮件
Loadrunner C
loadrunenr 测试机内存泄露解决
http://dl2.iteye.com/upload/attachment/0103/4819/4660f773-44b3-300a-af15-d682a6830e6b.png
http://dl2.iteye.com/upload/attachment/0103/4821/478d0525-d51e-367b-9811-ad7678105d12.png
loadrunner测试机内存泄露原始脚本.zip
http://dl.iteye.com/topics/download/a439142b-e7bf-393c-b397-6bf26c7d12f3
loadrunner测试机内存泄露修改后脚本
D:\TestCase\20141121_b2c_search_click\tc_ad_cpc_searchclick_201409191101\tc_ad_cpc_searchclick_201409191101.usr
dd
Action() { int num; char *temp; // 此处多余删除,压测时导致测试机内存泄露, char str[300]; web_reg_find("Fail=NotFound", "Search=Body", "SaveCount=aa", "Text=jsonpCallback", LAST); web_set_max_html_param_len("1024"); //保存长字符串为关联使用 web_reg_save_param_ex( "ParamName=goods", //抓到搜索页面里商品URL "LB=\"apsClickUrl\":\"", "RB=\",\"cmdPrice\"", "Ordinal=all", "NotFound=warning", // 商品搜索允许搜索不到数据 SEARCH_FILTERS, LAST); lr_start_transaction("tran_Search"); web_url("cpc_data.html", "URL=http://apscorepre.cns*****.com/getCpcDatas?keyword={keyword}&positionID=100000001&inputCpcNumbers=13&inputTime=20141111", //"URL=http://apscorepre.cns*****.com/getCpcDatas?keyword={keyword}&positionID=100000001&inputCpcNumbers=13", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t8.inf", "Mode=HTML", EXTRARES, LAST); lr_end_transaction("tran_Search", LR_AUTO); //搜索50次点击1次 if(atoi(lr_eval_string("{goods_count}"))!= 0){ //countHaveGoods++; num = rand()%50 + 1; // 得到1-50的随机值 if(num == 1){ //当随机到1时进行下面的点击操作业务 //countClick++; temp=lr_paramarr_random("goods"); //此处多余删除,压测时导致测试机内存泄露 lr_save_string(temp,"str"); //此处多余删除,压测时导致测试机内存泄露 lr_save_string(lr_paramarr_random("goods"),"str"); lr_start_transaction("click"); web_url("cpc_data.html", "URL={str}", //抓到搜索页面里商品URL,然后点击 "TargetFrame=xxxx", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t8.inf", "Mode=HTML", EXTRARES, LAST); lr_end_transaction("click", LR_AUTO); } } //lr_user_data_point("countClick/countHaveGoods",countClick*1.0/countHaveGoods); //lr_user_data_point("countClick",countClick); return 0; }
dd
从一个脚本谈loadrunner的脚本初始化
http://www.blogjava.net/qileilove/archive/2014/02/20/410079.html
昨天一个同事请我一个问题,在下列代码中如何将 InputStream is 这个元素只初始化一次呢?
/* * LoadRunner Java script. (Build: _build_number_) * * Script Description: * */ import lrapi.lr; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import com.google.common.io.ByteStreams; import com.jd.jfs.JingdongFileSystem; public class Actions { File file = new File("C:/8K.file"); InputStream is =null; // 返回一个byte数组byte[] fileBytes = new byte[(int) file.length()]; // 创建一个数据来保存文件数据 JingdongFileSystem jfs =new JingdongFileSystem(); public int init() throws Throwable { is = new FileInputStream(file); ByteStreams.readFully(is, fileBytes); is.close(); //jfs = new JingdongFileSystem(); return 0; } //end of init public int action() throws Throwable { try { lr.start_transaction("jfs-w"); String key = jfs.writeBytes(fileBytes); //上传 System.out.println(key); } catch (Exception e) { e.printStackTrace(); } lr.end_transaction("jfs-w", lr.AUTO); return 0; }//end of action public int end() throws Throwable { return 0; }//end of end }
d
我们知道,在loadrunner的java_vuser协议的脚本中,init方法在每个vuer初始化的时候都会被执行一次,换句话说N个用户就会被执行N次,所以上面的脚本中inputStream对象会被初始化N次。我随即做了如下修改
File file = new File("C:/8K.file"); static InputStream is =null; // 返回一个byte数组 byte[] fileBytes = new byte[(int) file.length()]; // 创建一个数据来保存文件数据 JingdongFileSystem jfs =new JingdongFileSystem(); public int init() throws Throwable { if(is==null){ is = new FileInputStream(file); } ByteStreams.readFully(is, fileBytes); is.close(); //jfs = new JingdongFileSystem(); //初始化 return 0; }//end of init 理论上来说,上述代码实现了单例模式。但是这个脚本并发下无效。。。 经过和开发探讨最终换了以下的代码来处理: static { File file = new File("C:/8K.file"); fileBytes = new byte[(int) file.length()]; // 创建一个数据来保存文件数据 try { InputStream is = new FileInputStream(file); ByteStreams.readFully(is, fileBytes); is.close(); } catch (Exception e) { e.printStackTrace(); } jfs = new JingdongFileSystem(); }
静态初始化块:使用static定义,当类装载到系统时执行一次.若在静态初始化块中想初始化变量,那仅能初始化类变量,即static修饰的数据成员. 总结一下: 在java_vuser协议的脚本中: 1. vuser_init模块始终不会被执行; 2. init方法会被初始化合并发数相同的次数 3. 如果想实现多个并发用户公用一个变量,请使用静态初始化块。
gexiaolei 185-51758325
md5:f3913639454e6362a0d6813c33295ce1
使用loadrunner Java Vuser协议进行性能测试时场景中报Error: Compilation process failed.解决方法
http://blog.csdn.net/aovenus/article/details/9963461
使用loadrunner Java Vuser协议进行性能测试时场景中报Error: Compilation process failed.解决方法
【问题背景】:最近使用loadrunner进行接口性能测试,接口均使用java编写的,本次测试使用java vuser协议进行脚本编写,并通过调用jar包,进行接口应用调用。在性能测试过程中,使用两台负载机,均已配置java环境变量,但是在场景执行时,报Error: Compilation process failed错误。
【解决方法】:通过网上搜索,有遇到该问题的同学,提供的解决方法是:在loadrunner安装目录classes下放入接口调用需要使用到的jar包,通过尝试该方法发现不能解决问题。
最后通过在场景中,设置RunTime-Settings—>Java Enviroment Settings—>Classpath中引入脚本需要调用的jar包,即解决。
end