You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Garry Thompson <gt...@attensa.com> on 2006/01/12 20:07:36 UTC
Comparing 2 variables and failing asserion on failure
I have a need to compare 2 variables and if they are not the same to
generate an assertion failure. My first thought was to look for an
assertion that did this but as I understand it assertions only work on
sampler output so no luck here.
I then though of using the If Controller to compare the 2 variables and
then if they didn't compare to generate an assertion failure. But there
doesn't seem to be a way to abritarily generate an assertion failure. So
I then decided to try the size assertion setting it to 1 which should
pretty much always fail. But this assertion never seems to kick off. It
looks like by putting an asserion in an if controller the connection to
the sampler is lost and the assertion doesn't ever fail. I tried putting
the if conroller at the same level as the last sampler as well as a
child. Neither of these work. This seems to be a scoping problem to me.
So is there any easy way to compare 2 variables and then fail an
asserion if they don't compare? I may be missing some much easier method
of doing this.
Thanks....
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Comparing 2 variables and failing asserion on failure
Posted by sebb <se...@gmail.com>.
You could use the BeanShell assertion for this.
On 12/01/06, Garry Thompson <gt...@attensa.com> wrote:
> I have a need to compare 2 variables and if they are not the same to
> generate an assertion failure. My first thought was to look for an
> assertion that did this but as I understand it assertions only work on
> sampler output so no luck here.
>
> I then though of using the If Controller to compare the 2 variables and
> then if they didn't compare to generate an assertion failure. But there
> doesn't seem to be a way to abritarily generate an assertion failure. So
> I then decided to try the size assertion setting it to 1 which should
> pretty much always fail. But this assertion never seems to kick off. It
> looks like by putting an asserion in an if controller the connection to
> the sampler is lost and the assertion doesn't ever fail. I tried putting
> the if conroller at the same level as the last sampler as well as a
> child. Neither of these work. This seems to be a scoping problem to me.
>
> So is there any easy way to compare 2 variables and then fail an
> asserion if they don't compare? I may be missing some much easier method
> of doing this.
>
> Thanks....
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org