2
votes

I wrote a JMeter testplan containing hundreds of HTTP samplers/assertions. As JMeter executes each HTTP sampler, I want it to run an OS Process Sampler pre and post execution (basically call scripts to write out to remote log files on other integrated systems the start and finish points of the HTTP sampler testcase so that I know which logs correspond to which HTTP sampler executed). I don't want to have to sandwich each HTTP sampler with OS Process samplers. I was wondering if there is a way to get JMeter to execute the pre and post OS Process samplers in the background every time a HTTP sampler is run without having to explicitly add them to the testplan hierarchy. So, I currently have in the testplan tree:

  • Pre-OS Process Sampler (explicit)
    • HTTP Sampler #1
    • Assertions #1
  • Post-OS Process Sampler (explicit)
  • Pre-OS Process Sampler (explicit)
    • HTTP Sampler #2
    • Assertions #2
  • Post-OS Process Sampler (explicit)

But I want instead:

  • Pre-OS Process Sampler (on call in background)
  • Post-OS Process Sampler (on call in background)
  • HTTP Sampler #1
    • Assertions #1
  • HTTP Sampler #2
    • Assertions #2

Thanks for any guidance!

Mo

1

1 Answers

0
votes

I am not sure what you are trying to do is the right method as it will negatively impact performances of the machine hosting jmeter.

I suggest you do it differently:

  • start a listener thread that will handle the sending of logging messages, if possible try to find a better way than process launching througj java api or webservice
  • use pre/post processor using jsr223 + groovy to send your messages to it

It will be much lighter

You can have a look at:

And implement your own inspiring yourself from: