jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: Is it possible to get assertion failure message and store it in a variable?
Date Thu, 12 Sep 2013 20:16:41 GMT
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 <stevesenior69@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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message