Ivajlo Iliev
Ivajlo Iliev

Reputation: 463

Test java code with JMeter

I have the server functionality of a product packed in jar file, and i have to measure the time of execution of a static method of a class packed in this jar file. Is it possible and if yes, how to do this with JMeter? The only tutorial that i found and that is concerning something similar, is about making junit test and packing it in jar file and putting it in the classpath of jmeter?

Upvotes: 0

Views: 576

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

  1. Put your jar (with any dependencies if needed) somewhere to JMeter Classpath
  2. Restart JMeter to pick the .jar(s) up
  3. Add JSR223 Sampler and invoke your method using Groovy language

That's it, JSR223 Sampler response time will be the value you're looking for. See Apache Groovy - Why and How You Should Use It article for more information on using Groovy scripting in JMeter tests.

Upvotes: 1

Related Questions