loadrunner如何测试EJB
本帖最后由 xwm259695 于 2010-12-10 17:34 编辑最近公司项目用到EJB,要我测一下压力,不知道如何使用loadrunner测试EJB。网上也查了一些质料说的都乱七八糟,不知道谁有测试EJB项目的经验指点小弟,万分感激。我的运行环境9i+weblogic815+xp+lr9.5/*
* LoadRunner EJB-Testing Script
* Generated on: Fri Dec 10 10:05:10 2010
* Author: Administrator
*
* Bean name: toycsinterface.toYcsInterfaceBean
* Bean type: STATELESS
*/
import lrapi.lr;
import java.rmi.Naming;
import java.text.DateFormat;
import java.util.*;
public class Actions
{
toycsinterface.toYcsInterface _toycsinterface = null;
public int init() {
DummyClassLoader.setContextClassLoader();
toycsinterface.toYcsInterfaceHome _toycsinterfacehome = null;
try {
// get the JNDI Initial Context
java.util.Properties p = new java.util.Properties();
p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p.put(javax.naming.Context.PROVIDER_URL, "t3://192.168.0.141:7001");
javax.naming.InitialContext _context = new javax.naming.InitialContext(p);
// lookup Home Interface in the JNDI context and narrow it
Object homeobj = _context.lookup("toYcsInterface");
_toycsinterfacehome = (toycsinterface.toYcsInterfaceHome)javax.rmi.PortableRemoteObject.narrow(homeobj, toycsinterface.toYcsInterfaceHome.class);
} catch (javax.naming.NamingException e) {
e.printStackTrace();
}
// create Bean instance
try {
lr.start_transaction("create");
_toycsinterface = _toycsinterfacehome.create();
lr.end_transaction("create", lr.AUTO);
} catch (Throwable t) {
lr.end_transaction("create", lr.FAIL);
t.printStackTrace();
}
return 0;
}
public int action() {
// ------- Methods ------------
java.lang.String _string1 = "";
try {
lr.start_transaction("doService");
_string1 = _toycsinterface.doService((java.lang.String)"", (java.lang.String)"");
lr.value_check(_string1, "", lr.EQUALS);
lr.end_transaction("doService", lr.AUTO);
} catch (Throwable t) {
lr.end_transaction("doService", lr.FAIL);
t.printStackTrace();
}
return 0;
}
public int end() {
return 0;
}
}
运行时候总是出现下面的问题
D:\scripts\ejbtest\Actions.java:42: cannot access javax.ejb.EJBHome
file javax\ejb\EJBHome.class not found
_toycsinterface = _toycsinterfacehome.create();
^
D:\scripts\ejbtest\Actions.java:59: cannot access javax.ejb.EJBObject
file javax\ejb\EJBObject.class not found
_string1 = _toycsinterface.doService((java.lang.String)"", (java.lang.String)"");
^
2 errors 看你通讯用的啥了,这个跟EJB关系不大。 你说的是什么意识,我的环境是oracle9i+weblogic8.1.5+ windows2003 一般应用都部署到WebLogic上了,直接用LoadRunner测试JSP或Servlet 能说的具体一点吗?你的意思是选择web/http协议录制脚本测试呀?
页:
[1]