You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by R R <ra...@hotmail.co.uk> on 2006/09/07 12:36:08 UTC

TestBean and Objects

Hi,

We have been using Bean Shell for testing some protocols that are not part 
of the standard samplers.

I would like to make this a little more user friendly so the developers can 
play around on there own without having to learn our API calls etc…

It looks like the easiest way to do this is via a TestBean sampler which is 
reasonably straight forward to setup… Even for a Java noob like me :)

With the Bean Shell sampler we can call our API and then do 
var.put/getObject to keep the object alive across calls. Is there an 
equivalent way to do this from within the TestBean sampler?
1)

Thanx in advance…

R

_________________________________________________________________
Windows Live™ Messenger has arrived. Click here to download it for free! 
http://imagine-msn.com/messenger/launch80/?locale=en-gb


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: TestBean and Objects

Posted by R R <ra...@hotmail.co.uk>.
Hi,

Thanx Again.

I took the plunge and made our own custom sampler. For anyone else with low 
Java skills who wants to do this I found the Test Sampler a perfect place to 
start from. Its simple and with lots of copy and paste, easy to start making 
changes to it.

Cheers

R


>From: sebb <se...@gmail.com>
>Reply-To: "JMeter Users List" <jm...@jakarta.apache.org>
>To: "JMeter Users List" <jm...@jakarta.apache.org>
>Subject: Re: TestBean and Objects
>Date: Tue, 12 Sep 2006 16:25:27 +0100
>
>On 08/09/06, R R <ra...@hotmail.co.uk> wrote:
>>Hello again! :)
>>
>>So this is all working very nicely now and it did not take much time at 
>>all
>>to set-up.
>>
>>The only issue I have left is getting the TestBean to show a TextArea for
>>one of the parameters. This parameter can be any XML message (which can be
>>very long) with some of the values being variables to be taken from Jmeter
>>logic.
>>
>>The ideas I have had to solve it are:
>>
>>1) Build a new GUI sampler (probably a bit over my current java skills.... 
>>)
>>2) Get the API to look at a flat file for the info it should read. But in
>>this file have the xml statments with some "token" which I can get the 
>>user
>>to put into the TestBean variable as "Token1,${value1},Token2,${Value2},
>>etc...
>>
>>But if there is a way to get the TestBean sampler to show a textarea it
>>would make things a lot easier....
>>
>
>It is probably not all that difficult to add text area support.
>Probably easiest to start with the classes that support TestBean plain
>text input, and create new classes that use TextArea instead.
>
>S.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>

_________________________________________________________________
Download the new Windows Live Toolbar, including Desktop search! 
http://toolbar.live.com/?mkt=en-gb


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: TestBean and Objects

Posted by sebb <se...@gmail.com>.
On 08/09/06, R R <ra...@hotmail.co.uk> wrote:
> Hello again! :)
>
> So this is all working very nicely now and it did not take much time at all
> to set-up.
>
> The only issue I have left is getting the TestBean to show a TextArea for
> one of the parameters. This parameter can be any XML message (which can be
> very long) with some of the values being variables to be taken from Jmeter
> logic.
>
> The ideas I have had to solve it are:
>
> 1) Build a new GUI sampler (probably a bit over my current java skills.... )
> 2) Get the API to look at a flat file for the info it should read. But in
> this file have the xml statments with some "token" which I can get the user
> to put into the TestBean variable as "Token1,${value1},Token2,${Value2},
> etc...
>
> But if there is a way to get the TestBean sampler to show a textarea it
> would make things a lot easier....
>

It is probably not all that difficult to add text area support.
Probably easiest to start with the classes that support TestBean plain
text input, and create new classes that use TextArea instead.

S.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: TestBean and Objects

Posted by R R <ra...@hotmail.co.uk>.
Hello again! :)

So this is all working very nicely now and it did not take much time at all 
to set-up.

The only issue I have left is getting the TestBean to show a TextArea for 
one of the parameters. This parameter can be any XML message (which can be 
very long) with some of the values being variables to be taken from Jmeter 
logic.

The ideas I have had to solve it are:

1) Build a new GUI sampler (probably a bit over my current java skills.... )
2) Get the API to look at a flat file for the info it should read. But in 
this file have the xml statments with some "token" which I can get the user 
to put into the TestBean variable as "Token1,${value1},Token2,${Value2}, 
etc...

But if there is a way to get the TestBean sampler to show a textarea it 
would make things a lot easier....

Cheers

R


>From: sebb <se...@gmail.com>
>Reply-To: "JMeter Users List" <jm...@jakarta.apache.org>
>To: "JMeter Users List" <jm...@jakarta.apache.org>
>Subject: Re: TestBean and Objects
>Date: Thu, 7 Sep 2006 18:48:07 +0100
>
>One way round this would be to define some utility methods in the
>appropriate .bshrc file. The code in the sampler could then be
>simplified.
>
>If you don't have too many variables, these can be passed in as
>parameters to the BeanShell script, which could then be stored in a
>file.
>
>So you would just need to tell users what parameters to use, and the
>bsh file name.
>
>==
>
>But I agree that creating a sampler based on the TestBean class would be 
>neater.
>
>Try looking at some of the examples to see how it works.
>
>The package
>
>org.apache.jmeter.examples.testbeans.example2
>
>has a sampler with resources.
>
>You can use the following code to get access the variables for the thread:
>
>JMeterContext jmctx = JMeterContextService.getContext();
>JMeterVariables vars = jmctx.getVariables();
>
>S.
>On 07/09/06, R R <ra...@hotmail.co.uk> wrote:
>>Hi,
>>
>>We have been using Bean Shell for testing some protocols that are not part
>>of the standard samplers.
>>
>>I would like to make this a little more user friendly so the developers 
>>can
>>play around on there own without having to learn our API calls etc…
>>
>>It looks like the easiest way to do this is via a TestBean sampler which 
>>is
>>reasonably straight forward to setup… Even for a Java noob like me :)
>>
>>With the Bean Shell sampler we can call our API and then do
>>var.put/getObject to keep the object alive across calls. Is there an
>>equivalent way to do this from within the TestBean sampler?
>>1)
>>
>>Thanx in advance…
>>
>>R
>>
>>_________________________________________________________________
>>Windows Live™ Messenger has arrived. Click here to download it for free!
>>http://imagine-msn.com/messenger/launch80/?locale=en-gb
>>
>>
>>---------------------------------------------------------------------
>>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
>

_________________________________________________________________
Windows Live™ Messenger has arrived. Click here to download it for free! 
http://imagine-msn.com/messenger/launch80/?locale=en-gb


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: TestBean and Objects

Posted by R R <ra...@hotmail.co.uk>.
Thanx Sebb,

As always very helpful :)

R


>From: sebb <se...@gmail.com>
>Reply-To: "JMeter Users List" <jm...@jakarta.apache.org>
>To: "JMeter Users List" <jm...@jakarta.apache.org>
>Subject: Re: TestBean and Objects
>Date: Thu, 7 Sep 2006 18:48:07 +0100
>
>One way round this would be to define some utility methods in the
>appropriate .bshrc file. The code in the sampler could then be
>simplified.
>
>If you don't have too many variables, these can be passed in as
>parameters to the BeanShell script, which could then be stored in a
>file.
>
>So you would just need to tell users what parameters to use, and the
>bsh file name.
>
>==
>
>But I agree that creating a sampler based on the TestBean class would be 
>neater.
>
>Try looking at some of the examples to see how it works.
>
>The package
>
>org.apache.jmeter.examples.testbeans.example2
>
>has a sampler with resources.
>
>You can use the following code to get access the variables for the thread:
>
>JMeterContext jmctx = JMeterContextService.getContext();
>JMeterVariables vars = jmctx.getVariables();
>
>S.
>On 07/09/06, R R <ra...@hotmail.co.uk> wrote:
>>Hi,
>>
>>We have been using Bean Shell for testing some protocols that are not part
>>of the standard samplers.
>>
>>I would like to make this a little more user friendly so the developers 
>>can
>>play around on there own without having to learn our API calls etc…
>>
>>It looks like the easiest way to do this is via a TestBean sampler which 
>>is
>>reasonably straight forward to setup… Even for a Java noob like me :)
>>
>>With the Bean Shell sampler we can call our API and then do
>>var.put/getObject to keep the object alive across calls. Is there an
>>equivalent way to do this from within the TestBean sampler?
>>1)
>>
>>Thanx in advance…
>>
>>R
>>
>>_________________________________________________________________
>>Windows Live™ Messenger has arrived. Click here to download it for free!
>>http://imagine-msn.com/messenger/launch80/?locale=en-gb
>>
>>
>>---------------------------------------------------------------------
>>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
>

_________________________________________________________________
Windows Live™ Messenger has arrived. Click here to download it for free! 
http://imagine-msn.com/messenger/launch80/?locale=en-gb


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: TestBean and Objects

Posted by sebb <se...@gmail.com>.
One way round this would be to define some utility methods in the
appropriate .bshrc file. The code in the sampler could then be
simplified.

If you don't have too many variables, these can be passed in as
parameters to the BeanShell script, which could then be stored in a
file.

So you would just need to tell users what parameters to use, and the
bsh file name.

==

But I agree that creating a sampler based on the TestBean class would be neater.

Try looking at some of the examples to see how it works.

The package

org.apache.jmeter.examples.testbeans.example2

has a sampler with resources.

You can use the following code to get access the variables for the thread:

JMeterContext jmctx = JMeterContextService.getContext();
JMeterVariables vars = jmctx.getVariables();

S.
On 07/09/06, R R <ra...@hotmail.co.uk> wrote:
> Hi,
>
> We have been using Bean Shell for testing some protocols that are not part
> of the standard samplers.
>
> I would like to make this a little more user friendly so the developers can
> play around on there own without having to learn our API calls etc…
>
> It looks like the easiest way to do this is via a TestBean sampler which is
> reasonably straight forward to setup… Even for a Java noob like me :)
>
> With the Bean Shell sampler we can call our API and then do
> var.put/getObject to keep the object alive across calls. Is there an
> equivalent way to do this from within the TestBean sampler?
> 1)
>
> Thanx in advance…
>
> R
>
> _________________________________________________________________
> Windows Live™ Messenger has arrived. Click here to download it for free!
> http://imagine-msn.com/messenger/launch80/?locale=en-gb
>
>
> ---------------------------------------------------------------------
> 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