Ok i tried this
ThreadGroup
+Loop=10
+DebugSampler (with pre processor to initialise sessionExpired = false)
+IfController(Condition = '${sessionExpired}' != 'true' , Evaluate for all
Children=true)
++dummy Beanshell sampler0
+++Some Assertion that always fails
++dummy Beanshell sampler1
++dummy Beanshell sampler 2 (pretends expiry)
++dummy Beanshell sampler 3 (pretends expiry)
++Response Text Assertion for expiry check(assuming you can use the same one
for all samplers otherwise this could be under every sampler)
++Beanshell Assertion (to set variable , pseudo code below, MUST be after
the Expiry Check assertion above)

seems to work as you want.

regards
deepak


import org.apache.jmeter.assertions.AssertionResult;
if(SampleResult != null) {
   AssertionResult[]  results = SampleResult.getAssertionResults();
   for(int i=0;results!= null && i<results.length;i++){
      AssertionResult result = results[i];
       if("ExpiryCheck".equalsIgnoreCase(result.getName()) &&
(result.isError() || result.isFailure())){
            vars.put("sessionExpired","true"); //variable is reset at start
of loop in the test
       }
   }
}
Failure=false;
failureMessage="";





On Fri, Jan 21, 2011 at 8:22 AM, Deepak Shetty <shet...@gmail.com> wrote:

> >Ok, but isn't it the case that listeners are only executed on the JMeter
> controller in distributed mode and not on the agents?
> It works for me :), since i always use multiple instances rather than
> distributed mode .
> Perhaps you could try adding a Beanshell assertion that always executes
> after the other assertions . JMeterThread.last_sample_ok would have worked
> if any error needed this behavior.
>
>
>
>
> On Thu, Jan 20, 2011 at 11:43 PM, Jens Müller <jen...@hotmail.com> wrote:
>
>>
>> Hi and thank you.
>>
>> > for any error or just the specfic error that you are looking for?
>>
>> This behavior only for the specific error.
>>
>> > If specific error that you seem to have mentioned then you could try
>> adding
>> > a BeanShell listener(scoped to the if statement) to set the variable.
>> >
>> >
>> http://jakarta.apache.org/jmeter/api/org/apache/jmeter/samplers/SampleResult.html#getAssertionResults()<http://jakarta.apache.org/jmeter/api/org/apache/jmeter/samplers/SampleResult.html#getAssertionResults%28%29>
>> > The listener could check which assertion failed and set the variable
>> > accordingly.
>>
>> Ok, but isn't it the case that listeners are only executed on the JMeter
>> controller in distributed mode and not on the agents? Therefore the variable
>> that would be set would not be available on the agent executing the test.
>>
>> > You could also have an if controller that checks the value of
>> > this variable and evaluates this for every child so that the other
>> requests
>> > dont get executed.
>>
>> Right.
>>
>> > But im not sure whether this all happens synchronously
>> > (calling the listener after the sampler and before calling the next
>> sampler)
>> > which would be needed for this to work.
>>
>> See my comment above, I don't think this is a good solution.
>>
>> > out of curiosity why does the session expire? you wont be giving that
>> large
>> > think times and the next request would reset the clock?
>>
>> On easy example: The server is restarted during a long load test run. All
>> subsequent requests would be meaningless as the session is lost.
>> Jens
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
>>
>>
>

Reply via email to