Good morning everybody, Thank you for your involvement in JMeter and reading 
this message.

I am starting this thread to gather insight on (technical) possibilities for 
embedding JMeter in another program / for running JMeter scripts from other 
Java code. Chris Widhelm started a similar thread in 2004, but that stranded in 
some debate on 'why one would want to do such' and the suggestion to use 
httpunit instead of JMeter.

== why I want JMeter and not some other library ==
I work for a company that created a client-server application in which the 
client communicates to the server via a proprietary and rather complicated web 
of http messages. Simple record and playback on this interface gave challenges 
because of propriety cryptographic key exchange and dynamic values originating 
from the server that must be included in successive calls to the server. 
Somebody in this company created a JMeter plug-in that handles this stuff, 
allowing us to record sessions between client and server and play it back. The 
plug-in is black-box for me and the guy who developed it is, off course, long 
gone.

I want to use JMeter for automated testing of the server side of our 
application because of this plug-in and the good editor for recording new 
scripts. In this automated testing I would like to run jmx scripts as part of 
something bigger and I would like to call it from Java. Since JMeter is written 
in Java I figured this would be possible.

== what I have found so far ==
What I find most is that people install JMeter in a fixed location and call it 
via the command line. That is for example what the JMeter ant task does:
* http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php

To my knowledge there is one solution that attempts to do it all 'the Java way' 
(jars on class path and calling methods), which is the maven-jmeter-plugin (for 
more information on that see):
* http://www.ronniealleva.org/index.php/maven-jmeter-plugin/
* 
https://github.com/Ronnie76er/jmeter-maven-plugin/blob/master/src/main/java/org/apache/jmeter/JMeterMojo.java

As you might see in the last link: there is quite some code involved to put 
property files where JMeter expects them and pass configuration in a 
commandline-ish way. Of course I could go and re-factor this 
jmeter-maven-plugin into some sort of JMeter API, but I am afraid that it will 
turn out to be a rabbit hole, because I am not too familiar with the detailed 
working of JMeter (I can do some basic stuff via the editor, but that I as far 
as I got so far). Also this jmeter-maven-plugin has been developed specifically 
for 2.3.2 and I am afraid that it might become out-dated easily.

== my questions ==
Basically my question(s) are quite open to start with:
* does anyone have experiences with running JMeter embedded in another Java 
program?
* do you guys think it is feasible to create a pure Java API to make this 
easier?
* do you guys think such API should be part of the standard JMeter product 
(separating engine and editor)?
* or does such API maybe already exist?


Thank you for reading this and many thanks in advance for any insight you can 
give me on this topic.

Best regards,
Paul van Leeuwen (CEST / +0200 UTC)



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to