testingjmeterbeanshell

Jmeter to test a java main class


I have a java jar file which contains a main class and a batch file to execute the jar file. So I would like to call with Jmeter 3 the batch file to execute the java main class.

Could some one can help me, because it's my first time to use Jmeter? I have tried to use beanshell, but no success.

Thanks


Solution

  • There are at least 3 options:

    1. Use OS Process Sampler to call the batch file by means of your operating system
    2. Use JSR223 Sampler to do the same, this approach will be cross-platform. The syntax is very simple, it will be just path to your script followed by .execute(), i.e.

      'jmeter.bat'.execute()
      
    3. Add your .jar to JMeter Classpath and call your class "main" method using: