You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Sabrina <mo...@gmail.com> on 2006/06/08 15:08:35 UTC

Calling Java Classes From JMeter

I was informed that Jmeter has the capability to call Java classes I was
wondering where I can find some documentation on this functionality.

Thanks
--
View this message in context: http://www.nabble.com/Calling-Java-Classes-From-JMeter-t1754973.html#a4771959
Sent from the JMeter - User forum at Nabble.com.


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


Re: Calling Java Classes From JMeter

Posted by Peter Lin <wo...@gmail.com>.
if you already have JUnit tests, there is a tutorial on how to use
junitsampler

http://jakarta.apache.org/jmeter/usermanual/junitsampler_tutorial.pdf

peter


On 6/8/06, sebb <se...@gmail.com> wrote:
>
> Perhaps you should ask your informant!
>
> It's not possible to call arbitrary Java classes from JMeter, at least
> not without writing some code.
>
> Have a look at the JUnit Sampler:
>
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#JUnit_Sampler
>
> and the BeanShell Sampler:
>
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BeanShell_Sampler
>
> S
> On 08/06/06, Sabrina <mo...@gmail.com> wrote:
> >
> > I was informed that Jmeter has the capability to call Java classes I was
> > wondering where I can find some documentation on this functionality.
> >
> > Thanks
> > --
> > View this message in context:
> http://www.nabble.com/Calling-Java-Classes-From-JMeter-t1754973.html#a4771959
> > Sent from the JMeter - User forum 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
>
>

Re: Calling Java Classes From JMeter

Posted by sebb <se...@gmail.com>.
Perhaps you should ask your informant!

It's not possible to call arbitrary Java classes from JMeter, at least
not without writing some code.

Have a look at the JUnit Sampler:

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#JUnit_Sampler

and the BeanShell Sampler:

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#BeanShell_Sampler

S
On 08/06/06, Sabrina <mo...@gmail.com> wrote:
>
> I was informed that Jmeter has the capability to call Java classes I was
> wondering where I can find some documentation on this functionality.
>
> Thanks
> --
> View this message in context: http://www.nabble.com/Calling-Java-Classes-From-JMeter-t1754973.html#a4771959
> Sent from the JMeter - User forum 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


Re: Calling Java Classes From JMeter

Posted by sebb <se...@gmail.com>.
You can certainly use the RE with Java Requests.

The RE works on the body, headers or URL.

The setResponseMessage() method sets the message corresponding to the
responseCode. e.g. for code=200 that would be "OK". These are not part
of the headers, certainly for a SampleResult.

You probably ought to be using setResponseData() instead.

S
On 16/06/06, Josh Drummond <jd...@uci.edu> wrote:
>
> I'm also having a problem with this.  I successfully created a custom java
> request class, compiled/jarred and it shows up in the JMeter GUI dropdown.
> I added this Java Request to my JMeter test and the class is getting called
> correctly.  However I want to return data from the Java Request back to my
> JMeter script for use later in the script.  To do this I call
> "results.setResponseMessage()" inside the runTest() method and return that
> results object.  I know it is returning this correctly because I have a View
> Results Tree control and for each Java Request the Sampler Result has my
> string as the HTTP response message.  Next step I want to extract that value
> using the Regular Expression Extractor (I've done this before extracting
> results from normal http requests without any problem), however when I do it
> for a Java Request (the same data pattern and regex) it does not find a
> match.  I'm fairly certain there isn't a problem in the data or regex, so my
> question is can I even use a Regular Expression Extractor as a child Post
> Processor to a Java Request and successfully extract data from the HTTP
> response message of the Sampler result?
> --
> View this message in context: http://www.nabble.com/Calling-Java-Classes-From-JMeter-t1754973.html#a4909157
> Sent from the JMeter - User forum 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


Re: Calling Java Classes From JMeter

Posted by Josh Drummond <jd...@uci.edu>.
I'm also having a problem with this.  I successfully created a custom java
request class, compiled/jarred and it shows up in the JMeter GUI dropdown. 
I added this Java Request to my JMeter test and the class is getting called
correctly.  However I want to return data from the Java Request back to my
JMeter script for use later in the script.  To do this I call
"results.setResponseMessage()" inside the runTest() method and return that
results object.  I know it is returning this correctly because I have a View
Results Tree control and for each Java Request the Sampler Result has my
string as the HTTP response message.  Next step I want to extract that value
using the Regular Expression Extractor (I've done this before extracting
results from normal http requests without any problem), however when I do it
for a Java Request (the same data pattern and regex) it does not find a
match.  I'm fairly certain there isn't a problem in the data or regex, so my
question is can I even use a Regular Expression Extractor as a child Post
Processor to a Java Request and successfully extract data from the HTTP
response message of the Sampler result?
--
View this message in context: http://www.nabble.com/Calling-Java-Classes-From-JMeter-t1754973.html#a4909157
Sent from the JMeter - User forum at Nabble.com.


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


Re: Calling Java Classes From JMeter

Posted by Peter Lin <wo...@gmail.com>.
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Java_Request

the documentation is a bit lite, but there's some info on the javasampler

peter

On 6/8/06, Sabrina <mo...@gmail.com> wrote:
>
>
> I was informed that Jmeter has the capability to call Java classes I was
> wondering where I can find some documentation on this functionality.
>
> Thanks
> --
> View this message in context:
> http://www.nabble.com/Calling-Java-Classes-From-JMeter-t1754973.html#a4771959
> Sent from the JMeter - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>