jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: beanshell and Aggregate Graph, recording errors not working
Date Tue, 10 May 2011 14:00:05 GMT
On 10 May 2011 14:54, Eric Gandt <eric.gandt@fatwire.com> wrote:
> I have a beanshell that I'm running using the "BeanShell Sampler", it looks
> like:
>
> addClassPath("/storage/shared/perf.jar");
> importCommands("/");
> addClassPath(".");
> importCommands("/");
>
> // auto assume that the updfate failed, therefore if anything goes wrong and
> we exit for some reason it will have failed
> vars.put("IsSuccess", "false");
> vars.put("ResponseMessage", "NOT OK");
>
> // Article Asset creation object
> CreateArticleAsset CAA = new CreateArticleAsset("http://" + bsh.args[0] +
> ":" + bsh.args[1] + "/" + bsh.args[2]);
>
> String responsecode = CAA.editAsset(bsh.args[3]);
>
> //enable for debugging only
> print (responsecode);
>
> // return the response code
> vars.put("ResponseCode", responsecode);
>
> // last check if wwe got a 200 back if so then and only then are we
> successful at updating
> if(responsecode.compareTo("200")  == 0) {
>    vars.put("IsSuccess", "true");
>    vars.put("ResponseMessage", "OK");
> }
>
> //always return the response code
> return responsecode;
>
>
> Now the code executed always returns 200 or 404, yet even when a 404 is
> returned and thus IsSuccess is set to "false" and ResponseMessage is "Not
> OK" and the ResponseCode is "404" the Aggregate graph still records the run
> as successful, which makes monitoring it worthless, as I need to know when
> it works and when it fails.
>
> Another related question if a BeanShell script exits, why does jmeter also
> exit?

Because the script is run in the context of the JMeter code.
This is necessary to allow access to JMeter variables and methods.

>
> Thanks,
> ERIC
>
>
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/beanshell-and-Aggregate-Graph-recording-errors-not-working-tp4384523p4384523.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message