You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Marcelo Jara <ma...@hotmail.com> on 2017/01/12 03:40:30 UTC

Beanshell post processor and assertions

I have a response assertion which looks for an error code in the response data. When found the sampler is correctly marked a failure. I then have a Beanshell post processor which looks to see if the previous sampler was an error (!prev.isSuccessfull()). This is not working because the response for isSuccessfull() is coming back as true even though the sampler failed due to the assertion. Is there another way in Beanshell to check for the failure?


Thanks,


MJ


Re: Beanshell post processor and assertions

Posted by sebb <se...@gmail.com>.
You might find a JSR223 Assertion easier to use; if that is placed
after any existing Assertions it should run after them.
However I have not tried this.

Alternatively, use the JSR223 Assertion to both check the condition
and do any further processing.

On 12 January 2017 at 08:04, UBIK LOAD PACK Support
<su...@ubikloadpack.com> wrote:
> Hello,
> As per:
> http://jmeter.apache.org/usermanual/component_reference.html#postprocessors
>
> PostProcessors are ran before assertions that's why you're facing this
> issue.
> An option is to use a BeanShell PreProcessor in the next sampler and test
> for "JMeterThread.last_sample_ok" variable which JMeter sets.
> Besides, you should switch to JSR223 + Groovy instead of Beanshell for
> performance and maintainability.
>
> Regards
> @ubikloadpack
>
> On Thu, Jan 12, 2017 at 4:40 AM, Marcelo Jara <ma...@hotmail.com>
> wrote:
>
>> I have a response assertion which looks for an error code in the response
>> data. When found the sampler is correctly marked a failure. I then have a
>> Beanshell post processor which looks to see if the previous sampler was an
>> error (!prev.isSuccessfull()). This is not working because the response for
>> isSuccessfull() is coming back as true even though the sampler failed due
>> to the assertion. Is there another way in Beanshell to check for the
>> failure?
>>
>>
>> Thanks,
>>
>>
>> MJ
>>
>>
>
>
> --
>
> Regards
> Ubik Load Pack <http://ubikloadpack.com> Team
> Follow us on Twitter <http://twitter.com/ubikloadpack>
>
>
> Cordialement
> L'équipe Ubik Load Pack <http://ubikloadpack.com>
> Suivez-nous sur Twitter <http://twitter.com/ubikloadpack>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: Beanshell post processor and assertions

Posted by UBIK LOAD PACK Support <su...@ubikloadpack.com>.
Hello,
As per:
http://jmeter.apache.org/usermanual/component_reference.html#postprocessors

PostProcessors are ran before assertions that's why you're facing this
issue.
An option is to use a BeanShell PreProcessor in the next sampler and test
for "JMeterThread.last_sample_ok" variable which JMeter sets.
Besides, you should switch to JSR223 + Groovy instead of Beanshell for
performance and maintainability.

Regards
@ubikloadpack

On Thu, Jan 12, 2017 at 4:40 AM, Marcelo Jara <ma...@hotmail.com>
wrote:

> I have a response assertion which looks for an error code in the response
> data. When found the sampler is correctly marked a failure. I then have a
> Beanshell post processor which looks to see if the previous sampler was an
> error (!prev.isSuccessfull()). This is not working because the response for
> isSuccessfull() is coming back as true even though the sampler failed due
> to the assertion. Is there another way in Beanshell to check for the
> failure?
>
>
> Thanks,
>
>
> MJ
>
>


-- 

Regards
Ubik Load Pack <http://ubikloadpack.com> Team
Follow us on Twitter <http://twitter.com/ubikloadpack>


Cordialement
L'équipe Ubik Load Pack <http://ubikloadpack.com>
Suivez-nous sur Twitter <http://twitter.com/ubikloadpack>