Here are some reasons you may need a shell script to run before your test runs:

  • Run a security scan
  • Change /ets/hosts
  • Download misc files
  • Install custom packages

Redline13 load agents handle all the setup for distributing packages, preparing test, running test, monitoring test but we don’t predict all your needs.

To handle a customers  setup which we have not predicted, we have a an all-purpose generic plugin which allows you to run a shell script before your test runs.

Three steps

  1. How to Write the custom JMeter plugin
  2. How to enable
  3. How to use for a test run.

Write custom JMeter plugin

  • It’s a bash script
  • Implement “function _plugin_install()”
  • Here is an example
  • Source Example : Agent Plugin (Gist)

    # only one function is required # Your parameters # $1 = home dir for user that will run test # $2 = user, this is user[NUMBER] function _plugin_install() { userHome=$1 # Functions you can use to find other services # $(plugin_getJMeterHome) - Gets path to jmeter version to be used. jmeterHome=$(plugin_getJMeterHome) # other calls # plugin_getJMeterVersion # plugin_getGatlingHome # plugin_getGatlingVersion # plugin_setting "NAME" <- This will get config bundled in load test package. # ## plugin_setting serverCount <- how many servers used for this test run # ## plugin_setting testName <- test name set in UI # Not useful, but an example echo "Hello World" # Change /ets/hosts, you can use sudo - its your load agent echo " my-load-agent" | sudo tee -a /etc/hosts

Enable custom plugins

Using Plugin For Test

  • You need a public link to the file, we use raw github links
    • The plugin we have above has
      • Gist:
      • Raw:
    • We need the ‘Raw’ url.
  • In your JMeter test go to Advanced JMeter Options -> Plugins
  • Enable ‘JMeter Dev’
  • Paste in public URL (Raw gist from above)

Now run your test as usual.