API Use Case: Apache JMeter

Sundararajan Athijegannathan sundararajan.athijegannathan at oracle.com
Thu Aug 6 03:57:27 UTC 2015


Hi Ben,

JShell uses javac for compilation (in process) and JDI for execution 
(out of process). No variables from user context can be exposed to 
JShell.  Also when you read variables defined in "script",  you can only 
String value of the same. Your use case sounds a lot like jsr-223 
(javax.script) "scripting". If so, you may want to consider any of the 
jsr-223 compliant "scripting" language including Nashorn ECMAScript 
engine in jdk8+.

But, if you're okay with specifying JMeter jar to JShell's classpath and 
are okay with initializing JMeter library in JShell "init" scripts, then 
you can use JShell API for your use case.

Hope this helps,
-Sundar

On 8/4/2015 7:01 PM, Ben Evans wrote:
> Hi,
>
> I'm working on a project that makes heavy use of Apache JMeter. This
> doesn't really provide away of scripting it using Java, but it does
> have Beanshell as an option.
>
> Currently, I'm having a terrible time, writing Java inside an IDE, and
> c&p'ing the code as Beanshell into JMeter.
>
> It occurs to me that this would be much more pleasant with JShell
> available inside JMeter.
>
> Is it the intention to expose enough of the API to allow these sort of
> use cases? If so, JMeter integration might be a good second use case.
> I'd certainly be interested in helping with such a project (although I
> do not have much time until Jan 2016).
>
>  From the looks of what's required for integration, I think we'd just
> need to set up a context that predefined the special variables that
> JMeter provides as the primary interface. Possibly a 2-panel setup
> with a REPL and the main script window.
>
> Thanks,
>
> Ben



More information about the kulla-dev mailing list