jmeter-java-dsl icon indicating copy to clipboard operation
jmeter-java-dsl copied to clipboard

Add support for jmx2dsl to output to a target file

Open andy-tarr opened this issue 3 years ago • 3 comments

It would be great if jmx2dsl could generate a class file instead of just console output

andy-tarr avatar Sep 16 '22 14:09 andy-tarr

Hello, thank you for reporting this!

You can use bash output redirection to get the file with a name of your choosing, eg:

java -jar jmx2dsl.jar my.jmx> MyPerformanceTest.java

The main problem this has is that class name defined inside the .java file would not match the one of the file, but can easily be changed, or even automated with grep, ex:

java -jar jmx2dsl.jar my.jmx | grep 's/PerformanceTest/MyPerformanceTest/g' > MyPerformanceTest.java 

Additionally, for each conversion you should check the generated class and do some cleanup (for instance jbang comments for dependencies, and main method definition), and even do some tuning. Consider jmx2dsl as a facilitator, or initial conversion, but always look into converted test plan and adjust accordingly.

In any case might be a good idea to add some flag to the command to control the naming, and potentially ignore jbang dependencies and main invocation.

rabelenda avatar Sep 16 '22 15:09 rabelenda

@andy-tarr do you think the proposed command line executions are good enough? Or do think that it would anyways make sense to have such option?

Regards

rabelenda avatar Nov 10 '22 16:11 rabelenda

@rabelenda the suggested command line options could be sufficient but I think it would make sense to have the option to output to file and set the classname accordingly

andy-tarr avatar Nov 11 '22 17:11 andy-tarr