51Testing软件测试论坛
标题:
loadrunner如何测试EJB
[打印本页]
作者:
xwm259695
时间:
2010-12-9 22:00
标题:
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
复制代码
作者:
C组十三
时间:
2010-12-9 22:18
看你通讯用的啥了,这个跟EJB关系不大。
作者:
xwm259695
时间:
2010-12-9 22:44
你说的是什么意识,我的环境是oracle9i+weblogic8.1.5+ windows2003
作者:
PrefTest
时间:
2010-12-11 16:39
一般应用都部署到WebLogic上了,直接用LoadRunner测试JSP或Servlet
作者:
xwm259695
时间:
2010-12-12 13:31
能说的具体一点吗?你的意思是选择web/http协议录制脚本测试呀?
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2