You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Sebastian Straus <su...@gmx.de> on 2007/08/31 13:10:49 UTC

BeanShellSampler and SampleResult

Dear JMeter-Users,

I want to use a BeanShell Sampler to recieve data from a SampleResult, but my BSH Sampler references has no reference.
I'm not sure but I think my main problem is that i need to get data from a html response in my BeanShell Sampler. The Problem: It's not possible to use the Regular Expression Extractor as the Post Processor, because the number of variables depends on the content of the html response:
So first i have to get the number of relevant arguments in my BSH Sampler, then i have to declare the necessary number of variables, have to take the arguments and put them in the next request.
Please, please help me. It's very important and you can maybe help me if you show me a sample of a BeanShell Sampler, which retrieve a number of information with its SampleResult Variable.

Thank you for your help and your support

Sebastian
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser


Re: BeanShellSampler and SampleResult

Posted by chris <hi...@gmx.at>.
hi sebastian,

use a httpsampler, and add a BeanshellPostProcessor. with the "prev" 
variable, you have access to the responsedata of the httpsampler:
    String responseData = prev.getResponseDataAsString();

extract the data you need from "responseData" and set variables with:
   vars.put("VAR1", "foo");

in the next request (httpsampler), you can access those variables with 
${VAR1} etc...

hope that helps,
   chris



"Sebastian Straus" <su...@gmx.de> schrieb im Newsbeitrag 
news:20070831111049.208530@gmx.net...
> Dear JMeter-Users,
>
> I want to use a BeanShell Sampler to recieve data from a SampleResult, but 
> my BSH Sampler references has no reference.
> I'm not sure but I think my main problem is that i need to get data from a 
> html response in my BeanShell Sampler. The Problem: It's not possible to 
> use the Regular Expression Extractor as the Post Processor, because the 
> number of variables depends on the content of the html response:
> So first i have to get the number of relevant arguments in my BSH Sampler, 
> then i have to declare the necessary number of variables, have to take the 
> arguments and put them in the next request.
> Please, please help me. It's very important and you can maybe help me if 
> you show me a sample of a BeanShell Sampler, which retrieve a number of 
> information with its SampleResult Variable.
>
> Thank you for your help and your support
>
> Sebastian
> -- 
> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
> Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
>
>


--------------------------------------------------------------------------------


> ---------------------------------------------------------------------
> 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