You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Alec Swan <au...@yahoo.com> on 2006/08/19 01:06:01 UTC

JMeter extensions

I am trying to extend JMeter with a sampler that can just execute a command line. I copied ExampleSampler and ExampleSamplerGui classes from http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/
and I added the classes directory to user.classpath in jmeter.properties, but the example sampler does not show up in Edit->Add->Sampler menu.

1. I am not sure what the problem is, so I wonder if I missed any steps.

2. Could anybody point me to the current documentation which explains in English how to extend JMeter.

3. Also, is there a repository of JMeter extensions available online? In particular, is there something that add command-line execution functionality to JMeter.

Thanks.

Re: JMeter extensions

Posted by sebb <se...@gmail.com>.
It will not help to enable beanshell logging.

But you should check jmeter.log for any beanshell error messages -
e.g. perhaps java.exe was not found or could not be started.

I tried

exec("netstat");

and that displayed OK in the console window.

S.

On 21/08/06, Alec Swan <au...@yahoo.com> wrote:
> I just tried print(), System.out.println(..) and System.err.println(). All of them print messages to the jmeter.bat console, but not in jmeter.log. However,  I can't find where messages from exec("java -version") get printed out. Do I need to enable logging for beanshell in jmeter.properties?
>
> sebb <se...@gmail.com> wrote: Java on Linux should work in the same way as far as stdout and stderr
> are concerned.
>
> Try:
>
> print("test message");
>
> in BeanShell - that will be written to stdout.
>
> If that appears, but the output from exec() does not, then perhaps the
> exec output is not being written to stdout.
>
> You can also try the following in BeanShell:
>
> System.out.println("stdout");
> System.err.println("stderr");
>
> and see where they go.
>
> On 21/08/06, Daman Jawda  wrote:
> > Yes Unfortunately I run jmeter in linux - if stdout would indeed appear on
> > my shell , even though i invoke jmeter with an ampersand at the end, I
> > should check the shell for the output of scripts invoked using beanshell
> > exec() call in jmeter. But I don't recall seeing any such output on the
> > shell since I often go back to the shell while jmeter is running.
> >
> > Hmmm.
> > Without this output my test script would be useless.
> >
> >
> >
> > On 8/20/06, sebb  wrote:
> > > JMeter does not change stdout or stderr, so it will appear in the
> > > command-line console used to start JMeter (unless you used javaw, in
> > > which case I'm not sure where stdout goes - it may be thrown away).
> > >
> > > The same would apply if you wrote your own sampler in Java.
> > >
> > > On 20/08/06, Jaw Dat  wrote:
> > > > On Sat, 2006-08-19 at 00:23 +0100, sebb wrote:
> > > >
> > > > > The BeanShell Sampler can execute a command-line.
> > > > >
> > > > > I think it is as simple as
> > > > >
> > > > > exec("command-line");
> > > > >
> > > >
> > > > Where do we see the output from this command-line command? Where to look
> > > > for the stdout output from such a command called with exec() ??????
> > > > Thanks.
> > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > 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
>
>
>
>

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


Re: JMeter extensions

Posted by Alec Swan <au...@yahoo.com>.
I just tried print(), System.out.println(..) and System.err.println(). All of them print messages to the jmeter.bat console, but not in jmeter.log. However,  I can't find where messages from exec("java -version") get printed out. Do I need to enable logging for beanshell in jmeter.properties?

sebb <se...@gmail.com> wrote: Java on Linux should work in the same way as far as stdout and stderr
are concerned.

Try:

print("test message");

in BeanShell - that will be written to stdout.

If that appears, but the output from exec() does not, then perhaps the
exec output is not being written to stdout.

You can also try the following in BeanShell:

System.out.println("stdout");
System.err.println("stderr");

and see where they go.

On 21/08/06, Daman Jawda  wrote:
> Yes Unfortunately I run jmeter in linux - if stdout would indeed appear on
> my shell , even though i invoke jmeter with an ampersand at the end, I
> should check the shell for the output of scripts invoked using beanshell
> exec() call in jmeter. But I don't recall seeing any such output on the
> shell since I often go back to the shell while jmeter is running.
>
> Hmmm.
> Without this output my test script would be useless.
>
>
>
> On 8/20/06, sebb  wrote:
> > JMeter does not change stdout or stderr, so it will appear in the
> > command-line console used to start JMeter (unless you used javaw, in
> > which case I'm not sure where stdout goes - it may be thrown away).
> >
> > The same would apply if you wrote your own sampler in Java.
> >
> > On 20/08/06, Jaw Dat  wrote:
> > > On Sat, 2006-08-19 at 00:23 +0100, sebb wrote:
> > >
> > > > The BeanShell Sampler can execute a command-line.
> > > >
> > > > I think it is as simple as
> > > >
> > > > exec("command-line");
> > > >
> > >
> > > Where do we see the output from this command-line command? Where to look
> > > for the stdout output from such a command called with exec() ??????
> > > Thanks.
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > 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: JMeter extensions

Posted by sebb <se...@gmail.com>.
Java on Linux should work in the same way as far as stdout and stderr
are concerned.

Try:

print("test message");

in BeanShell - that will be written to stdout.

If that appears, but the output from exec() does not, then perhaps the
exec output is not being written to stdout.

You can also try the following in BeanShell:

System.out.println("stdout");
System.err.println("stderr");

and see where they go.

On 21/08/06, Daman Jawda <id...@gmail.com> wrote:
> Yes Unfortunately I run jmeter in linux - if stdout would indeed appear on
> my shell , even though i invoke jmeter with an ampersand at the end, I
> should check the shell for the output of scripts invoked using beanshell
> exec() call in jmeter. But I don't recall seeing any such output on the
> shell since I often go back to the shell while jmeter is running.
>
> Hmmm.
> Without this output my test script would be useless.
>
>
>
> On 8/20/06, sebb <se...@gmail.com> wrote:
> > JMeter does not change stdout or stderr, so it will appear in the
> > command-line console used to start JMeter (unless you used javaw, in
> > which case I'm not sure where stdout goes - it may be thrown away).
> >
> > The same would apply if you wrote your own sampler in Java.
> >
> > On 20/08/06, Jaw Dat <idarataljawda@gmail.com > wrote:
> > > On Sat, 2006-08-19 at 00:23 +0100, sebb wrote:
> > >
> > > > The BeanShell Sampler can execute a command-line.
> > > >
> > > > I think it is as simple as
> > > >
> > > > exec("command-line");
> > > >
> > >
> > > Where do we see the output from this command-line command? Where to look
> > > for the stdout output from such a command called with exec() ??????
> > > Thanks.
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > 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: JMeter extensions

Posted by Daman Jawda <id...@gmail.com>.
Yes Unfortunately I run jmeter in linux - if stdout would indeed appear on
my shell , even though i invoke jmeter with an ampersand at the end, I
should check the shell for the output of scripts invoked using beanshell
exec() call in jmeter. But I don't recall seeing any such output on the
shell since I often go back to the shell while jmeter is running.

Hmmm.
Without this output my test script would be useless.


On 8/20/06, sebb <se...@gmail.com> wrote:
>
> JMeter does not change stdout or stderr, so it will appear in the
> command-line console used to start JMeter (unless you used javaw, in
> which case I'm not sure where stdout goes - it may be thrown away).
>
> The same would apply if you wrote your own sampler in Java.
>
> On 20/08/06, Jaw Dat <id...@gmail.com> wrote:
> > On Sat, 2006-08-19 at 00:23 +0100, sebb wrote:
> >
> > > The BeanShell Sampler can execute a command-line.
> > >
> > > I think it is as simple as
> > >
> > > exec("command-line");
> > >
> >
> > Where do we see the output from this command-line command? Where to look
> > for the stdout output from such a command called with exec() ??????
> > Thanks.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> >
> >
>

Re: JMeter extensions

Posted by sebb <se...@gmail.com>.
JMeter does not change stdout or stderr, so it will appear in the
command-line console used to start JMeter (unless you used javaw, in
which case I'm not sure where stdout goes - it may be thrown away).

The same would apply if you wrote your own sampler in Java.

On 20/08/06, Jaw Dat <id...@gmail.com> wrote:
> On Sat, 2006-08-19 at 00:23 +0100, sebb wrote:
>
> > The BeanShell Sampler can execute a command-line.
> >
> > I think it is as simple as
> >
> > exec("command-line");
> >
>
> Where do we see the output from this command-line command? Where to look
> for the stdout output from such a command called with exec() ??????
> Thanks.
>
>
> ---------------------------------------------------------------------
> 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: JMeter extensions

Posted by Jaw Dat <id...@gmail.com>.
On Sat, 2006-08-19 at 00:23 +0100, sebb wrote:

> The BeanShell Sampler can execute a command-line.
> 
> I think it is as simple as
> 
> exec("command-line");
> 

Where do we see the output from this command-line command? Where to look
for the stdout output from such a command called with exec() ??????
Thanks.


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


Re: JMeter extensions

Posted by sebb <se...@gmail.com>.
On 19/08/06, Alec Swan <au...@yahoo.com> wrote:
> I am trying to extend JMeter with a sampler that can just execute a command line. I copied ExampleSampler and ExampleSamplerGui classes from http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/
> and I added the classes directory to user.classpath in jmeter.properties, but the example sampler does not show up in Edit->Add->Sampler menu.
> 1. I am not sure what the problem is, so I wonder if I missed any steps.

Extensions need to be put in search_paths, not user.classpath - see
the comments in jmeter.properties.

If that does not work, try creating a jar instead, and put the jar in lib/ext.
That will show if there is a problem with the code.

> 2. Could anybody point me to the current documentation which explains in English how to extend JMeter.
>
> 3. Also, is there a repository of JMeter extensions available online? In particular, is there something that add command-line execution functionality to JMeter.

As far as I know, there is no listing of extensions.

The BeanShell Sampler can execute a command-line.

I think it is as simple as

exec("command-line");

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