新手请教LR测试java开发程序的疑问
:Q 操作系统: 不限制,中间件:不限制,JDK版本:JDK1.4,数据库服务器:mysql,开发工具:Eclipse3.3创建脚本选择协议的时候要选择哪个?java vuser?javascriptvuser?还是其他什么?
还有对新手来说如何进行测试?或者说一般怎么测试重点在哪里?高手请教下 :Q 建议选用:?java vuser
代码编写跟java以一样;
我这边的性能测试,脚本类似这样:
前提:把相应的jar包以来都保存到脚本的根目录下
import lrapi.lr;
import java.util.HashMap;
import java.util.Map;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.tt.marketing.biz.common.IMSEventTaskService;
public class Actions {
ApplicationContext appContext = null;
IMSEventTaskService imsEventTaskService;
Map<String, Map<String, String>> paramsMap;
Map<String, String> userMap;
Map<String, String> actionMap;
int count = 1;
public int init() {
Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
appContext = new ClassPathXmlApplicationContext("imsctu_hsf.xml");
imsEventTaskService = (IMSEventTaskService) appContext
.getBean("imsEventTaskService");
return 0;
}
public int action() {
try{
Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
while(true) {
lr.start_transaction("getData");
// lr.start_transaction("IMS Reality Attach");
// lr.message("init()");
String paramsString = "delay:::1:::::user_nick:::absolutelywuyu:::::user_buyerRate:::15:::::user_userAuthDate:::2009-01-01:::::user_userId:::123456789:::::user_buyerSum:::555:::::user_buyerNum:::555555:::::user_city:::BJ:::::user_mobilePhone:::111:::::user_email:::wuyu@tt.com";
//paramsMap = new HashMap<String, Map<String, String>>();
//userMap = new HashMap<String, String>();
//actionMap = new HashMap<String, String>();
//userMap.put("nick", "jeley_981217");
//userMap.put("userId", "11891");
//userMap.put("buyerRate", "55");
//userMap.put("buyerSum", "5555");
//userMap.put("buyerNum", "555");
//userMap.put("userAuthDate", "2009-01-01");
//userMap.put("email", "performance@taobao.com");
//userMap.put("mobilePhone", "13735838973");
//userMap.put("ip", "144.144.144.144");
//userMap.put("city", "杭州");
//userMap.put("mac", "aa:bb:cc:dd:ee:ff");
//userMap.put("cookie", "domain=testCookie");
//userMap.put("fullname", "系统");
//paramsMap.put("user", userMap);
//actionMap.put("actionId", "1");
// actionMap.put("actionTime", "2009-05-15");
// paramsMap.put("action", actionMap);
imsEventTaskService.sendByString(2924707465960000932L, paramsString);
lr.end_transaction("getData", lr.AUTO);
// lr.end_transaction("IMS sc1", lr.AUTO);
//lr.message("已经发送成功: " + count++);
}
} catch (Exception e) {
lr.error_message(e.getMessage());
lr.end_transaction("getData", lr.FAIL);
}
// return 0;
return 0;
}
public int end() {
return 0;
}
}
谨供参考。
Thanks!
George 忘记一点:
JDK版本与Loadrunner版本的问题
LoadRunner 8.1 支持JDK1.5
LoadRunner 9.0 支持 JDK1.6
请楼主注意下! 要看是用java开发的web应用程序还是java开发的系统程序;如果是web程序采用http/html协议录制就可以了。 :handshake 前面的还是没明白不过还是知道了测试要选择什么协议了。感谢下认真回单的兄弟姐妹:loveliness:
页:
[1]