On 12/10/2008, Pavel Gouchtchine <[EMAIL PROTECTED]> wrote:
> Hi All.
> I am trying to get access to "prev" variable (SampleResult object)
> from BeanShell Assertion.
> My code look like this:
>
> import org.apache.jmeter.util.JMeterUtils;
> import org.apache.jmeter.samplers.SampleResult;
>
> print("running");
> SampleResult prev=vars.get("prev");
> if (prev != null) {
> print("prev is not null");
> results=prev.getAssertionResults();
> if (results == null) print ("results is null");
> size = results.length;
> for (int i=0; i<=size-1; i++) {
> result_item = results[i];
> if (result_item == null) print ("result item is null")
> else ("result_item "+i+" is not null");
> }
>
> This code does not work at all. prev variable is null.
The previous sampler is stored in the BeanShell variable "prev", not
the JMeter variable "prev". The code above overwrote the variable you
want...
Just use "prev" - it is already set up, as are the other variables,
e.g. "log", "ctx" etc.
> Please, help.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]