jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: different user get same response data
Date Tue, 04 Dec 2012 10:21:05 GMT
On 4 December 2012 06:01, frank <hwl@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


Mime
View raw message