由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 请教高手如何用JUnit模拟真实的Servlet容器 (e.g. Jboss里的tomcat), 具体需求请进
相关主题
问一个J2EE和Tomcat问题Java Tools and Technologies Landscape for 2014
EasyMock 真的有用么?Spring JBOSS
servlet读取directory的基本问题Any free LDAP server?
Java简直完全不可控啊!!!Java那些XML的config file是怎么生成的?
大家拍我吧,自己太弱了疯了!J2EE应该到哪里找工作?
maven,struts求助已经学完jsp and servlet了,下一步是不是该学struts了
用惯了glassfish,突然要我用tomcat,真实不习惯。JBoss 4.2.x Sucks!!!
OpenShift的配置一问hadoop 2.0要出来了,我看了下架构,感觉很复杂啊
相关话题的讨论汇总
话题: jmeter话题: junit话题: maven话题: servlet话题: test
进入Java版参与讨论
1 (共1页)
l*****b
发帖数: 82
1
1. 用Junit模拟多线程Servlet访问
2. 模拟真实Servlet容器处理多线程Servlet访问但不依赖容器
大概就是模拟完全production环境。
请问各位高手们有什么建议? 谢谢。
A**o
发帖数: 1550
2
这还是unit test吗?

【在 l*****b 的大作中提到】
: 1. 用Junit模拟多线程Servlet访问
: 2. 模拟真实Servlet容器处理多线程Servlet访问但不依赖容器
: 大概就是模拟完全production环境。
: 请问各位高手们有什么建议? 谢谢。

g*****g
发帖数: 34805
3
Maybe you can try JMeter

【在 l*****b 的大作中提到】
: 1. 用Junit模拟多线程Servlet访问
: 2. 模拟真实Servlet容器处理多线程Servlet访问但不依赖容器
: 大概就是模拟完全production环境。
: 请问各位高手们有什么建议? 谢谢。

l*****b
发帖数: 82
4
Hi, Amao, goodbug,谢谢你们的回复。我也明白这样做不是很符合unit test, 这是
老板的要求, 要报饭碗没办法。JMeter可以模拟客户端的多线程请求, 但是我现在最
没有头绪的就是server端的模拟。 听说可以用Mock objects (spring mock, easyMock
, 等等)来做,不过设计比较复杂,请问各位有没有这方面的经验和建议。
b******y
发帖数: 9224
5
好像spring里面,有mock http request, 可以试试?
A**o
发帖数: 1550
6
不知道你的production是什么环境,模拟prod的最佳方式还是
建立一个staging环境吧?
实在不行你自己写一个http服务器?
另外,cactus好像是junit在servlet上面的extention,不知道对你有用吗?

easyMock

【在 l*****b 的大作中提到】
: Hi, Amao, goodbug,谢谢你们的回复。我也明白这样做不是很符合unit test, 这是
: 老板的要求, 要报饭碗没办法。JMeter可以模拟客户端的多线程请求, 但是我现在最
: 没有头绪的就是server端的模拟。 听说可以用Mock objects (spring mock, easyMock
: , 等等)来做,不过设计比较复杂,请问各位有没有这方面的经验和建议。

k***r
发帖数: 4260
7
Sounds like you can just starts multiple threads in the junit test class and
call into the servlet class?

【在 l*****b 的大作中提到】
: 1. 用Junit模拟多线程Servlet访问
: 2. 模拟真实Servlet容器处理多线程Servlet访问但不依赖容器
: 大概就是模拟完全production环境。
: 请问各位高手们有什么建议? 谢谢。

m******t
发帖数: 2416
8

easyMock
It's kind of conflicting in terms of requirements
to emulate production but not rely on an actual
container. You are not going to get any meaningful
results.

【在 l*****b 的大作中提到】
: Hi, Amao, goodbug,谢谢你们的回复。我也明白这样做不是很符合unit test, 这是
: 老板的要求, 要报饭碗没办法。JMeter可以模拟客户端的多线程请求, 但是我现在最
: 没有头绪的就是server端的模拟。 听说可以用Mock objects (spring mock, easyMock
: , 等等)来做,不过设计比较复杂,请问各位有没有这方面的经验和建议。

l*****b
发帖数: 82
9
我要做的是要在unit test中模拟最真实环境甚至要把真实容器拉进来测试。这是我的
试用期第一件工作,请各位为小弟出点主意。由于时间关系(只有两个星期)我现在想
用 Cactus模拟in-container,同时把jboss拉进来测试。因为要用mock objects (out
-container方法)去模拟完整的container需时长复杂度高。大家有什么看法?
g*****g
发帖数: 34805
10
what's wrong to put it in real container and use JMeter to test?

out

【在 l*****b 的大作中提到】
: 我要做的是要在unit test中模拟最真实环境甚至要把真实容器拉进来测试。这是我的
: 试用期第一件工作,请各位为小弟出点主意。由于时间关系(只有两个星期)我现在想
: 用 Cactus模拟in-container,同时把jboss拉进来测试。因为要用mock objects (out
: -container方法)去模拟完整的container需时长复杂度高。大家有什么看法?

相关主题
maven,struts求助Java Tools and Technologies Landscape for 2014
用惯了glassfish,突然要我用tomcat,真实不习惯。Spring JBOSS
OpenShift的配置一问Any free LDAP server?
进入Java版参与讨论
A**o
发帖数: 1550
11
dunno ya. sounds weird

【在 g*****g 的大作中提到】
: what's wrong to put it in real container and use JMeter to test?
:
: out

l*****b
发帖数: 82
12
以下是我的环境:
jboss, servlet, spring (just IOC container, no mvc), maven, Junit
测试是要在unit test阶段自动完成的。对于我的特殊情况,real container 和
JMeter 是不错的组合, JMeter可以模拟客户端的多线程。但我有以下问题:
1。 如何把JMeter整合到unit test中, 我不太熟悉有没有相关的JMeter API。
2。 如何把jboss加进unit test中, 如在setUp()方法中如何加载要测试的模块和启
动等步骤。
g*****g
发帖数: 34805
13
JMeter is not unit test, it can do functional test and performance test
however. You start your server, you run a JMeter script to verify it.

【在 l*****b 的大作中提到】
: 以下是我的环境:
: jboss, servlet, spring (just IOC container, no mvc), maven, Junit
: 测试是要在unit test阶段自动完成的。对于我的特殊情况,real container 和
: JMeter 是不错的组合, JMeter可以模拟客户端的多线程。但我有以下问题:
: 1。 如何把JMeter整合到unit test中, 我不太熟悉有没有相关的JMeter API。
: 2。 如何把jboss加进unit test中, 如在setUp()方法中如何加载要测试的模块和启
: 动等步骤。

g*****g
发帖数: 34805
14
老大这股市啥时候才是底呀。得亏俺斩仓坚决,折腾了一年多到现在持平。
这势头,估计得空仓等两年牛市才回来。

【在 m******t 的大作中提到】
:
: easyMock
: It's kind of conflicting in terms of requirements
: to emulate production but not rely on an actual
: container. You are not going to get any meaningful
: results.

m******t
发帖数: 2416
15

You don't have to drive these from junit. Since you
are using maven, there are maven plugins that let you
incorporate them into your build cycle.
For instance, you could start the container
using the cargo plugin and run the tests using
surefire. I don't know if jmeter has a maven
plugin by now, but it definitely can be driven
from Ant or command line, so it shouldn't be
too hard to hook it into maven.

【在 l*****b 的大作中提到】
: 以下是我的环境:
: jboss, servlet, spring (just IOC container, no mvc), maven, Junit
: 测试是要在unit test阶段自动完成的。对于我的特殊情况,real container 和
: JMeter 是不错的组合, JMeter可以模拟客户端的多线程。但我有以下问题:
: 1。 如何把JMeter整合到unit test中, 我不太熟悉有没有相关的JMeter API。
: 2。 如何把jboss加进unit test中, 如在setUp()方法中如何加载要测试的模块和启
: 动等步骤。

m******t
发帖数: 2416
16

Heh, that is the -- what's the number these days,
oh, right -- $850 bln question.
People are starting to freak out - see yesterday
and today, all good news: rate cuts, nice housing
figure, ibm doing well. The market still can't
hold on to any gain. Probably we _are_ rapidly
approaching a bottom here. ;-)
Yesterday they were talking about the earliest
economic recovery could be as late as the end
of 2009. So if you factor in the pattern that
the stock markets usually recover about 6 months
ahead

【在 g*****g 的大作中提到】
: 老大这股市啥时候才是底呀。得亏俺斩仓坚决,折腾了一年多到现在持平。
: 这势头,估计得空仓等两年牛市才回来。

l*****b
发帖数: 82
17
Hi, magicfat, many thx for your technical and financial advice. ; - )
So far, with all others' advice, my final goal is to have a automatic
integration test with JBoss and Maven.
I have developed a small client based on Junit to simulate and generate
multithreaded requests to target server.
There are several potential options:
1. In Maven integration test phase, using Maven plugin cargo to deploy/start
/test/stop/undeploy in Jboss.
2. Using Cactus framework to have in-container test.
3. Develop
m******t
发帖数: 2416
18

You mean "technical advice and financial babbling"? ;-)

【在 l*****b 的大作中提到】
: Hi, magicfat, many thx for your technical and financial advice. ; - )
: So far, with all others' advice, my final goal is to have a automatic
: integration test with JBoss and Maven.
: I have developed a small client based on Junit to simulate and generate
: multithreaded requests to target server.
: There are several potential options:
: 1. In Maven integration test phase, using Maven plugin cargo to deploy/start
: /test/stop/undeploy in Jboss.
: 2. Using Cactus framework to have in-container test.
: 3. Develop

g*****g
发帖数: 34805
19
Technical babbling and financial babbling, :=)
Seriously, I naked shorted qqqq put in last OE week,
went deep under for couple of days and went toilet paper
thanked to the huge rally. I would have been wiped out
if it's a week like this. I should thank my coming newborn
for its mother can't tolerate this roller roster no more and I
stopped trading early last week.

【在 m******t 的大作中提到】
:
: You mean "technical advice and financial babbling"? ;-)

m******t
发帖数: 2416
20

Well, congratulations! Good time to start
thinking about the college funds, eh? 8-)

【在 g*****g 的大作中提到】
: Technical babbling and financial babbling, :=)
: Seriously, I naked shorted qqqq put in last OE week,
: went deep under for couple of days and went toilet paper
: thanked to the huge rally. I would have been wiped out
: if it's a week like this. I should thank my coming newborn
: for its mother can't tolerate this roller roster no more and I
: stopped trading early last week.

g*****g
发帖数: 34805
21
Yep, this bear market may be once in a life time opportunity,
I can't be happier to see it's dropped so much and I am 100% cash.

【在 m******t 的大作中提到】
:
: Well, congratulations! Good time to start
: thinking about the college funds, eh? 8-)

Z****e
发帖数: 2999
22
没stock没cash的飘过...

【在 g*****g 的大作中提到】
: Yep, this bear market may be once in a life time opportunity,
: I can't be happier to see it's dropped so much and I am 100% cash.

1 (共1页)
进入Java版参与讨论
相关主题
hadoop 2.0要出来了,我看了下架构,感觉很复杂啊大家拍我吧,自己太弱了
请教一个安全方面的MASTER题目maven,struts求助
run servlet from command line?用惯了glassfish,突然要我用tomcat,真实不习惯。
想起几年前Re: run servlet from command line?OpenShift的配置一问
问一个J2EE和Tomcat问题Java Tools and Technologies Landscape for 2014
EasyMock 真的有用么?Spring JBOSS
servlet读取directory的基本问题Any free LDAP server?
Java简直完全不可控啊!!!Java那些XML的config file是怎么生成的?
相关话题的讨论汇总
话题: jmeter话题: junit话题: maven话题: servlet话题: test