You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Maxime Chassagneux <ma...@gmail.com> on 2015/06/22 17:01:44 UTC

Generate JMX file from Java Source Code

I want to generate a JMX file in a Java program.

I start to use the JMeter API to do this, and all work, except that I can't
keep the order of my Sampler in the JMX file saved.

This is a short example of what I do :

HashTree testPlanHashTree = new HashTree() ;

ListedHashTree loginTemplate = (ListedHashTree) SaveService.loadTree(new
File("\\\\toto\\Applis\\LogginV1.jmx"));

testPlanHashTree.add(loginTemplate);

SaveService.saveTree(testPlanHashTree, new
FileOutputStream("C:\\tmp\\test.jmx"));

How could I keep the order of the sample ?

Re: Generate JMX file from Java Source Code

Posted by Steven Swor <sw...@gmail.com>.
Hi,

The guys over at Flood.IO have put together a Ruby DSL for generating the
JMX, which you might find useful (https://github.com/flood-io/ruby-jmeter),
depending on what you're trying to achieve. I've used it a couple times in
the past and found it was a good fit for how I was trying to write and
maintain the test plans as code.

Cheers,
Steve

On Tue, Jun 23, 2015 at 1:01 AM, Maxime Chassagneux <
maxime.chassagneux@gmail.com> wrote:

> I want to generate a JMX file in a Java program.
>
> I start to use the JMeter API to do this, and all work, except that I can't
> keep the order of my Sampler in the JMX file saved.
>
> This is a short example of what I do :
>
> HashTree testPlanHashTree = new HashTree() ;
>
> ListedHashTree loginTemplate = (ListedHashTree) SaveService.loadTree(new
> File("\\\\toto\\Applis\\LogginV1.jmx"));
>
> testPlanHashTree.add(loginTemplate);
>
> SaveService.saveTree(testPlanHashTree, new
> FileOutputStream("C:\\tmp\\test.jmx"));
>
> How could I keep the order of the sample ?
>