You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by frank <hw...@windowslive.com> on 2012/12/04 07:01:12 UTC
different user get same response data
i need to do the assertion after collecting some response data of requests,
e.g.
there are 2 request - request1 and request2, then i need to collect the
response data of request1 and request2, then do the assertion on request2 (
add beanshell assertion under request2 ).
my test plan looks like next :
Test Plan
|_Http Cookie Manager
|_CSV Data Set
|_threadgroup
|_request1
|_beanshell postprocessor
|_request2
|_beanshell post processor
|_beanshell assertion
i set the number of threads is 5 in thread group.
wherein the 'Http Cookie Manager' use default setting, the 'Cookie Policy'
is compatibility.
the 'beanshell post processor' is used for collecting response data, the
following is its script :
String tmp = "";if( props.get("GRD")==null) { tmp =
prev.getResponseDataAsString();}else {tmp = props.get("GRD") +
prev.getResponseDataAsString();}props.put("GRD",tmp);
and next is beanshell assertion script :
String responseData = props.get("GRD");
responseData = "<root>"+responseData+"</root>";
log.warn("response data : "+responseData);
if(!responseData.contains("...")){Failure=true; FailureMessage=".....";}
props.put("GRD","");
but sometimes, i found that - log.warn("response data : "+responseData),
would print out same response data for different user in jmeter.log, take 5
users( threads ) for example, e.g.
response data1 : <user1> data
response data2 : <user1> data
response data3 :
response data4 : <user4> data
response data5 : <user5> data
response data2 should be 'user2' data, but now it's user1 data. but in
'Response data' tab of jmeter gui, it's user2 data.
i checked the application log, and found that next log info :
15:51:30.613 : <user1> data
15:51:30.614 : <user2> data
the response time of user1 and user2 are very close, the difference is 1
millisecond,
so is this results in 'user2' get user1's response data in beanshell post
processor?
how to solve this problem?
Thanks in advance!
--
View this message in context: http://jmeter.512774.n5.nabble.com/different-user-get-same-response-data-tp5715481.html
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: different user get same response data
Posted by sebb <se...@gmail.com>.
On 13 December 2012 04:28, frank <hw...@windowslive.com> wrote:
> maybe it's the fault of my script.
>
> i used ${_setProperty()} to store response data in one post processor, and
> used ${_property()} to get response data in another post processor, so if
> there are multiple users, this will result in the problem i said.
Properties are global.
You probably need to be using variables instead.
> Thanks!
>
>
>
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/different-user-get-same-response-data-tp5715481p5715541.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: different user get same response data
Posted by frank <hw...@windowslive.com>.
maybe it's the fault of my script.
i used ${_setProperty()} to store response data in one post processor, and
used ${_property()} to get response data in another post processor, so if
there are multiple users, this will result in the problem i said.
Thanks!
--
View this message in context: http://jmeter.512774.n5.nabble.com/different-user-get-same-response-data-tp5715481p5715541.html
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: different user get same response data
Posted by Deepak Goel <de...@gmail.com>.
Might be a bug, lowest common denominator in printing if the response
time is same (user1, user2)
On 12/4/12, sebb <se...@gmail.com> wrote:
> On 4 December 2012 06:01, frank <hw...@windowslive.com> wrote:
>> i need to do the assertion after collecting some response data of
>> requests,
>> e.g.
>> there are 2 request - request1 and request2, then i need to collect the
>> response data of request1 and request2, then do the assertion on request2
>> (
>> add beanshell assertion under request2 ).
>>
>> my test plan looks like next :
>>
>> Test Plan
>> |_Http Cookie Manager
>> |_CSV Data Set
>> |_threadgroup
>> |_request1
>> |_beanshell postprocessor
>> |_request2
>> |_beanshell post processor
>> |_beanshell assertion
>>
>> i set the number of threads is 5 in thread group.
>>
>> wherein the 'Http Cookie Manager' use default setting, the 'Cookie
>> Policy'
>> is compatibility.
>>
>> the 'beanshell post processor' is used for collecting response data, the
>> following is its script :
>>
>> String tmp = "";if( props.get("GRD")==null) { tmp =
>> prev.getResponseDataAsString();}else {tmp = props.get("GRD") +
>> prev.getResponseDataAsString();}props.put("GRD",tmp);
>>
>> and next is beanshell assertion script :
>>
>> String responseData = props.get("GRD");
>> responseData = "<root>"+responseData+"</root>";
>> log.warn("response data : "+responseData);
>> if(!responseData.contains("...")){Failure=true; FailureMessage=".....";}
>>
>> props.put("GRD","");
>>
>> but sometimes, i found that - log.warn("response data : "+responseData),
>> would print out same response data for different user in jmeter.log, take
>> 5
>> users( threads ) for example, e.g.
>>
>> response data1 : <user1> data
>> response data2 : <user1> data
>> response data3 :
>> response data4 : <user4> data
>> response data5 : <user5> data
>>
>> response data2 should be 'user2' data, but now it's user1 data. but in
>> 'Response data' tab of jmeter gui, it's user2 data.
>>
>> i checked the application log, and found that next log info :
>>
>> 15:51:30.613 : <user1> data
>> 15:51:30.614 : <user2> data
>>
>> the response time of user1 and user2 are very close, the difference is 1
>> millisecond,
>> so is this results in 'user2' get user1's response data in beanshell post
>> processor?
>
> No, that cannot happen.
>
> I suspect you misunderstand how CSV DataSet works.
> It does not hand out values in strict thread number order, instead it
> hands them out on request by each thread.
>
>> how to solve this problem?
>
> Add Debug Samplers to show the variables at different points in the test
> plan.
>
>> Thanks in advance!
>>
>>
>>
>> --
>> View this message in context:
>> http://jmeter.512774.n5.nabble.com/different-user-get-same-response-data-tp5715481.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>
--
Namaskara~Nalama~Guten Tag~Bonjour
--
Keigu
Deepak
+91-9765089593
deicool@gmail.com
http://www.simtree.net
Skype: thumsupdeicool
Google talk: deicool
Blog: http://loveandfearless.wordpress.com
Facebook: http://www.facebook.com/deicool
"Contribute to the world, environment and more : http://www.gridrepublic.org
"
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: different user get same response data
Posted by sebb <se...@gmail.com>.
On 4 December 2012 06:01, frank <hw...@windowslive.com> wrote:
> i need to do the assertion after collecting some response data of requests,
> e.g.
> there are 2 request - request1 and request2, then i need to collect the
> response data of request1 and request2, then do the assertion on request2 (
> add beanshell assertion under request2 ).
>
> my test plan looks like next :
>
> Test Plan
> |_Http Cookie Manager
> |_CSV Data Set
> |_threadgroup
> |_request1
> |_beanshell postprocessor
> |_request2
> |_beanshell post processor
> |_beanshell assertion
>
> i set the number of threads is 5 in thread group.
>
> wherein the 'Http Cookie Manager' use default setting, the 'Cookie Policy'
> is compatibility.
>
> the 'beanshell post processor' is used for collecting response data, the
> following is its script :
>
> String tmp = "";if( props.get("GRD")==null) { tmp =
> prev.getResponseDataAsString();}else {tmp = props.get("GRD") +
> prev.getResponseDataAsString();}props.put("GRD",tmp);
>
> and next is beanshell assertion script :
>
> String responseData = props.get("GRD");
> responseData = "<root>"+responseData+"</root>";
> log.warn("response data : "+responseData);
> if(!responseData.contains("...")){Failure=true; FailureMessage=".....";}
>
> props.put("GRD","");
>
> but sometimes, i found that - log.warn("response data : "+responseData),
> would print out same response data for different user in jmeter.log, take 5
> users( threads ) for example, e.g.
>
> response data1 : <user1> data
> response data2 : <user1> data
> response data3 :
> response data4 : <user4> data
> response data5 : <user5> data
>
> response data2 should be 'user2' data, but now it's user1 data. but in
> 'Response data' tab of jmeter gui, it's user2 data.
>
> i checked the application log, and found that next log info :
>
> 15:51:30.613 : <user1> data
> 15:51:30.614 : <user2> data
>
> the response time of user1 and user2 are very close, the difference is 1
> millisecond,
> so is this results in 'user2' get user1's response data in beanshell post
> processor?
No, that cannot happen.
I suspect you misunderstand how CSV DataSet works.
It does not hand out values in strict thread number order, instead it
hands them out on request by each thread.
> how to solve this problem?
Add Debug Samplers to show the variables at different points in the test plan.
> Thanks in advance!
>
>
>
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/different-user-get-same-response-data-tp5715481.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org