You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by ZK <st...@gmail.com> on 2013/09/12 17:08:03 UTC
Is it possible to get assertion failure message and store it in a
variable?
Hi,
Is it possible to get "assertion failure message" and store it in a variable
using beanshell?
I am getting nowhere with this, I have tried but can't get it to work
Is it possible using:
http://jmeter.apache.org/api/org/apache/jmeter/assertions/AssertionResult.html
<http://jmeter.apache.org/api/org/apache/jmeter/assertions/AssertionResult.html>
Does anyone know the correct syntax for getFailureMessage() ?
TIA
ZK
--
View this message in context: http://jmeter.512774.n5.nabble.com/Is-it-possible-to-get-assertion-failure-message-and-store-it-in-a-variable-tp5718151.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: Is it possible to get assertion failure message and store it in
a variable?
Posted by ZK <st...@gmail.com>.
Hey Deepak,
That works!!
Thank you very much!!
:)
ZK
--
View this message in context: http://jmeter.512774.n5.nabble.com/Is-it-possible-to-get-assertion-failure-message-and-store-it-in-a-variable-tp5718151p5718165.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: Is it possible to get assertion failure message and store it in a variable?
Posted by Deepak Shetty <sh...@gmail.com>.
Hi
on 2.9
Sampler
+Assertion
+BeanShell Listener
Code in the listener
import org.apache.jmeter.assertions.AssertionResult;
AssertionResult[] results = sampleResult.getAssertionResults() ;
for(int i =0,j=1 ; i<results.length;i++) {
AssertionResult result = results[i];
if(result.isFailure() || result.isError()) {
vars.put("assertionResult_" + j, result.getFailureMessage());
j++;
}
}
regards
deepak
On Thu, Sep 12, 2013 at 8:08 AM, ZK <st...@gmail.com> wrote:
> Hi,
> Is it possible to get "assertion failure message" and store it in a
> variable
> using beanshell?
> I am getting nowhere with this, I have tried but can't get it to work
>
> Is it possible using:
>
> http://jmeter.apache.org/api/org/apache/jmeter/assertions/AssertionResult.html
> <
> http://jmeter.apache.org/api/org/apache/jmeter/assertions/AssertionResult.html
> >
>
> Does anyone know the correct syntax for getFailureMessage() ?
>
> TIA
> ZK
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Is-it-possible-to-get-assertion-failure-message-and-store-it-in-a-variable-tp5718151.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: Is it possible to get assertion failure message and store it in a variable?
Posted by Deepak Shetty <sh...@gmail.com>.
Should be possible - but to confirm , you are trying to get this in a
listener?
On Thu, Sep 12, 2013 at 8:08 AM, ZK <st...@gmail.com> wrote:
> Hi,
> Is it possible to get "assertion failure message" and store it in a
> variable
> using beanshell?
> I am getting nowhere with this, I have tried but can't get it to work
>
> Is it possible using:
>
> http://jmeter.apache.org/api/org/apache/jmeter/assertions/AssertionResult.html
> <
> http://jmeter.apache.org/api/org/apache/jmeter/assertions/AssertionResult.html
> >
>
> Does anyone know the correct syntax for getFailureMessage() ?
>
> TIA
> ZK
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Is-it-possible-to-get-assertion-failure-message-and-store-it-in-a-variable-tp5718151.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
>
>